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


C# Ast.DelegateDeclaration类代码示例

本文整理汇总了C#中ICSharpCode.NRefactory.Ast.DelegateDeclaration的典型用法代码示例。如果您正苦于以下问题:C# DelegateDeclaration类的具体用法?C# DelegateDeclaration怎么用?C# DelegateDeclaration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DelegateDeclaration类属于ICSharpCode.NRefactory.Ast命名空间,在下文中一共展示了DelegateDeclaration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: VisitDelegateDeclaration

		public override object VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, object data)
		{
			// fix default visibility of inner classes
			if (currentTypeDeclaration != null && (delegateDeclaration.Modifier & Modifiers.Visibility) == 0)
				delegateDeclaration.Modifier |= Modifiers.Public;
			
			return base.VisitDelegateDeclaration(delegateDeclaration, data);
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:8,代码来源:VBNetConstructsConvertVisitor.cs

示例2: TestParameters

		void TestParameters(DelegateDeclaration dd)
		{
			Assert.AreEqual(3, dd.Parameters.Count);
			
			Assert.AreEqual("a", ((ParameterDeclarationExpression)dd.Parameters[0]).ParameterName);
			Assert.AreEqual("System.Int32", ((ParameterDeclarationExpression)dd.Parameters[0]).TypeReference.Type);
			
			Assert.AreEqual("secondParam", ((ParameterDeclarationExpression)dd.Parameters[1]).ParameterName);
			Assert.AreEqual("System.Int32", ((ParameterDeclarationExpression)dd.Parameters[1]).TypeReference.Type);
			
			Assert.AreEqual("lastParam", ((ParameterDeclarationExpression)dd.Parameters[2]).ParameterName);
			Assert.AreEqual("MyObj", ((ParameterDeclarationExpression)dd.Parameters[2]).TypeReference.Type);
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:13,代码来源:DelegateDeclarationTests.cs

示例3: VisitEventDeclaration

 public override object VisitEventDeclaration(EventDeclaration eventDeclaration, object data)
 {
     if (!eventDeclaration.HasAddRegion && !eventDeclaration.HasRaiseRegion && !eventDeclaration.HasRemoveRegion) {
         if (eventDeclaration.TypeReference.IsNull) {
             DelegateDeclaration dd = new DelegateDeclaration(eventDeclaration.Modifier, null);
             dd.Name = eventDeclaration.Name + "EventHandler";
             dd.Parameters = eventDeclaration.Parameters;
             dd.ReturnType = new TypeReference("System.Void");
             dd.Parent = eventDeclaration.Parent;
             eventDeclaration.Parameters = null;
             InsertAfterSibling(eventDeclaration, dd);
             eventDeclaration.TypeReference = new TypeReference(dd.Name);
         }
     }
     return base.VisitEventDeclaration(eventDeclaration, data);
 }
开发者ID:almazik,项目名称:ILSpy,代码行数:16,代码来源:ToCSharpConvertVisitor.cs

示例4: VisitEventDeclaration

		// The following conversions are implemented:
		//   Public Event EventName(param As String) -> automatic delegate declaration
		//   static variables inside methods become fields
		
		public override object VisitEventDeclaration(EventDeclaration eventDeclaration, object data)
		{
			if (!eventDeclaration.HasAddRegion && !eventDeclaration.HasRaiseRegion && !eventDeclaration.HasRemoveRegion) {
				if (eventDeclaration.TypeReference.IsNull) {
					DelegateDeclaration dd = new DelegateDeclaration(eventDeclaration.Modifier, null);
					dd.Name = eventDeclaration.Name + "EventHandler";
					dd.Parameters = eventDeclaration.Parameters;
					dd.ReturnType = new TypeReference("System.Void");
					dd.Parent = eventDeclaration.Parent;
					eventDeclaration.Parameters = null;
					int index = eventDeclaration.Parent.Children.IndexOf(eventDeclaration);
					// inserting before current position is not allowed in a Transformer
					eventDeclaration.Parent.Children.Insert(index + 1, dd);
					eventDeclaration.TypeReference = new TypeReference(dd.Name);
				}
			}
			return base.VisitEventDeclaration(eventDeclaration, data);
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:22,代码来源:ToCSharpConvertVisitor.cs

示例5: TypeDecl


//.........这里部分代码省略.........
				InterfaceBody();
				if (la.kind == 11) {
					lexer.NextToken();
				}

#line  449 "cs.ATG" 
				newType.EndLocation = t.EndLocation; 
				BlockEnd();
				
			} else if (la.kind == 68) {
				lexer.NextToken();

#line  453 "cs.ATG" 
				TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
				AddChild(newType);
				BlockStart(newType);
				newType.StartLocation = m.GetDeclarationLocation(t.Location);
				newType.Type = Types.Enum;
				
				Identifier();

#line  459 "cs.ATG" 
				newType.Name = t.val; 
				if (la.kind == 9) {
					lexer.NextToken();
					IntegralType(
#line  460 "cs.ATG" 
out name);

#line  460 "cs.ATG" 
					newType.BaseTypes.Add(new TypeReference(name, true)); 
				}

#line  462 "cs.ATG" 
				newType.BodyStartLocation = t.EndLocation; 
				EnumBody();
				if (la.kind == 11) {
					lexer.NextToken();
				}

#line  464 "cs.ATG" 
				newType.EndLocation = t.EndLocation; 
				BlockEnd();
				
			} else {
				lexer.NextToken();

#line  468 "cs.ATG" 
				DelegateDeclaration delegateDeclr = new DelegateDeclaration(m.Modifier, attributes);
				templates = delegateDeclr.Templates;
				delegateDeclr.StartLocation = m.GetDeclarationLocation(t.Location);
				
				if (
#line  472 "cs.ATG" 
NotVoidPointer()) {
					Expect(123);

#line  472 "cs.ATG" 
					delegateDeclr.ReturnType = new TypeReference("System.Void", true); 
				} else if (StartOf(10)) {
					Type(
#line  473 "cs.ATG" 
out type);

#line  473 "cs.ATG" 
					delegateDeclr.ReturnType = type; 
				} else SynErr(154);
				Identifier();

#line  475 "cs.ATG" 
				delegateDeclr.Name = t.val; 
				if (la.kind == 23) {
					TypeParameterList(
#line  478 "cs.ATG" 
templates);
				}
				Expect(20);
				if (StartOf(11)) {
					FormalParameterList(
#line  480 "cs.ATG" 
p);

#line  480 "cs.ATG" 
					delegateDeclr.Parameters = p; 
				}
				Expect(21);
				while (la.kind == 127) {
					TypeParameterConstraintsClause(
#line  484 "cs.ATG" 
templates);
				}
				Expect(11);

#line  486 "cs.ATG" 
				delegateDeclr.EndLocation = t.EndLocation;
				AddChild(delegateDeclr);
				
			}
		} else SynErr(155);
	}
