• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ComposedType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: VisitComposedType

 public override void VisitComposedType(ComposedType composedType)
 {
     // Note: we specifically do not handle this case because the 'base' implementation will eventually
     // call VisitMemberType() or VisitSimpleType() on the ComposedType.BaseType which is all we really
     // care to resolve.
     base.VisitComposedType (composedType);
 }
开发者ID:0xb1dd1e,项目名称:debugger-libs,代码行数:7,代码来源:NRefactoryExpressionResolverVisitor.cs


示例2: VisitComposedType

		public override void VisitComposedType(ComposedType composedType)
		{
			var spec = composedType.ArraySpecifiers.FirstOrDefault();
			if (spec != null)
				ForceSpacesBefore(spec.LBracketToken, policy.SpaceBeforeArrayDeclarationBrackets);

			if (composedType.HasNullableSpecifier)
				ForceSpacesBefore(composedType.NullableSpecifierToken, false);

			if (composedType.PointerRank > 0)
				foreach (var token in composedType.PointerTokens)
					ForceSpacesBefore(token, false);

			base.VisitComposedType(composedType);
		}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:15,代码来源:FormattingVisitor_Expressions.cs


示例3: Visit

			public override object Visit(ComposedCast composedCast)
			{
				var result = new ComposedType();
				result.AddChild(ConvertToType(composedCast.Left), Roles.Type);
				
				var spec = composedCast.Spec;
				while (spec != null) {
					if (spec.IsNullable) {
						result.AddChild(new CSharpTokenNode(Convert(spec.Location), ComposedType.NullableRole), ComposedType.NullableRole);
					} else if (spec.IsPointer) {
						result.AddChild(new CSharpTokenNode(Convert(spec.Location), ComposedType.PointerRole), ComposedType.PointerRole);
					} else {
						var aSpec = new ArraySpecifier();
						aSpec.AddChild(new CSharpTokenNode(Convert(spec.Location), Roles.LBracket), Roles.LBracket);
						var location = LocationsBag.GetLocations(spec);
						if (location != null)
							aSpec.AddChild(new CSharpTokenNode(Convert(spec.Location), Roles.RBracket), Roles.RBracket);
						result.AddChild(aSpec, ComposedType.ArraySpecifierRole);
					}
					spec = spec.Next;
				}
				
				return result;
			}
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:24,代码来源:CSharpParser.cs


示例4: ConvertToType

			AstType ConvertToType(Mono.CSharp.Expression typeName)
			{
				if (typeName == null) // may happen in typeof(Generic<,,,,>)
					return new SimpleType();
				
				var typeExpr = typeName as TypeExpression;
				if (typeExpr != null) {
					return new PrimitiveType(typeExpr.GetSignatureForError(), Convert(typeExpr.Location));
				}
				
				var qam = typeName as QualifiedAliasMember;
				if (qam != null) {
					var loc = LocationsBag.GetLocations(typeName);
					var memberType = new MemberType();
					memberType.Target = new SimpleType(qam.alias, Convert(qam.Location));
					memberType.IsDoubleColon = true;

					if (loc != null && loc.Count > 0)
						memberType.AddChild(new CSharpTokenNode(Convert(loc [0]), Roles.DoubleColon), Roles.DoubleColon);

					memberType.MemberNameToken = Identifier.Create(qam.Name, loc != null ? Convert(loc [1]) : TextLocation.Empty);
					AddTypeArguments(qam, memberType);
					return memberType;
				}
				
				var ma = typeName as MemberAccess;
				if (ma != null) {
					var memberType = new MemberType();
					memberType.AddChild(ConvertToType(ma.LeftExpression), MemberType.TargetRole);
					var loc = LocationsBag.GetLocations(ma);
					if (loc != null)
						memberType.AddChild(new CSharpTokenNode(Convert(loc [0]), Roles.Dot), Roles.Dot);

					memberType.MemberNameToken = Identifier.Create(ma.Name, Convert(ma.Location));
					
					AddTypeArguments(ma, memberType);
					return memberType;
				}
				
				var sn = typeName as SimpleName;
				if (sn != null) {
					var result = new SimpleType(sn.Name, Convert(sn.Location));
					AddTypeArguments(sn, result);
					return result;
				}
				
				var cc = typeName as ComposedCast;
				if (cc != null) {
					var baseType = ConvertToType(cc.Left);
					var result = new ComposedType { BaseType = baseType };
					var ccSpec = cc.Spec;
					while (ccSpec != null) {
						if (ccSpec.IsNullable) {
							result.AddChild(new CSharpTokenNode(Convert(ccSpec.Location), ComposedType.NullableRole), ComposedType.NullableRole);
						} else if (ccSpec.IsPointer) {
							result.AddChild(new CSharpTokenNode(Convert(ccSpec.Location), ComposedType.PointerRole), ComposedType.PointerRole);
						} else {
							var location = LocationsBag.GetLocations(ccSpec);
							var spec = new ArraySpecifier { Dimensions = ccSpec.Dimension };
							spec.AddChild(new CSharpTokenNode(Convert(ccSpec.Location), Roles.LBracket), Roles.LBracket);
							if (location != null)
								spec.AddChild(new CSharpTokenNode(Convert(location [0]), Roles.RBracket), Roles.RBracket);
							
							result.ArraySpecifiers.Add(spec);
						}
						ccSpec = ccSpec.Next;
					}
					return result;
				}
				
				var sce = typeName as SpecialContraintExpr;
				if (sce != null) {
					switch (sce.Constraint) {
						case SpecialConstraint.Class:
							return new PrimitiveType("class", Convert(sce.Location));
						case SpecialConstraint.Struct:
							return new PrimitiveType("struct", Convert(sce.Location));
						case SpecialConstraint.Constructor:
							return new PrimitiveType("new", Convert(sce.Location));
					}
				}
				return new SimpleType("unknown");
			}
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:83,代码来源:CSharpParser.cs


