當前位置: 首頁>>代碼示例>>C#>>正文


C# CSharp.EventField類代碼示例

本文整理匯總了C#中Mono.CSharp.EventField的典型用法代碼示例。如果您正苦於以下問題:C# EventField類的具體用法?C# EventField怎麽用?C# EventField使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


EventField類屬於Mono.CSharp命名空間,在下文中一共展示了EventField類的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Visit

			public override void Visit (EventField e)
			{
				EventDeclaration newEvent = new EventDeclaration ();
				
				var location = LocationsBag.GetMemberLocation (e);
				AddModifiers (newEvent, location);
				
				if (location != null)
					newEvent.AddChild (new CSharpTokenNode (Convert (location[0]), "event".Length), EventDeclaration.Roles.Keyword);
				newEvent.AddChild ((INode)e.TypeName.Accept (this), AbstractNode.Roles.ReturnType);
				newEvent.AddChild (new Identifier (e.MemberName.Name, Convert (e.MemberName.Location)), EventDeclaration.Roles.Identifier);
				if (location != null)
					newEvent.AddChild (new CSharpTokenNode (Convert (location[1]), ";".Length), EventDeclaration.Roles.Semicolon);
				
				typeStack.Peek ().AddChild (newEvent, TypeDeclaration.Roles.Member);
			}
開發者ID:pgoron,項目名稱:monodevelop,代碼行數:16,代碼來源:CSharpParser.cs

示例2: Define

		public override bool Define()
		{
			var mod_flags_src = ModFlags;

			if (!base.Define ())
				return false;

			if (declarators != null) {
				if ((mod_flags_src & Modifiers.DEFAULT_ACCESS_MODIFER) != 0)
					mod_flags_src &= ~(Modifiers.AccessibilityMask | Modifiers.DEFAULT_ACCESS_MODIFER);

				var t = new TypeExpression (MemberType, TypeExpression.Location);
				foreach (var d in declarators) {
					var ef = new EventField (Parent, t, mod_flags_src, new MemberName (d.Name.Value, d.Name.Location), OptAttributes);

					if (d.Initializer != null)
						ef.initializer = d.Initializer;

					ef.Define ();
					Parent.PartialContainer.Members.Add (ef);
				}
			}

			if (!HasBackingField) {
				SetIsUsed ();
				return true;
			}

			if (Add.IsInterfaceImplementation)
				SetIsUsed ();

			backing_field = new Field (Parent,
				new TypeExpression (MemberType, Location),
				Modifiers.BACKING_FIELD | Modifiers.COMPILER_GENERATED | Modifiers.PRIVATE | (ModFlags & (Modifiers.STATIC | Modifiers.UNSAFE)),
				MemberName, null);

			Parent.PartialContainer.Members.Add (backing_field);
			backing_field.Initializer = Initializer;
			backing_field.ModFlags &= ~Modifiers.COMPILER_GENERATED;

			// Call define because we passed fields definition
			backing_field.Define ();

			// Set backing field for event fields
			spec.BackingField = backing_field.Spec;

			return true;
		}
開發者ID:bbqchickenrobot,項目名稱:playscript-mono,代碼行數:48,代碼來源:property.cs

示例3: EventFieldAccessor

			protected EventFieldAccessor (EventField method, string prefix)
				: base (method, prefix, null, method.Location)
			{
			}
開發者ID:bbqchickenrobot,項目名稱:playscript-mono,代碼行數:4,代碼來源:property.cs

示例4: AddDelegateMethod

			public AddDelegateMethod (EventField method):
				base (method, AddPrefix)
			{
			}
開發者ID:bbqchickenrobot,項目名稱:playscript-mono,代碼行數:4,代碼來源:property.cs

示例5: RemoveDelegateMethod

			public RemoveDelegateMethod (EventField method):
				base (method, RemovePrefix)
			{
			}
開發者ID:bbqchickenrobot,項目名稱:playscript-mono,代碼行數:4,代碼來源:property.cs