开发者ID:pluraldj,项目名称:SharpDevelop,代码行数:101,代码来源:Parser.cs

示例6: VisitDelegateDeclaration

 public virtual bool VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, object d)
 {
     if ((delegateDeclaration == null)) {
         return SetFailure();
     }
     if ((d == null)) {
         return SetFailure();
     }
     if ((delegateDeclaration.Attributes == null)) {
         return SetFailure();
     }
     if ((delegateDeclaration.ReturnType == null)) {
         return SetFailure();
     }
     if ((delegateDeclaration.Parameters == null)) {
         return SetFailure();
     }
     if ((delegateDeclaration.Templates == null)) {
         return SetFailure();
     }
     if(delegateDeclaration.GetType() != d.GetType()) {return SetFailure();}
     var data = (DelegateDeclaration)d;
     if (!IsMatch(delegateDeclaration, data)) {
         return SetFailure();
     }
     if (delegateDeclaration.Attributes.Count == data.Attributes.Count) {
     for (int i=0; i<delegateDeclaration.Attributes.Count;i++) {
         AttributeSection o = delegateDeclaration.Attributes[i];
         if(o == null){return SetFailure();}
         if((bool)o.AcceptVisitor(this, data.Attributes[i]) == false) return SetFailure();
     }			}			else { return SetFailure(); }
     delegateDeclaration.ReturnType.AcceptVisitor(this, data.ReturnType);
     if (delegateDeclaration.Parameters.Count == data.Parameters.Count) {
     for (int i=0; i<delegateDeclaration.Parameters.Count;i++) {
         ParameterDeclarationExpression o = delegateDeclaration.Parameters[i];
         if(o == null){return SetFailure();}
         if((bool)o.AcceptVisitor(this, data.Parameters[i]) == false) return SetFailure();
     }			}			else { return SetFailure(); }
     if (delegateDeclaration.Templates.Count == data.Templates.Count) {
     for (int i=0; i<delegateDeclaration.Templates.Count;i++) {
         TemplateDefinition o = delegateDeclaration.Templates[i];
         if(o == null){return SetFailure();}
         if((bool)o.AcceptVisitor(this, data.Templates[i]) == false) return SetFailure();
     }			}			else { return SetFailure(); }
     return true;
 }