示例5: ConvertToType

			AstType ConvertToType (Mono.CSharp.Expression typeName)
			{
				if (typeName == null) // may happen in typeof(Generic<,,,,>)
					return new SimpleType ();
				
				if (typeName is TypeExpression) {
					var typeExpr = (Mono.CSharp.TypeExpression)typeName;
					return new PrimitiveType (typeExpr.GetSignatureForError (), Convert (typeExpr.Location));
				}
				
				if (typeName is Mono.CSharp.QualifiedAliasMember) {
					var qam = (Mono.CSharp.QualifiedAliasMember)typeName;
					var memberType = new MemberType (); 
					memberType.Target = new SimpleType (qam.alias, Convert (qam.Location));
					memberType.IsDoubleColon = true;
					memberType.MemberName = qam.Name;
					return memberType;
				}
				
				if (typeName is MemberAccess) {
					MemberAccess ma = (MemberAccess)typeName;
					
					var memberType = new MemberType ();
					memberType.AddChild (ConvertToType (ma.LeftExpression), MemberType.TargetRole);
					memberType.AddChild (new CSharpTokenNode (Convert (ma.DotLocation), 1), MemberType.Roles.Dot);
					
					memberType.MemberNameToken = Identifier.Create (ma.Name, Convert (ma.Location));
					
					AddTypeArguments (ma, memberType);
					return memberType;
				}
				
				if (typeName is SimpleName) {
					var sn = (SimpleName)typeName;
					var result = new SimpleType (sn.Name, Convert (sn.Location));
					AddTypeArguments (sn, result);
					return result;
				}
				
				if (typeName is ComposedCast) {
					var cc = (ComposedCast)typeName;
					var baseType = ConvertToType (cc.Left);
					var result = new ComposedType () { BaseType = baseType };
					var ccSpec = cc.Spec;
					while (ccSpec != null) {
						if (ccSpec.IsNullable) {
							result.AddChild (new CSharpTokenNode (Convert (ccSpec.Location), 1), ComposedType.NullableRole);
						} else if (ccSpec.IsPointer) {
							result.AddChild (new CSharpTokenNode (Convert (ccSpec.Location), 1), ComposedType.PointerRole);
						} else {
							var location = LocationsBag.GetLocations (ccSpec);
							var spec = new ArraySpecifier () { Dimensions = ccSpec.Dimension };
							spec.AddChild (new CSharpTokenNode (Convert (ccSpec.Location), 1), FieldDeclaration.Roles.LBracket);
							if (location != null)
								spec.AddChild (new CSharpTokenNode (Convert (location [0]), 1), FieldDeclaration.Roles.RBracket);
							
							result.ArraySpecifiers.Add (spec);
						}
						ccSpec = ccSpec.Next;
					}
					return result;
				}
				
				if (typeName is SpecialContraintExpr) {
					var sce = (SpecialContraintExpr)typeName;
					switch (sce.Constraint) {
					case SpecialConstraint.Class:
						return new PrimitiveType ("class", Convert (sce.Location));
					case SpecialConstraint.Struct:
						return new PrimitiveType ("struct", Convert (sce.Location));
					case SpecialConstraint.Constructor:
						return new PrimitiveType ("new", Convert (sce.Location));
					}
				}
				System.Console.WriteLine ("Error while converting :" + typeName + " - unknown type name");
				System.Console.WriteLine (Environment.StackTrace);
				return new SimpleType ("unknown");
			}
