本文整理汇总了C#中TypeSymbol.IsIntegralType方法的典型用法代码示例。如果您正苦于以下问题:C# TypeSymbol.IsIntegralType方法的具体用法?C# TypeSymbol.IsIntegralType怎么用?C# TypeSymbol.IsIntegralType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TypeSymbol
的用法示例。
在下文中一共展示了TypeSymbol.IsIntegralType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestBinaryIntrinsicSymbol
//.........这里部分代码省略.........
signature = new BinaryOperatorSignature(op | BinaryOperatorKind.Delegate,
leftType, // TODO: this feels like a spec violation
leftType, // TODO: this feels like a spec violation
compilation.GetSpecialType(SpecialType.System_Boolean));
}
else if (leftType.SpecialType == SpecialType.System_Delegate && rightType.SpecialType == SpecialType.System_Delegate)
{
signature = new BinaryOperatorSignature(op | BinaryOperatorKind.Delegate,
compilation.GetSpecialType(SpecialType.System_Delegate), compilation.GetSpecialType(SpecialType.System_Delegate),
compilation.GetSpecialType(SpecialType.System_Boolean));
}
else
{
signature = new BinaryOperatorSignature(op | BinaryOperatorKind.Object, compilation.ObjectType, compilation.ObjectType,
compilation.GetSpecialType(SpecialType.System_Boolean));
}
}
else if (op == BinaryOperatorKind.Addition &&
((leftType.IsStringType() && !rightType.IsPointerType()) || (!leftType.IsPointerType() && rightType.IsStringType())))
{
Assert.False(leftType.IsStringType() && rightType.IsStringType());
if (leftType.IsStringType())
{
signature = new BinaryOperatorSignature(op | BinaryOperatorKind.String, leftType, compilation.ObjectType, leftType);
}
else
{
Assert.True(rightType.IsStringType());
signature = new BinaryOperatorSignature(op | BinaryOperatorKind.String, compilation.ObjectType, rightType, rightType);
}
}
else if (op == BinaryOperatorKind.Addition &&
(((leftType.IsIntegralType() || leftType.IsCharType()) && rightType.IsPointerType()) ||
(leftType.IsPointerType() && (rightType.IsIntegralType() || rightType.IsCharType()))))
{
if (leftType.IsPointerType())
{
signature = new BinaryOperatorSignature(op | BinaryOperatorKind.Pointer, leftType, symbol1.Parameters[1].Type, leftType);
Assert.True(symbol1.Parameters[1].Type.IsIntegralType());
}
else
{
signature = new BinaryOperatorSignature(op | BinaryOperatorKind.Pointer, symbol1.Parameters[0].Type, rightType, rightType);
Assert.True(symbol1.Parameters[0].Type.IsIntegralType());
}
}
else if (op == BinaryOperatorKind.Subtraction &&
(leftType.IsPointerType() && (rightType.IsIntegralType() || rightType.IsCharType())))
{
signature = new BinaryOperatorSignature(op | BinaryOperatorKind.String, leftType, symbol1.Parameters[1].Type, leftType);
Assert.True(symbol1.Parameters[1].Type.IsIntegralType());
}
else if (op == BinaryOperatorKind.Subtraction && leftType.IsPointerType() && leftType == rightType)
{
signature = new BinaryOperatorSignature(op | BinaryOperatorKind.Pointer, leftType, rightType, compilation.GetSpecialType(SpecialType.System_Int64));
}
else if ((op == BinaryOperatorKind.Addition || op == BinaryOperatorKind.Subtraction) &&
leftType.IsEnumType() && (rightType.IsIntegralType() || rightType.IsCharType()) &&
(result = OverloadResolution.BinopEasyOut.OpKind(op, leftType.EnumUnderlyingType(), rightType)) != BinaryOperatorKind.Error &&
(signature = compilation.builtInOperators.GetSignature(result)).RightType == leftType.EnumUnderlyingType())
{
signature = new BinaryOperatorSignature(signature.Kind | BinaryOperatorKind.EnumAndUnderlying, leftType, signature.RightType, leftType);
}
else if ((op == BinaryOperatorKind.Addition || op == BinaryOperatorKind.Subtraction) &&
rightType.IsEnumType() && (leftType.IsIntegralType() || leftType.IsCharType()) &&