本文整理汇总了C#中UnaryOperatorKind.OperatorIndex方法的典型用法代码示例。如果您正苦于以下问题:C# UnaryOperatorKind.OperatorIndex方法的具体用法?C# UnaryOperatorKind.OperatorIndex怎么用?C# UnaryOperatorKind.OperatorIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnaryOperatorKind
的用法示例。
在下文中一共展示了UnaryOperatorKind.OperatorIndex方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OpKind
public static UnaryOperatorKind OpKind(UnaryOperatorKind kind, TypeSymbol operand)
{
int? index = TypeToIndex(operand);
if (index == null)
{
return UnaryOperatorKind.Error;
}
var result = opkind[kind.OperatorIndex()][index.Value];
return result == UnaryOperatorKind.Error ? result : result | kind;
}
示例2: GetSimpleBuiltInOperators
//.........这里部分代码省略.........
GetSignature(UnaryOperatorKind.CharPrefixIncrement),
GetSignature(UnaryOperatorKind.FloatPrefixIncrement),
GetSignature(UnaryOperatorKind.DoublePrefixIncrement),
GetSignature(UnaryOperatorKind.DecimalPrefixIncrement),
GetSignature(UnaryOperatorKind.LiftedSBytePrefixIncrement),
GetSignature(UnaryOperatorKind.LiftedBytePrefixIncrement),
GetSignature(UnaryOperatorKind.LiftedShortPrefixIncrement),
GetSignature(UnaryOperatorKind.LiftedUShortPrefixIncrement),
GetSignature(UnaryOperatorKind.LiftedIntPrefixIncrement),
GetSignature(UnaryOperatorKind.LiftedUIntPrefixIncrement),
GetSignature(UnaryOperatorKind.LiftedLongPrefixIncrement),
GetSignature(UnaryOperatorKind.LiftedULongPrefixIncrement),
GetSignature(UnaryOperatorKind.LiftedCharPrefixIncrement),
GetSignature(UnaryOperatorKind.LiftedFloatPrefixIncrement),
GetSignature(UnaryOperatorKind.LiftedDoublePrefixIncrement),
GetSignature(UnaryOperatorKind.LiftedDecimalPrefixIncrement),
}).AsImmutableOrNull(),
(new []
{
GetSignature(UnaryOperatorKind.SBytePrefixDecrement),
GetSignature(UnaryOperatorKind.BytePrefixDecrement),
GetSignature(UnaryOperatorKind.ShortPrefixDecrement),
GetSignature(UnaryOperatorKind.UShortPrefixDecrement),
GetSignature(UnaryOperatorKind.IntPrefixDecrement),
GetSignature(UnaryOperatorKind.UIntPrefixDecrement),
GetSignature(UnaryOperatorKind.LongPrefixDecrement),
GetSignature(UnaryOperatorKind.ULongPrefixDecrement),
GetSignature(UnaryOperatorKind.CharPrefixDecrement),
GetSignature(UnaryOperatorKind.FloatPrefixDecrement),
GetSignature(UnaryOperatorKind.DoublePrefixDecrement),
GetSignature(UnaryOperatorKind.DecimalPrefixDecrement),
GetSignature(UnaryOperatorKind.LiftedSBytePrefixDecrement),
GetSignature(UnaryOperatorKind.LiftedBytePrefixDecrement),
GetSignature(UnaryOperatorKind.LiftedShortPrefixDecrement),
GetSignature(UnaryOperatorKind.LiftedUShortPrefixDecrement),
GetSignature(UnaryOperatorKind.LiftedIntPrefixDecrement),
GetSignature(UnaryOperatorKind.LiftedUIntPrefixDecrement),
GetSignature(UnaryOperatorKind.LiftedLongPrefixDecrement),
GetSignature(UnaryOperatorKind.LiftedULongPrefixDecrement),
GetSignature(UnaryOperatorKind.LiftedCharPrefixDecrement),
GetSignature(UnaryOperatorKind.LiftedFloatPrefixDecrement),
GetSignature(UnaryOperatorKind.LiftedDoublePrefixDecrement),
GetSignature(UnaryOperatorKind.LiftedDecimalPrefixDecrement),
}).AsImmutableOrNull(),
(new []
{
GetSignature(UnaryOperatorKind.IntUnaryPlus),
GetSignature(UnaryOperatorKind.UIntUnaryPlus),
GetSignature(UnaryOperatorKind.LongUnaryPlus),
GetSignature(UnaryOperatorKind.ULongUnaryPlus),
GetSignature(UnaryOperatorKind.FloatUnaryPlus),
GetSignature(UnaryOperatorKind.DoubleUnaryPlus),
GetSignature(UnaryOperatorKind.DecimalUnaryPlus),
GetSignature(UnaryOperatorKind.LiftedIntUnaryPlus),
GetSignature(UnaryOperatorKind.LiftedUIntUnaryPlus),
GetSignature(UnaryOperatorKind.LiftedLongUnaryPlus),
GetSignature(UnaryOperatorKind.LiftedULongUnaryPlus),
GetSignature(UnaryOperatorKind.LiftedFloatUnaryPlus),
GetSignature(UnaryOperatorKind.LiftedDoubleUnaryPlus),
GetSignature(UnaryOperatorKind.LiftedDecimalUnaryPlus),
}).AsImmutableOrNull(),
(new []
{
GetSignature(UnaryOperatorKind.IntUnaryMinus),
GetSignature(UnaryOperatorKind.LongUnaryMinus),
GetSignature(UnaryOperatorKind.FloatUnaryMinus),
GetSignature(UnaryOperatorKind.DoubleUnaryMinus),
GetSignature(UnaryOperatorKind.DecimalUnaryMinus),
GetSignature(UnaryOperatorKind.LiftedIntUnaryMinus),
GetSignature(UnaryOperatorKind.LiftedLongUnaryMinus),
GetSignature(UnaryOperatorKind.LiftedFloatUnaryMinus),
GetSignature(UnaryOperatorKind.LiftedDoubleUnaryMinus),
GetSignature(UnaryOperatorKind.LiftedDecimalUnaryMinus),
}).AsImmutableOrNull(),
(new []
{
GetSignature(UnaryOperatorKind.BoolLogicalNegation),
GetSignature(UnaryOperatorKind.LiftedBoolLogicalNegation),
}).AsImmutableOrNull(),
(new []
{
GetSignature(UnaryOperatorKind.IntBitwiseComplement),
GetSignature(UnaryOperatorKind.UIntBitwiseComplement),
GetSignature(UnaryOperatorKind.LongBitwiseComplement),
GetSignature(UnaryOperatorKind.ULongBitwiseComplement),
GetSignature(UnaryOperatorKind.LiftedIntBitwiseComplement),
GetSignature(UnaryOperatorKind.LiftedUIntBitwiseComplement),
GetSignature(UnaryOperatorKind.LiftedLongBitwiseComplement),
GetSignature(UnaryOperatorKind.LiftedULongBitwiseComplement),
}).AsImmutableOrNull(),
// No built-in operator true or operator false
(new UnaryOperatorSignature [0]).AsImmutableOrNull(),
(new UnaryOperatorSignature [0]).AsImmutableOrNull(),
};
Interlocked.CompareExchange(ref builtInUnaryOperators, allOperators, null);
}
operators.AddRange(builtInUnaryOperators[kind.OperatorIndex()]);
}
示例3: OpKind
public static UnaryOperatorKind OpKind(UnaryOperatorKind kind, TypeSymbol operand)
{
int? index = TypeToIndex(operand);
if (index == null)
{
return UnaryOperatorKind.Error;
}
int kindIndex = kind.OperatorIndex();
var result = (kindIndex >= s_opkind.Length) ? UnaryOperatorKind.Error : s_opkind[kindIndex][index.Value];
return result == UnaryOperatorKind.Error ? result : result | kind;
}