开发者ID:N3X15,项目名称:ILSpy,代码行数:78,代码来源:CSharpParser.cs


示例6: VisitComposedType

 public virtual void VisitComposedType(ComposedType composedType)
 {
     if (this.ThrowException)
     {
         throw (Exception)this.CreateException(composedType);
     }
 }
开发者ID:fabriciomurta,项目名称:BridgeUnified,代码行数:7,代码来源:Visitor.Exception.cs


示例7: VisitComposedType

		public override void VisitComposedType(ComposedType composedType)
		{
			var spec = composedType.ArraySpecifiers.FirstOrDefault();
			if (spec != null) {
				ForceSpacesBefore(spec.LBracketToken, policy.SpaceBeforeArrayDeclarationBrackets);
			}

			base.VisitComposedType(composedType);
		}
开发者ID:txdv,项目名称:monodevelop,代码行数:9,代码来源:AstFormattingVisitor.cs


示例8: VisitComposedType

				public override void VisitComposedType (ComposedType composedType)
				{
					base.VisitComposedType (composedType);

					if (!composedType.HasNullableSpecifier)
						return;

					var st = new SimpleType ("Nullable", composedType.BaseType.Clone ());

					composedType.ReplaceWith (st);
				}
开发者ID:RReverser,项目名称:Netjs,代码行数:11,代码来源:CsToTs.cs


示例9: VisitComposedType

 public abstract StringBuilder VisitComposedType(ComposedType composedType, int data);
开发者ID:hach-que,项目名称:SLSharp,代码行数:1,代码来源:VisitorBase.Abstract.cs


示例10: VisitComposedType

 public override void VisitComposedType(ComposedType composedType)
 {
     new TypeBlock(this, composedType).Emit();
 }
开发者ID:yindongfei,项目名称:bridge.lua,代码行数:4,代码来源:Emitter.Visitor.cs


示例11: VisitComposedType

 public override StringBuilder VisitComposedType(ComposedType composedType, int data)
 {
     throw new NotImplementedException();
 }
开发者ID:mono-soc-2011,项目名称:SLSharp,代码行数:4,代码来源:GlslVisitor.Unimplemented.cs


示例12: VisitComposedType

		public virtual void VisitComposedType(ComposedType composedType)
		{
			StartNode(composedType);
			composedType.BaseType.AcceptVisitor(this);
			if (composedType.HasNullableSpecifier) {
				WriteToken(ComposedType.NullableRole, BoxedTextColor.Operator);
			}
			int count = 0;
			for (int i = 0; i < composedType.PointerRank; i++) {
				if (count-- <= 0) {
					cancellationToken.ThrowIfCancellationRequested();
					count = CANCEL_CHECK_LOOP_COUNT;
				}
				WriteToken(ComposedType.PointerRole, BoxedTextColor.Operator);
			}
			count = 0;
			foreach (var node in composedType.ArraySpecifiers) {
				if (count-- <= 0) {
					cancellationToken.ThrowIfCancellationRequested();
					count = CANCEL_CHECK_LOOP_COUNT;
				}
				node.AcceptVisitor(this);
			}
			EndNode(composedType);
		}
开发者ID:0xd4d,项目名称:NRefactory,代码行数:25,代码来源:CSharpOutputVisitor.cs


示例13: VisitComposedType

 public void VisitComposedType(ComposedType composedType)
 {
     JsonObject jsonComposedType = new JsonObject();
     jsonComposedType.Comment = "VisitComposedType";
     composedType.BaseType.AcceptVisitor(this);
     jsonComposedType.AddJsonValue("basetype", Pop());
     if (composedType.HasNullableSpecifier)
     {
         jsonComposedType.AddJsonValue("nullable-specifier", ComposedType.NullableRole.Token);
     }
     jsonComposedType.AddJsonValue("pointerrank", composedType.PointerRank);
     JsonArray arraySpecifier = new JsonArray();
     foreach (var node in composedType.ArraySpecifiers)
     {
         node.AcceptVisitor(this);
         arraySpecifier.AddJsonValue(Pop());
     }
     Push(jsonComposedType);
 }
开发者ID:CompilerKit,项目名称:CodeWalk,代码行数:19,代码来源:AstCsToJson.cs


