本文整理汇总了C#中Mono.CSharp.Accessor类的典型用法代码示例。如果您正苦于以下问题:C# Accessor类的具体用法?C# Accessor怎么用?C# Accessor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Accessor类属于Mono.CSharp命名空间,在下文中一共展示了Accessor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PropertyMethod
public PropertyMethod(PropertyBase method, Accessor accessor,
string prefix)
: base(method, accessor, prefix)
{
this.method = method;
this.ModFlags = accessor.ModFlags | (method.ModFlags & (Modifiers.STATIC | Modifiers.UNSAFE));
if (accessor.ModFlags != 0 && RootContext.Version == LanguageVersion.ISO_1) {
Report.FeatureIsNotAvailable (Location, "access modifiers on properties");
}
}
示例2: Define_Current
void Define_Current(bool is_generic)
{
TypeExpr type;
MemberName name = new MemberName (QualifiedAliasMember.GlobalAlias, "System", null, Location);
name = new MemberName (name, "Collections", Location);
if (is_generic) {
name = new MemberName (name, "Generic", Location);
name = new MemberName (name, "IEnumerator", generic_args, Location);
type = iterator_type_expr;
} else {
name = new MemberName (name, "IEnumerator");
type = TypeManager.system_object_expr;
}
name = new MemberName (name, "Current", Location);
ToplevelBlock get_block = new ToplevelBlock (Compiler, Location);
get_block.AddStatement (new Return (new DynamicFieldExpr (CurrentField, Location), Location));
Accessor getter = new Accessor (get_block, 0, null, null, Location);
Property current = new Property (
this, type, Modifiers.DEBUGGER_HIDDEN, name, null, getter, null, false);
AddProperty (current);
}
示例3: Visit
public override void Visit(EventProperty ep)
{
var newEvent = new CustomEventDeclaration();
AddAttributeSection(newEvent, ep);
var location = LocationsBag.GetMemberLocation(ep);
AddModifiers(newEvent, location);
if (location != null && location.Count > 0)
newEvent.AddChild(new CSharpTokenNode(Convert(location [0]), CustomEventDeclaration.EventKeywordRole), CustomEventDeclaration.EventKeywordRole);
newEvent.AddChild(ConvertToType(ep.TypeExpression), Roles.Type);
AddExplicitInterface(newEvent, ep.MemberName);
newEvent.AddChild(Identifier.Create(ep.MemberName.Name, Convert(ep.Location)), Roles.Identifier);
if (location != null && location.Count >= 2)
newEvent.AddChild(new CSharpTokenNode(Convert(location [1]), Roles.LBrace), Roles.LBrace);
if (ep.Add != null) {
var addAccessor = new Accessor();
AddAttributeSection(addAccessor, ep.Add);
var addLocation = LocationsBag.GetMemberLocation(ep.Add);
AddModifiers(addAccessor, addLocation);
addAccessor.AddChild(new CSharpTokenNode(Convert(ep.Add.Location), CustomEventDeclaration.AddKeywordRole), CustomEventDeclaration.AddKeywordRole);
if (ep.Add.Block != null)
addAccessor.AddChild((BlockStatement)ep.Add.Block.Accept(this), Roles.Body);
newEvent.AddChild(addAccessor, CustomEventDeclaration.AddAccessorRole);
}
if (ep.Remove != null) {
var removeAccessor = new Accessor();
AddAttributeSection(removeAccessor, ep.Remove);
var removeLocation = LocationsBag.GetMemberLocation(ep.Remove);
AddModifiers(removeAccessor, removeLocation);
removeAccessor.AddChild(new CSharpTokenNode(Convert(ep.Remove.Location), CustomEventDeclaration.RemoveKeywordRole), CustomEventDeclaration.RemoveKeywordRole);
if (ep.Remove.Block != null)
removeAccessor.AddChild((BlockStatement)ep.Remove.Block.Accept(this), Roles.Body);
newEvent.AddChild(removeAccessor, CustomEventDeclaration.RemoveAccessorRole);
}
if (location != null && location.Count >= 3) {
newEvent.AddChild(new CSharpTokenNode(Convert(location [2]), Roles.RBrace), Roles.RBrace);
} else {
// parser error, set end node to max value.
newEvent.AddChild(new ErrorNode(), Roles.Error);
}
typeStack.Peek().AddChild(newEvent, Roles.TypeMemberRole);
}
示例4: AbstractPropertyEventMethod
public AbstractPropertyEventMethod(InterfaceMemberBase member, Accessor accessor,
string prefix)
: base(member.Parent, SetupName (prefix, member, accessor.Location),
accessor.Attributes)
{
this.prefix = prefix;
this.block = accessor.Block;
}
示例5: Visit
public override void Visit (Indexer indexer)
{
IndexerDeclaration newIndexer = new IndexerDeclaration ();
AddAttributeSection (newIndexer, indexer);
var location = LocationsBag.GetMemberLocation (indexer);
AddModifiers (newIndexer, location);
newIndexer.AddChild (ConvertToType (indexer.TypeName), IndexerDeclaration.Roles.Type);
var name = indexer.MemberName;
if (name.Left != null) {
newIndexer.AddChild (ConvertToType (name.Left), IndexerDeclaration.PrivateImplementationTypeRole);
var privateImplTypeLoc = LocationsBag.GetLocations (name.Left);
if (privateImplTypeLoc != null)
newIndexer.AddChild (new CSharpTokenNode (Convert (privateImplTypeLoc[0]), 1), MethodDeclaration.Roles.Dot);
}
newIndexer.AddChild (Identifier.Create ("this", Convert (name.Location)), IndexerDeclaration.Roles.Identifier);
if (location != null)
newIndexer.AddChild (new CSharpTokenNode (Convert (location [0]), 1), IndexerDeclaration.Roles.LBracket);
AddParameter (newIndexer, indexer.ParameterInfo);
if (location != null)
newIndexer.AddChild (new CSharpTokenNode (Convert (location[1]), 1), IndexerDeclaration.Roles.RBracket);
if (location != null)
newIndexer.AddChild (new CSharpTokenNode (Convert (location[2]), 1), IndexerDeclaration.Roles.LBrace);
if (indexer.Get != null) {
Accessor getAccessor = new Accessor ();
var getLocation = LocationsBag.GetMemberLocation (indexer.Get);
AddAttributeSection (getAccessor, indexer.Get);
AddModifiers (getAccessor, getLocation);
if (getLocation != null)
getAccessor.AddChild (new CSharpTokenNode (Convert (indexer.Get.Location), "get".Length), PropertyDeclaration.Roles.Keyword);
if (indexer.Get.Block != null) {
getAccessor.AddChild ((BlockStatement)indexer.Get.Block.Accept (this), MethodDeclaration.Roles.Body);
} else {
if (getLocation != null && getLocation.Count > 0)
newIndexer.AddChild (new CSharpTokenNode (Convert (getLocation[0]), 1), MethodDeclaration.Roles.Semicolon);
}
newIndexer.AddChild (getAccessor, PropertyDeclaration.GetterRole);
}
if (indexer.Set != null) {
Accessor setAccessor = new Accessor ();
var setLocation = LocationsBag.GetMemberLocation (indexer.Set);
AddAttributeSection (setAccessor, indexer.Set);
AddModifiers (setAccessor, setLocation);
if (setLocation != null)
setAccessor.AddChild (new CSharpTokenNode (Convert (indexer.Set.Location), "set".Length), PropertyDeclaration.Roles.Keyword);
if (indexer.Set.Block != null) {
setAccessor.AddChild ((BlockStatement)indexer.Set.Block.Accept (this), MethodDeclaration.Roles.Body);
} else {
if (setLocation != null && setLocation.Count > 0)
newIndexer.AddChild (new CSharpTokenNode (Convert (setLocation[0]), 1), MethodDeclaration.Roles.Semicolon);
}
newIndexer.AddChild (setAccessor, PropertyDeclaration.SetterRole);
}
if (location != null) {
newIndexer.AddChild (new CSharpTokenNode (Convert (location[3]), 1), IndexerDeclaration.Roles.RBrace);
} else {
// parser error, set end node to max value.
newIndexer.AddChild (new ErrorNode (), AstNode.Roles.Error);
}
typeStack.Peek ().AddChild (newIndexer, TypeDeclaration.MemberRole);
}
示例6: Property
public Property (Expression type, string name, int mod_flags,
Accessor get_block, Accessor set_block,
Attributes attrs, Location loc)
: base (type, name, mod_flags, AllowedModifiers,
Parameters.EmptyReadOnlyParameters,
get_block, set_block, attrs, loc)
{
}
示例7: Indexer
public Indexer (Expression type, string int_type, int flags, Parameters parameters,
Accessor get_block, Accessor set_block, Attributes attrs, Location loc)
: base (type, "", flags, AllowedModifiers, parameters, get_block, set_block,
attrs, loc)
{
ExplicitInterfaceName = int_type;
}
示例8: RemoveDelegateMethod
public RemoveDelegateMethod(EventProperty method, Accessor accessor)
: base(method, accessor, RemovePrefix)
{
}
示例9: Indexer
public Indexer(DeclSpace parent, FullNamedExpression type, MemberName name, Modifiers mod,
ParametersCompiled parameters, Attributes attrs,
Accessor get_block, Accessor set_block, bool define_set_first)
: base(parent, type, mod,
parent.PartialContainer.Kind == MemberKind.Interface ? AllowedInterfaceModifiers : AllowedModifiers,
name, attrs, define_set_first)
{
this.parameters = parameters;
if (get_block == null)
Get = new GetIndexerMethod (this);
else
Get = new GetIndexerMethod (this, get_block);
if (set_block == null)
Set = new SetIndexerMethod (this);
else
Set = new SetIndexerMethod (this, set_block);
}
示例10: AddDelegateMethod
public AddDelegateMethod(EventProperty method, Accessor accessor)
: base(method, accessor, AddPrefix)
{
}
示例11: AEventPropertyAccessor
protected AEventPropertyAccessor(EventProperty method, Accessor accessor, string prefix)
: base(method, accessor, prefix)
{
}
示例12: EventProperty
public EventProperty(DeclSpace parent, FullNamedExpression type, Modifiers mod_flags,
MemberName name,
Attributes attrs, Accessor add, Accessor remove)
: base(parent, type, mod_flags, name, attrs)
{
Add = new AddDelegateMethod (this, add);
Remove = new RemoveDelegateMethod (this, remove);
}
示例13: AEventAccessor
protected AEventAccessor(Event method, Accessor accessor, string prefix)
: base(method, accessor, prefix)
{
this.method = method;
this.ModFlags = method.ModFlags;
}
示例14: SetMethod
public SetMethod(PropertyBase method, Accessor accessor)
: base(method, accessor, "set_")
{
this.parameters = accessor.Parameters;
}
示例15: Accessors
public Accessors (Accessor get_or_add, Accessor set_or_remove)
{
this.get_or_add = get_or_add;
this.set_or_remove = set_or_remove;
}