开发者ID:jbuedel,项目名称:AgentRalphPlugin,代码行数:46,代码来源:AstComparisonVisitor.Generated.cs

示例7: NonModuleDeclaration


//.........这里部分代码省略.........
			Identifier();

#line  495 "VBNET.ATG" 
			newType.Name = t.val; 
			TypeParameterList(
#line  496 "VBNET.ATG" 
newType.Templates);
			EndOfStmt();

#line  498 "VBNET.ATG" 
			newType.BodyStartLocation = t.Location; 
			while (la.kind == 110) {
				InterfaceBase(
#line  499 "VBNET.ATG" 
out baseInterfaces);

#line  499 "VBNET.ATG" 
				newType.BaseTypes.AddRange(baseInterfaces); 
			}
			InterfaceBody(
#line  500 "VBNET.ATG" 
newType);

#line  502 "VBNET.ATG" 
			compilationUnit.BlockEnd();
			
			break;
		}
		case 80: {
			lexer.NextToken();

#line  507 "VBNET.ATG" 
			m.Check(Modifiers.VBDelegates);
			DelegateDeclaration delegateDeclr = new DelegateDeclaration(m.Modifier, attributes);
			delegateDeclr.ReturnType = new TypeReference("", "System.Void");
			delegateDeclr.StartLocation = m.GetDeclarationLocation(t.Location);
			List<ParameterDeclarationExpression> p = new List<ParameterDeclarationExpression>();
			
			if (la.kind == 167) {
				lexer.NextToken();
				Identifier();

#line  514 "VBNET.ATG" 
				delegateDeclr.Name = t.val; 
				TypeParameterList(
#line  515 "VBNET.ATG" 
delegateDeclr.Templates);
				if (la.kind == 24) {
					lexer.NextToken();
					if (StartOf(4)) {
						FormalParameterList(
#line  516 "VBNET.ATG" 
p);
					}
					Expect(25);

#line  516 "VBNET.ATG" 
					delegateDeclr.Parameters = p; 
				}
			} else if (la.kind == 100) {
				lexer.NextToken();
				Identifier();

#line  518 "VBNET.ATG" 
				delegateDeclr.Name = t.val; 
				TypeParameterList(
开发者ID:almazik,项目名称:ILSpy,代码行数:67,代码来源:Parser.cs

示例8: VisitDelegateDeclaration

		public sealed override object VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, object data) {
			this.BeginVisit(delegateDeclaration);
			object result = this.TrackedVisitDelegateDeclaration(delegateDeclaration, data);
			this.EndVisit(delegateDeclaration);
			return result;
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:6,代码来源:NodeTrackingAstVisitor.cs

示例9: TrackedVisitDelegateDeclaration

 public override object TrackedVisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, object data)
 {
     Console.WriteLine("VisitDelegateDeclaration");
     return null;
 }
开发者ID:L3tum,项目名称:BesiegeScriptingMod,代码行数:5,代码来源:NRefactoryToPythonConverter.cs

示例10: TestDelegateDeclaration

		void TestDelegateDeclaration(DelegateDeclaration dd)
		{
			Assert.AreEqual("System.Void", dd.ReturnType.Type);
			Assert.AreEqual("MyDelegate", dd.Name);
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:5,代码来源:DelegateDeclarationTests.cs

示例11: NonModuleDeclaration


//.........这里部分代码省略.........
			Identifier();

#line  514 "VBNET.ATG" 
			newType.Name = t.val; 
			TypeParameterList(
#line  515 "VBNET.ATG" 
newType.Templates);
			EndOfStmt();

#line  517 "VBNET.ATG" 
			newType.BodyStartLocation = t.Location; 
			while (la.kind == 127) {
				InterfaceBase(
#line  518 "VBNET.ATG" 
out baseInterfaces);

#line  518 "VBNET.ATG" 
				newType.BaseTypes.AddRange(baseInterfaces); 
			}
			InterfaceBody(
#line  519 "VBNET.ATG" 
newType);

#line  521 "VBNET.ATG" 
			compilationUnit.BlockEnd();
			
			break;
		}
		case 90: {
			lexer.NextToken();

#line  526 "VBNET.ATG" 
			m.Check(Modifiers.VBDelegates);
			DelegateDeclaration delegateDeclr = new DelegateDeclaration(m.Modifier, attributes);
			delegateDeclr.ReturnType = new TypeReference("System.Void", true);
			delegateDeclr.StartLocation = m.GetDeclarationLocation(t.Location);
			List<ParameterDeclarationExpression> p = new List<ParameterDeclarationExpression>();
			
			if (la.kind == 195) {
				lexer.NextToken();
				Identifier();

#line  533 "VBNET.ATG" 
				delegateDeclr.Name = t.val; 
				TypeParameterList(
#line  534 "VBNET.ATG" 
delegateDeclr.Templates);
				if (la.kind == 25) {
					lexer.NextToken();
					if (StartOf(4)) {
						FormalParameterList(
#line  535 "VBNET.ATG" 
p);
					}
					Expect(26);

#line  535 "VBNET.ATG" 
					delegateDeclr.Parameters = p; 
				}
			} else if (la.kind == 114) {
				lexer.NextToken();
				Identifier();

#line  537 "VBNET.ATG" 
				delegateDeclr.Name = t.val; 
				TypeParameterList(
开发者ID:Adam-Fogle,项目名称:agentralphplugin,代码行数:67,代码来源:Parser.cs

示例12: VisitDelegateDeclaration

 public virtual object VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, object data) {
     throw CreateException(delegateDeclaration);
 }
开发者ID:hallvar,项目名称:Joddes.CS,代码行数:3,代码来源:JsVisitor.cs

示例13: TypeDecl


//.........这里部分代码省略.........
				InterfaceBody();
				if (la.kind == 11) {
					lexer.NextToken();
				}

#line  440 "Frames/cs.ATG" 
				newType.EndLocation = t.EndLocation; 
				compilationUnit.BlockEnd();
				
			} else if (la.kind == 68) {
				lexer.NextToken();

#line  444 "Frames/cs.ATG" 
				TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
				compilationUnit.AddChild(newType);
				compilationUnit.BlockStart(newType);
				newType.StartLocation = m.GetDeclarationLocation(t.Location);
				newType.Type = Types.Enum;
				
				Identifier();

#line  450 "Frames/cs.ATG" 
				newType.Name = t.val; 
				if (la.kind == 9) {
					lexer.NextToken();
					IntegralType(
#line  451 "Frames/cs.ATG" 
out name);

#line  451 "Frames/cs.ATG" 
					newType.BaseTypes.Add(new TypeReference(name, true)); 
				}

#line  453 "Frames/cs.ATG" 
				newType.BodyStartLocation = t.EndLocation; 
				EnumBody();
				if (la.kind == 11) {
					lexer.NextToken();
				}

#line  455 "Frames/cs.ATG" 
				newType.EndLocation = t.EndLocation; 
				compilationUnit.BlockEnd();
				
			} else {
				lexer.NextToken();

#line  459 "Frames/cs.ATG" 
				DelegateDeclaration delegateDeclr = new DelegateDeclaration(m.Modifier, attributes);
				templates = delegateDeclr.Templates;
				delegateDeclr.StartLocation = m.GetDeclarationLocation(t.Location);
				
				if (
#line  463 "Frames/cs.ATG" 
NotVoidPointer()) {
					Expect(123);

#line  463 "Frames/cs.ATG" 
					delegateDeclr.ReturnType = new TypeReference("System.Void", true); 
				} else if (StartOf(10)) {
					Type(
#line  464 "Frames/cs.ATG" 
out type);

#line  464 "Frames/cs.ATG" 
					delegateDeclr.ReturnType = type; 
				} else SynErr(152);
				Identifier();

#line  466 "Frames/cs.ATG" 
				delegateDeclr.Name = t.val; 
				if (la.kind == 23) {
					TypeParameterList(
#line  469 "Frames/cs.ATG" 
templates);
				}
				Expect(20);
				if (StartOf(11)) {
					FormalParameterList(
#line  471 "Frames/cs.ATG" 
p);

#line  471 "Frames/cs.ATG" 
					delegateDeclr.Parameters = p; 
				}
				Expect(21);
				while (la.kind == 127) {
					TypeParameterConstraintsClause(
#line  475 "Frames/cs.ATG" 
templates);
				}
				Expect(11);

#line  477 "Frames/cs.ATG" 
				delegateDeclr.EndLocation = t.EndLocation;
				compilationUnit.AddChild(delegateDeclr);
				
			}
		} else SynErr(153);
	}
开发者ID:okrmartin,项目名称:monodevelop,代码行数:101,代码来源:Parser.cs

示例14: VisitDelegateDeclaration

		public object VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, object data)
		{
			B.CallableDefinition cd = new B.CallableDefinition(GetLexicalInfo(delegateDeclaration));
			cd.Name = delegateDeclaration.Name;
			ConvertAttributes(delegateDeclaration.Attributes, cd.Attributes);
			cd.Modifiers = ConvertModifier(delegateDeclaration, B.TypeMemberModifiers.Private);
			ConvertParameters(delegateDeclaration.Parameters, cd.Parameters);
			cd.ReturnType = ConvertTypeReference(delegateDeclaration.ReturnType);
			if (currentType != null)
				currentType.Members.Add(cd);
			else
				module.Members.Add(cd);
			return cd;
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:14,代码来源:ConvertVisitorGlobal.cs

示例15: VisitDelegateDeclaration

		public virtual object VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, object data) {
			Debug.Assert((delegateDeclaration != null));
			Debug.Assert((delegateDeclaration.Attributes != null));
			Debug.Assert((delegateDeclaration.ReturnType != null));
			Debug.Assert((delegateDeclaration.Parameters != null));
			Debug.Assert((delegateDeclaration.Templates != null));
			for (int i = 0; i < delegateDeclaration.Attributes.Count; i++) {
				AttributeSection o = delegateDeclaration.Attributes[i];
				Debug.Assert(o != null);
				nodeStack.Push(o);
				o.AcceptVisitor(this, data);
				o = (AttributeSection)nodeStack.Pop();
				if (o == null)
					delegateDeclaration.Attributes.RemoveAt(i--);
				else
					delegateDeclaration.Attributes[i] = o;
			}
			nodeStack.Push(delegateDeclaration.ReturnType);
			delegateDeclaration.ReturnType.AcceptVisitor(this, data);
			delegateDeclaration.ReturnType = ((TypeReference)(nodeStack.Pop()));
			for (int i = 0; i < delegateDeclaration.Parameters.Count; i++) {
				ParameterDeclarationExpression o = delegateDeclaration.Parameters[i];
				Debug.Assert(o != null);
				nodeStack.Push(o);
				o.AcceptVisitor(this, data);
				o = (ParameterDeclarationExpression)nodeStack.Pop();
				if (o == null)
					delegateDeclaration.Parameters.RemoveAt(i--);
				else
					delegateDeclaration.Parameters[i] = o;
			}
			for (int i = 0; i < delegateDeclaration.Templates.Count; i++) {
				TemplateDefinition o = delegateDeclaration.Templates[i];
				Debug.Assert(o != null);
				nodeStack.Push(o);
				o.AcceptVisitor(this, data);
				o = (TemplateDefinition)nodeStack.Pop();
				if (o == null)
					delegateDeclaration.Templates.RemoveAt(i--);
				else
					delegateDeclaration.Templates[i] = o;
			}
			return null;
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:44,代码来源:AbstractAstTransformer.cs


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