示例14: VisitMethodDeclaration

			public override void VisitMethodDeclaration (MethodDeclaration methodDeclaration)
			{
				base.VisitMethodDeclaration (methodDeclaration);

				var hasRefs = methodDeclaration.Parameters.Any (IsRefParam);

				if (!hasRefs)
					return;

				var sub = new Substitute ();

				foreach (var p in methodDeclaration.Parameters.Where (IsRefParam).ToList ()) {

					var pty =  ((ComposedType)p.Type).BaseType;


					var access = new IndexerExpression (new IdentifierExpression (p.Name), new PrimitiveExpression (0));
					var ptd = GetTypeDef (pty);
					if (ptd != null)
						access.AddAnnotation (ptd);
					sub.Subs [p.Name] = access;
					p.ParameterModifier = ParameterModifier.None;
					var c = new ComposedType {
						BaseType = p.Type.Clone (),
					};
					c.ArraySpecifiers.Add (new ArraySpecifier (1));
					p.Type = c;
				}

				methodDeclaration.Body.AcceptVisitor (sub);
			}
开发者ID:RReverser,项目名称:Netjs,代码行数:31,代码来源:CsToTs.cs


示例15: VisitComposedType

		public virtual void VisitComposedType (ComposedType composedType)
		{
			VisitChildren (composedType);
		}
开发者ID:modulexcite,项目名称:ICSharpCode.Decompiler-retired,代码行数:4,代码来源:DepthFirstAstVisitor.cs


示例16: ConvertToType

			AstType ConvertToType (Mono.CSharp.Expression typeName)
			{
				if (typeName is TypeExpression) {
					var typeExpr = (Mono.CSharp.TypeExpression)typeName;
					return new PrimitiveType (typeExpr.GetSignatureForError (), Convert (typeExpr.Location));
				}
				
				if (typeName is Mono.CSharp.QualifiedAliasMember) {
					var qam = (Mono.CSharp.QualifiedAliasMember)typeName;
					return new SimpleType (qam.Name, Convert (qam.Location));
				}
				
				if (typeName is MemberAccess) {
					MemberAccess ma = (MemberAccess)typeName;
					
					var memberType = new MemberType ();
					memberType.AddChild (ConvertToType (ma.LeftExpression), MemberType.TargetRole);
					memberType.MemberName = ma.Name;
					
					AddTypeArguments (ma, memberType);
					return memberType;
				}
				
				if (typeName is SimpleName) {
					var sn = (SimpleName)typeName;
					var result = new SimpleType (sn.Name, Convert (sn.Location));
					AddTypeArguments (sn, result);
					return result;
				}
				
				if (typeName is ComposedCast) {
					var cc = (ComposedCast)typeName;
					var baseType = ConvertToType (cc.Left);
					var result = new ComposedType () { BaseType = baseType };
					
					if (cc.Spec.IsNullable) {
						result.HasNullableSpecifier = true;
					} else if (cc.Spec.IsPointer) {
						result.PointerRank++;
					} else {
						var location = LocationsBag.GetLocations (cc.Spec);
						var spec = new ArraySpecifier () { Dimensions = cc.Spec.Dimension - 1 };
						spec.AddChild (new CSharpTokenNode (Convert (cc.Spec.Location), 1), FieldDeclaration.Roles.LBracket);
						if (location != null)
							spec.AddChild (new CSharpTokenNode (Convert (location[0]), 1), FieldDeclaration.Roles.RBracket);
						
						result.ArraySpecifiers.Add(spec);
					}
					return result;
				}
				
				System.Console.WriteLine ("Error while converting :" + typeName + " - unknown type name");
				return new SimpleType ("unknown");
			}
开发者ID:madkat,项目名称:NRefactory,代码行数:54,代码来源:CSharpParser.cs


示例17: VisitComposedType

		public void VisitComposedType(ComposedType composedType)
		{
			StartNode(composedType);
			composedType.BaseType.AcceptVisitor(this);
			if (composedType.HasNullableSpecifier) {
				WriteToken(ComposedType.NullableRole);
			}
			for (int i = 0; i < composedType.PointerRank; i++) {
				WriteToken(ComposedType.PointerRole);
			}
			foreach (var node in composedType.ArraySpecifiers) {
				node.AcceptVisitor(this);
			}
			EndNode(composedType);
		}
开发者ID:x-strong,项目名称:ILSpy,代码行数:15,代码来源:CSharpOutputVisitor.cs


示例18: VisitComposedType

 public void VisitComposedType(ComposedType node)
 {
     VisitChildren(node);
 }
开发者ID:evanw,项目名称:minisharp,代码行数:4,代码来源:Lower.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Composite类代码示例发布时间:2022-05-24
下一篇:
C# ComposablePartCatalog类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap