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


C# TypeNode.GetPointerType方法代码示例

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


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

示例1: InferTypeOfUnaryExpression

 public virtual TypeNode InferTypeOfUnaryExpression(TypeNode origType, UnaryExpression unaryExpression){
   if (unaryExpression == null) return origType;
   TypeNode t = this.typeSystem.Unwrap(origType);
   if (this.typeSystem.IsNullableType(t)) return this.typeSystem.CreateNullableWrapper(this.currentType, InferTypeOfUnaryExpression(this.typeSystem.RemoveNullableWrapper(t), unaryExpression));
   switch (unaryExpression.NodeType){
     case NodeType.AddressOf: return origType.GetPointerType();
     case NodeType.OutAddress: 
     case NodeType.RefAddress: return origType.GetReferenceType();
     case NodeType.Ldftn: return SystemTypes.IntPtr;
     case NodeType.LogicalNot: return SystemTypes.Boolean;
     case NodeType.UnaryPlus:
     case NodeType.Neg:
     case NodeType.Not:
       switch(t.TypeCode){
         case TypeCode.SByte:
         case TypeCode.Byte:
         case TypeCode.Int16:
         case TypeCode.UInt16:
         case TypeCode.Char:
           return SystemTypes.Int32;
         case TypeCode.UInt32:
           if (unaryExpression.NodeType == NodeType.Neg)
             return SystemTypes.Int64;
           break;
       }
       break;
     case NodeType.Parentheses:
     case NodeType.SkipCheck:
     case NodeType.Ckfinite:
       if (unaryExpression.Operand == null){
         unaryExpression.IsErroneous = true;
         return t;
       }
       return unaryExpression.Operand.Type;
     case NodeType.DefaultValue:
       Literal lit = unaryExpression.Operand as Literal;
       if (lit == null){
         unaryExpression.IsErroneous = true;
         return SystemTypes.Object;
       }
       TypeNode lt = lit.Value as TypeNode;
       if (lt == null){
         unaryExpression.IsErroneous = true;
         return SystemTypes.Object;
       }
       return lt;
     case NodeType.Sizeof:
       return SystemTypes.Int32;
     case NodeType.Typeof:
       return !this.NonNullChecking ? SystemTypes.Type : (TypeNode)OptionalModifier.For(SystemTypes.NonNullType, SystemTypes.Type);
   }
   return t;
 }
开发者ID:dbremner,项目名称:specsharp,代码行数:53,代码来源:Resolver.cs

示例2: PType


//.........这里部分代码省略.........
			Get();
			c = SystemTypes.Int32; 
			break;
		}
		case 14: {
			Get();
			c = SystemTypes.Int64; 
			break;
		}
		case 15: {
			Get();
			c = SystemTypes.UInt8; 
			break;
		}
		case 16: {
			Get();
			c = SystemTypes.UInt16; 
			break;
		}
		case 17: {
			Get();
			c = SystemTypes.UInt32; 
			break;
		}
		case 18: {
			Get();
			c = SystemTypes.UInt64; 
			break;
		}
		case 19: {
			Get();
			c = SystemTypes.Single; 
			break;
		}
		case 20: {
			Get();
			c = SystemTypes.Double; 
			break;
		}
		case 21: {
			Get();
			Expect(22);
			PType(out modifier);
			Expect(23);
			PType(out modified);
			Expect(24);
			c = OptionalModifier.For(modifier,modified); 
			break;
		}
		case 25: {
			Get();
			Expect(22);
			string id; 
			Ident(out id);
			Expect(24);
			c = LookupTypeParameter(id); 
			break;
		}
		case 26: {
			Get();
			Expect(22);
			string id; 
			Ident(out id);
			Expect(24);
			c = LookupMethodTypeParameter(id); 
			break;
		}
		case 1: case 28: case 35: {
			PTypeRef(out c);
			break;
		}
		default: SynErr(109); break;
		}
		if (StartOf(1)) {
			if (la.kind == 27) {
				Get();
				c = c.GetReferenceType(); 
			} else if (la.kind == 28) {
				Get();
				Expect(29);
				c = c.GetArrayType(1); 
				while (la.kind == 28) {
					Get();
					Expect(29);
					c = c.GetArrayType(1); 
				}
			} else if (la.kind == 22) {
				Get();
				PType(out c);
				while (la.kind == 23) {
					Get();
					PType(out c);
				}
				Expect(24);
			} else {
				Get();
				c = c.GetPointerType(); 
			}
		}
	}
开发者ID:dbremner,项目名称:specsharp,代码行数:101,代码来源:DeserializerParser.cs


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