示例6: Visit

			public override void Visit (EventField e)
			{
				var evt = new DomEvent ();
				evt.Name = ConvertQuoted (e.MemberName.Name);
				evt.Documentation = RetrieveDocumentation (e.Location.Row);
				evt.Location = Convert (e.MemberName.Location);
				evt.Modifiers = ConvertModifiers (e.ModFlags);
				evt.ReturnType = ConvertReturnType (e.TypeName);
				AddAttributes (evt, e.OptAttributes, e);
				AddExplicitInterfaces (evt, e);
				evt.DeclaringType = typeStack.Peek ();
				typeStack.Peek ().Add (evt);
				if (e.Declarators != null) {
					foreach (var decl in e.Declarators) {
						evt = new DomEvent ();
						evt.Name = ConvertQuoted (decl.Name.Value);
						evt.Location = Convert (decl.Name.Location);
						evt.Modifiers = ConvertModifiers (e.ModFlags);
						evt.ReturnType = ConvertReturnType (e.TypeName);
						AddAttributes (evt, e.OptAttributes, e);
						evt.DeclaringType = typeStack.Peek ();
						typeStack.Peek ().Add (evt);
					}
				}
			}
開發者ID:RainsSoft,項目名稱:playscript-monodevelop,代碼行數:25,代碼來源:McsParser.cs

示例7: Visit

			public override void Visit(EventField e)
			{
				var newEvent = new EventDeclaration();
				AddAttributeSection(newEvent, e);
				var location = LocationsBag.GetMemberLocation(e);
				int l = 0;
				AddModifiers(newEvent, location);
				
				if (location != null && location.Count > 0)
					newEvent.AddChild(new CSharpTokenNode(Convert(location [l++]), EventDeclaration.EventKeywordRole), EventDeclaration.EventKeywordRole);
				newEvent.AddChild(ConvertToType(e.TypeExpression), Roles.Type);
				
				var variable = new VariableInitializer();
				variable.AddChild(Identifier.Create(e.MemberName.Name, Convert(e.MemberName.Location)), Roles.Identifier);
				
				if (e.Initializer != null) {
					if (location != null && location.Count > l)
						variable.AddChild(new CSharpTokenNode(Convert(location [l++]), Roles.Assign), Roles.Assign);
					variable.AddChild((Expression)e.Initializer.Accept(this), Roles.Expression);
				}
				newEvent.AddChild(variable, Roles.Variable);
				if (e.Declarators != null) {
					foreach (var decl in e.Declarators) {
						var declLoc = LocationsBag.GetLocations(decl);
						if (declLoc != null)
							newEvent.AddChild(new CSharpTokenNode(Convert(declLoc [0]), Roles.Comma), Roles.Comma);
						
						variable = new VariableInitializer();
						variable.AddChild(Identifier.Create(decl.Name.Value, Convert(decl.Name.Location)), Roles.Identifier);

						if (decl.Initializer != null) {
							if (declLoc != null)
								variable.AddChild(new CSharpTokenNode(Convert(declLoc [1]), Roles.Assign), Roles.Assign);
							variable.AddChild((Expression)decl.Initializer.Accept(this), Roles.Expression);
						}
						newEvent.AddChild(variable, Roles.Variable);
					}
				}
				
				if (location != null && location.Count > l)
					newEvent.AddChild(new CSharpTokenNode(Convert(location [l++]), Roles.Semicolon), Roles.Semicolon);
				
				typeStack.Peek().AddChild(newEvent, Roles.TypeMemberRole);
			}
開發者ID:0xb1dd1e,項目名稱:NRefactory,代碼行數:44,代碼來源:CSharpParser.cs

