当前位置: 首页>>代码示例>>C#>>正文


C# CSharp.Accessor类代码示例

本文整理汇总了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");
                }
            }
开发者ID:speier,项目名称:shake,代码行数:11,代码来源:property.cs

示例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);
        }
开发者ID:speier,项目名称:shake,代码行数:27,代码来源:iterators.cs

示例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);
			}
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:49,代码来源:CSharpParser.cs

示例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;
        }
开发者ID:speier,项目名称:shake,代码行数:8,代码来源:method.cs

示例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);
			}
开发者ID:N3X15,项目名称:ILSpy,代码行数:65,代码来源:CSharpParser.cs

示例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)
		{
		}
开发者ID:emtees,项目名称:old-code,代码行数:8,代码来源:class.cs

示例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;
		}
开发者ID:emtees,项目名称:old-code,代码行数:7,代码来源:class.cs

示例8: RemoveDelegateMethod

 public RemoveDelegateMethod(EventProperty method, Accessor accessor)
     : base(method, accessor, RemovePrefix)
 {
 }
开发者ID:speier,项目名称:shake,代码行数:4,代码来源:property.cs

示例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);
        }
开发者ID:speier,项目名称:shake,代码行数:19,代码来源:property.cs

示例10: AddDelegateMethod

 public AddDelegateMethod(EventProperty method, Accessor accessor)
     : base(method, accessor, AddPrefix)
 {
 }
开发者ID:speier,项目名称:shake,代码行数:4,代码来源:property.cs

示例11: AEventPropertyAccessor

 protected AEventPropertyAccessor(EventProperty method, Accessor accessor, string prefix)
     : base(method, accessor, prefix)
 {
 }
开发者ID:speier,项目名称:shake,代码行数:4,代码来源:property.cs

示例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);
 }
开发者ID:speier,项目名称:shake,代码行数:8,代码来源:property.cs

示例13: AEventAccessor

 protected AEventAccessor(Event method, Accessor accessor, string prefix)
     : base(method, accessor, prefix)
 {
     this.method = method;
     this.ModFlags = method.ModFlags;
 }
开发者ID:speier,项目名称:shake,代码行数:6,代码来源:property.cs

示例14: SetMethod

 public SetMethod(PropertyBase method, Accessor accessor)
     : base(method, accessor, "set_")
 {
     this.parameters = accessor.Parameters;
 }
开发者ID:speier,项目名称:shake,代码行数:5,代码来源:property.cs

示例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;
		}
开发者ID:lewurm,项目名称:benchmarker,代码行数:5,代码来源:support.cs


注:本文中的Mono.CSharp.Accessor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。