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


C# AstType.AddChild方法代码示例

本文整理汇总了C#中AstType.AddChild方法的典型用法代码示例。如果您正苦于以下问题:C# AstType.AddChild方法的具体用法?C# AstType.AddChild怎么用?C# AstType.AddChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AstType的用法示例。


在下文中一共展示了AstType.AddChild方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddTypeArguments

			void AddTypeArguments (ATypeNameExpression texpr, AstType result)
			{
				if (texpr.TypeArguments == null || texpr.TypeArguments.Args == null)
					return;
				var loc = LocationsBag.GetLocations (texpr.TypeArguments);
				if (loc != null && loc.Count >= 2)
					result.AddChild (new CSharpTokenNode (Convert (loc [loc.Count - 2]), 1), AstType.Roles.LChevron);
				int i = 0;
				foreach (var arg in texpr.TypeArguments.Args) {
					result.AddChild (ConvertToType (arg), AstType.Roles.TypeArgument);
					if (loc != null && i < loc.Count - 2)
						result.AddChild (new CSharpTokenNode (Convert (loc [i++]), 1), AstType.Roles.Comma);
				}
				if (loc != null && loc.Count >= 2)
					result.AddChild (new CSharpTokenNode (Convert (loc [loc.Count - 1]), 1), AstType.Roles.RChevron);
			}
开发者ID:N3X15,项目名称:ILSpy,代码行数:16,代码来源:CSharpParser.cs

示例2: AddTypeArguments

			void AddTypeArguments (ATypeNameExpression texpr, AstType result)
			{
				if (!texpr.HasTypeArguments)
					return;
				foreach (var arg in texpr.TypeArguments.Args) {
					result.AddChild (ConvertToType (arg), AstType.Roles.TypeArgument);
				}
			}
开发者ID:madkat,项目名称:NRefactory,代码行数:8,代码来源:CSharpParser.cs

示例3: AddTypeArguments

			void AddTypeArguments(ATypeNameExpression texpr, AstType result)
			{
				var unbound = texpr.TypeArguments as UnboundTypeArguments;
				if (unbound != null) { 
					var loc2 = LocationsBag.GetLocations(texpr.TypeArguments);
					if (loc2 == null)
						return;
					int j = 0;
					if (j < loc2.Count)
						result.AddChild(new CSharpTokenNode(Convert(loc2 [j++]), Roles.LChevron), Roles.LChevron);
					while (j < loc2.Count - 1) {
						result.AddChild (new SimpleType (), Roles.TypeArgument);
						result.AddChild(new CSharpTokenNode(Convert(loc2 [j++]), Roles.LChevron), Roles.Comma);
					}
					if (j < loc2.Count) {
						result.AddChild (new SimpleType (), Roles.TypeArgument);
						result.AddChild(new CSharpTokenNode(Convert(loc2 [j++]), Roles.RChevron), Roles.RChevron);
					}
					return;
				}
				if (texpr.TypeArguments == null || texpr.TypeArguments.Args == null)
					return;
				var loc = LocationsBag.GetLocations(texpr.TypeArguments);
				if (loc != null && loc.Count >= 2)
					result.AddChild(new CSharpTokenNode(Convert(loc [loc.Count - 2]), Roles.LChevron), Roles.LChevron);
				int i = 0;
				foreach (var arg in texpr.TypeArguments.Args) {
					result.AddChild(ConvertToType(arg), Roles.TypeArgument);
					if (loc != null && i < loc.Count - 2)
						result.AddChild(new CSharpTokenNode(Convert(loc [i++]), Roles.Comma), Roles.Comma);
				}
				if (loc != null && loc.Count >= 2)
					result.AddChild(new CSharpTokenNode(Convert(loc [loc.Count - 1]), Roles.RChevron), Roles.RChevron);
			}
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:34,代码来源:CSharpParser.cs

示例4: AddTypeArguments

 /// <summary>
 /// Adds type arguments to the result type.
 /// </summary>
 /// <param name="result">The result AST node (a SimpleType or MemberType)</param>
 /// <param name="typeDef">The type definition that owns the type parameters</param>
 /// <param name="typeArguments">The list of type arguments</param>
 /// <param name="startIndex">Index of first type argument to add</param>
 /// <param name="endIndex">Index after last type argument to add</param>
 void AddTypeArguments(AstType result, ITypeDefinition typeDef, IList<IType> typeArguments, int startIndex, int endIndex)
 {
     Debug.Assert(endIndex <= typeDef.TypeParameterCount);
     for (int i = startIndex; i < endIndex; i++) {
         if (ConvertUnboundTypeArguments && typeArguments[i].Kind == TypeKind.UnboundTypeArgument) {
             result.AddChild(new SimpleType(typeDef.TypeParameters[i].Name), Roles.TypeArgument);
         } else {
             result.AddChild(ConvertType(typeArguments[i]), Roles.TypeArgument);
         }
     }
 }
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:19,代码来源:TypeSystemAstBuilder.cs

示例5: AddTypeArguments

		/// <summary>
		/// Adds type arguments to the result type.
		/// </summary>
		/// <param name="result">The result AST node (a SimpleType or MemberType)</param>
		/// <param name="typeArguments">The list of type arguments</param>
		/// <param name="startIndex">Index of first type argument to add</param>
		/// <param name="endIndex">Index after last type argument to add</param>
		void AddTypeArguments(AstType result, IList<IType> typeArguments, int startIndex, int endIndex)
		{
			for (int i = startIndex; i < endIndex; i++) {
				result.AddChild(ConvertType(typeArguments[i]), AstType.Roles.TypeArgument);
			}
		}
开发者ID:BGCX261,项目名称:zoom-decompiler-hg-to-git,代码行数:13,代码来源:TypeSystemAstBuilder.cs


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