示例8: Visit

			public override void Visit (EventField e)
			{
				EventDeclaration newEvent = new EventDeclaration ();
				AddAttributeSection (newEvent, e);
				var location = LocationsBag.GetMemberLocation (e);
				AddModifiers (newEvent, location);
				
				if (location != null)
					newEvent.AddChild (new CSharpTokenNode (Convert (location[0]), "event".Length), EventDeclaration.Roles.Keyword);
				newEvent.AddChild (ConvertToType (e.TypeName), AstNode.Roles.Type);
				
				VariableInitializer variable = new VariableInitializer ();
				variable.AddChild (Identifier.Create (e.MemberName.Name, Convert (e.MemberName.Location)), FieldDeclaration.Roles.Identifier);
				
				if (e.Initializer != null) {
					if (location != null)
						variable.AddChild (new CSharpTokenNode (Convert (location[0]), 1), FieldDeclaration.Roles.Assign);
					variable.AddChild ((Expression)e.Initializer.Accept (this), VariableInitializer.Roles.Expression);
				}
				newEvent.AddChild (variable, FieldDeclaration.Roles.Variable);
				if (e.Declarators != null) {
					foreach (var decl in e.Declarators) {
						var declLoc = LocationsBag.GetLocations (decl);
						if (declLoc != null)
							newEvent.AddChild (new CSharpTokenNode (Convert (declLoc [0]), 1), FieldDeclaration.Roles.Comma);
						
						variable = new VariableInitializer ();
						variable.AddChild (Identifier.Create (decl.Name.Value, Convert (decl.Name.Location)), VariableInitializer.Roles.Identifier);

						if (decl.Initializer != null) {
							if (declLoc != null)
								variable.AddChild (new CSharpTokenNode (Convert (declLoc [1]), 1), FieldDeclaration.Roles.Assign);
							variable.AddChild ((Expression)decl.Initializer.Accept (this), VariableInitializer.Roles.Expression);
						}
						newEvent.AddChild (variable, FieldDeclaration.Roles.Variable);
					}
				}
				
				if (location != null)
					newEvent.AddChild (new CSharpTokenNode (Convert (location[1]), ";".Length), EventDeclaration.Roles.Semicolon);
				
				typeStack.Peek ().AddChild (newEvent, TypeDeclaration.MemberRole);
			}
開發者ID:N3X15,項目名稱:ILSpy,代碼行數:43,代碼來源:CSharpParser.cs

示例9: Define

		public override bool Define()
		{
			if (!base.Define ())
				return false;

			if (declarators != null) {
				var t = new TypeExpression (MemberType, TypeExpression.Location);
				int index = Parent.PartialContainer.Events.IndexOf (this);
				foreach (var d in declarators) {
					var ef = new EventField (Parent, t, ModFlags, new MemberName (d.Name.Value, d.Name.Location), OptAttributes);

					if (d.Initializer != null)
						ef.initializer = d.Initializer;

					Parent.PartialContainer.Events.Insert (++index, ef);
				}
			}

			if (!HasBackingField) {
				SetIsUsed ();
				return true;
			}

			if (Add.IsInterfaceImplementation)
				SetIsUsed ();

			backing_field = new Field (Parent,
				new TypeExpression (MemberType, Location),
				Modifiers.BACKING_FIELD | Modifiers.COMPILER_GENERATED | Modifiers.PRIVATE | (ModFlags & (Modifiers.STATIC | Modifiers.UNSAFE)),
				MemberName, null);

			Parent.PartialContainer.AddField (backing_field);
			backing_field.Initializer = Initializer;
			backing_field.ModFlags &= ~Modifiers.COMPILER_GENERATED;

			// Call define because we passed fields definition
			backing_field.Define ();

			// Set backing field for event fields
			spec.BackingField = backing_field.Spec;

			return true;
		}
開發者ID:afaerber,項目名稱:mono,代碼行數:43,代碼來源:property.cs

示例10: Visit

		public virtual void Visit (EventField e)
		{
		}
開發者ID:KAW0,項目名稱:Alter-Native,代碼行數:3,代碼來源:visit.cs

示例11: EventFieldAccessor

 protected EventFieldAccessor(EventField method, string prefix)
     : base(method, prefix)
 {
 }
開發者ID:speier,項目名稱:shake,代碼行數:4,代碼來源:property.cs

示例12: Visit

			public override void Visit (EventField e)
			{
				DomEvent evt = new DomEvent ();
				evt.Name = e.MemberName.Name;
				evt.Documentation = RetrieveDocumentation (e.Location.Row);
				evt.Location = Convert (e.MemberName.Location);
				evt.Modifiers = ConvertModifiers (e.ModFlags);
				evt.ReturnType = ConvertReturnType (e.TypeName);
				AddAttributes (evt, e.OptAttributes);
				AddExplicitInterfaces (evt, e);
				evt.DeclaringType = typeStack.Peek ();
				typeStack.Peek ().Add (evt);
			}
開發者ID:pgoron,項目名稱:monodevelop,代碼行數:13,代碼來源:McsParser.cs


注:本文中的Mono.CSharp.EventField類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。