當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。