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


C# SimpleType.AddChild方法代码示例

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


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

示例1: ConvertToTypeReference

		public static AstType ConvertToTypeReference (this MonoDevelop.Projects.Dom.IReturnType returnType)
		{
			string primitiveType;
			if (TypeTable.TryGetValue (returnType.DecoratedFullName, out primitiveType))
				return new PrimitiveType (primitiveType);
			
			AstType result = null;
			if (!string.IsNullOrEmpty (returnType.Namespace))
				result = new SimpleType (returnType.Namespace);
			foreach (var part in returnType.Parts) {
				if (result == null) {
					var st = new SimpleType (part.Name);
					foreach (var type in part.GenericArguments.Select (ga => ConvertToTypeReference (ga)))
						st.AddChild (type, SimpleType.Roles.TypeArgument);
					result = st;
				} else {
					var mt = new ICSharpCode.NRefactory.CSharp.MemberType () {
						Target = result,
						MemberName = part.Name
					};
					foreach (var type in part.GenericArguments.Select (ga => ConvertToTypeReference (ga)))
						mt.AddChild (type, SimpleType.Roles.TypeArgument);
					result = mt;
				}
			}
			
			/*
			List<TypeReference> genericTypes = new List<TypeReference> ();
			foreach (MonoDevelop.Projects.Dom.IReturnType genericType in returnType.GenericArguments) {
				genericTypes.Add (ConvertToTypeReference (genericType));
			}
			TypeReference result = new AstType (returnType.FullName, genericTypes);
			result.IsKeyword = true;
			result.PointerNestingLevel = returnType.PointerNestingLevel;
			if (returnType.ArrayDimensions > 0) {
				int[] rankSpecfier = new int[returnType.ArrayDimensions];
				for (int i = 0; i < returnType.ArrayDimensions; i++) {
					rankSpecfier[i] = returnType.GetDimension (i);
				}
				result.RankSpecifier = rankSpecfier;
			}*/
			return result;
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:43,代码来源:HelperMethods.cs

示例2: ConvertImport

			AstType ConvertImport(MemberName memberName)
			{
				if (memberName.Left != null) {
					// left.name
					var t = new MemberType();
//					t.IsDoubleColon = memberName.IsDoubleColon;
					t.AddChild(ConvertImport(memberName.Left), MemberType.TargetRole);
					var loc = LocationsBag.GetLocations(memberName);
					if (loc != null)
						t.AddChild(new CSharpTokenNode(Convert(loc [0]), Roles.Dot), Roles.Dot);
					
					t.AddChild(Identifier.Create(memberName.Name, Convert(memberName.Location)), Roles.Identifier);
					AddTypeArguments(t, memberName);
					return t;
				} else {
					var t = new SimpleType();
					t.AddChild(Identifier.Create(memberName.Name, Convert(memberName.Location)), Roles.Identifier);
					AddTypeArguments(t, memberName);
					return t;
				}
			}
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:21,代码来源:CSharpParser.cs

示例3: ConvertImport

			AstType ConvertImport (MemberName memberName)
			{
				if (memberName.Left != null) {
					// left.name
					var t = new MemberType();
					t.IsDoubleColon = memberName.IsDoubleColon;
					t.AddChild (ConvertImport (memberName.Left), MemberType.TargetRole);
					
					if (!memberName.DotLocation.IsNull)
						t.AddChild (new CSharpTokenNode (Convert (memberName.DotLocation), 1), MemberType.Roles.Dot);
					
					t.AddChild (Identifier.Create (memberName.Name, Convert(memberName.Location)), MemberType.Roles.Identifier);
					AddTypeArguments (t, memberName.TypeArguments);
					return t;
				} else {
					SimpleType t = new SimpleType();
					t.AddChild (Identifier.Create (memberName.Name, Convert(memberName.Location)), SimpleType.Roles.Identifier);
					AddTypeArguments (t, memberName.TypeArguments);
					return t;
				}
			}
开发者ID:N3X15,项目名称:ILSpy,代码行数:21,代码来源:CSharpParser.cs

示例4: UnboundTypeOfExpressionTest

		public void UnboundTypeOfExpressionTest()
		{
			var type = new SimpleType("MyType");
			type.AddChild (new SimpleType (), Roles.TypeArgument);
			type.AddChild (new SimpleType (), Roles.TypeArgument);
			ParseUtilCSharp.AssertExpression(
				"typeof(MyType<,>)",
				new TypeOfExpression {
					Type = type
				});
		}
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:11,代码来源:TypeOfExpressionTests.cs

示例5: ConvertImport

			AstType ConvertImport (MemberName memberName)
			{
				if (memberName.Left != null) {
					// left.name
					var t = new MemberType();
					t.IsDoubleColon = memberName.IsDoubleColon;
					t.AddChild (ConvertImport (memberName.Left), MemberType.TargetRole);
					t.AddChild (Identifier.Create (memberName.Name, Convert(memberName.Location)), MemberType.Roles.Identifier);
					AddTypeArguments (t, (List<Location>)null, memberName.TypeArguments);
					return t;
				} else {
					SimpleType t = new SimpleType();
					t.AddChild (Identifier.Create (memberName.Name, Convert(memberName.Location)), SimpleType.Roles.Identifier);
					AddTypeArguments (t, (List<Location>)null, memberName.TypeArguments);
					return t;
				}
			}
开发者ID:aleksandersumowski,项目名称:monodevelop,代码行数:17,代码来源:CSharpParser.cs

示例6: ConvertImport

			AstType ConvertImport (MemberName memberName)
			{
				if (memberName.Left != null) {
					// left.name
					MemberType t = new MemberType();
					t.IsDoubleColon = memberName.IsDoubleColon;
					t.AddChild (ConvertImport (memberName.Left), MemberType.TargetRole);
					t.AddChild (new Identifier (memberName.Name, Convert(memberName.Location)), MemberType.Roles.Identifier);
					return t;
				} else {
					SimpleType t = new SimpleType();
					t.AddChild (new Identifier (memberName.Name, Convert(memberName.Location)), SimpleType.Roles.Identifier);
					// TODO type arguments
					return t;
				}
			}
开发者ID:madkat,项目名称:NRefactory,代码行数:16,代码来源:CSharpParser.cs


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