public static BinaryOperatorKind OpKind(BinaryOperatorKind kind, TypeSymbol left, TypeSymbol right) { int? leftIndex = TypeToIndex(left); if (leftIndex == null) { return BinaryOperatorKind.Error; } int? rightIndex = TypeToIndex(right); if (rightIndex == null) { return BinaryOperatorKind.Error; } var result = BinaryOperatorKind.Error; // kind.OperatorIndex() collapses '&' and '&&' (and '|' and '||'). To correct // this problem, we handle kinds satisfying IsLogical() separately. Fortunately, // such operators only work on boolean types, so there's no need to write out // a whole new table. // // Example: int & int is legal, but int && int is not, so we can't use the same // table for both operators. if (!kind.IsLogical() || (leftIndex == (int)BinaryOperatorKind.Bool && rightIndex == (int)BinaryOperatorKind.Bool)) { result = opkind[kind.OperatorIndex()][leftIndex.Value, rightIndex.Value]; } return result == BinaryOperatorKind.Error ? result : result | kind; }
internal void GetSimpleBuiltInOperators(BinaryOperatorKind kind, ArrayBuilder<BinaryOperatorSignature> operators) { if (builtInOperators == null) { var logicalOperators = new ImmutableArray<BinaryOperatorSignature>[] { ImmutableArray<BinaryOperatorSignature>.Empty, //multiplication ImmutableArray<BinaryOperatorSignature>.Empty, //addition ImmutableArray<BinaryOperatorSignature>.Empty, //subtraction ImmutableArray<BinaryOperatorSignature>.Empty, //division ImmutableArray<BinaryOperatorSignature>.Empty, //remainder ImmutableArray<BinaryOperatorSignature>.Empty, //left shift ImmutableArray<BinaryOperatorSignature>.Empty, //right shift ImmutableArray<BinaryOperatorSignature>.Empty, //equal ImmutableArray<BinaryOperatorSignature>.Empty, //not equal ImmutableArray<BinaryOperatorSignature>.Empty, //greater than ImmutableArray<BinaryOperatorSignature>.Empty, //less than ImmutableArray<BinaryOperatorSignature>.Empty, //greater than or equal ImmutableArray<BinaryOperatorSignature>.Empty, //less than or equal ImmutableArray.Create<BinaryOperatorSignature>(GetSignature(BinaryOperatorKind.LogicalBoolAnd)), //and ImmutableArray<BinaryOperatorSignature>.Empty, //xor ImmutableArray.Create<BinaryOperatorSignature>(GetSignature(BinaryOperatorKind.LogicalBoolOr)), //or }; var nonLogicalOperators = new ImmutableArray<BinaryOperatorSignature>[] { (new [] { GetSignature(BinaryOperatorKind.IntMultiplication), GetSignature(BinaryOperatorKind.UIntMultiplication), GetSignature(BinaryOperatorKind.LongMultiplication), GetSignature(BinaryOperatorKind.ULongMultiplication), GetSignature(BinaryOperatorKind.FloatMultiplication), GetSignature(BinaryOperatorKind.DoubleMultiplication), GetSignature(BinaryOperatorKind.DecimalMultiplication), GetSignature(BinaryOperatorKind.LiftedIntMultiplication), GetSignature(BinaryOperatorKind.LiftedUIntMultiplication), GetSignature(BinaryOperatorKind.LiftedLongMultiplication), GetSignature(BinaryOperatorKind.LiftedULongMultiplication), GetSignature(BinaryOperatorKind.LiftedFloatMultiplication), GetSignature(BinaryOperatorKind.LiftedDoubleMultiplication), GetSignature(BinaryOperatorKind.LiftedDecimalMultiplication), }).AsImmutableOrNull(), (new [] { GetSignature(BinaryOperatorKind.IntAddition), GetSignature(BinaryOperatorKind.UIntAddition), GetSignature(BinaryOperatorKind.LongAddition), GetSignature(BinaryOperatorKind.ULongAddition), GetSignature(BinaryOperatorKind.FloatAddition), GetSignature(BinaryOperatorKind.DoubleAddition), GetSignature(BinaryOperatorKind.DecimalAddition), GetSignature(BinaryOperatorKind.LiftedIntAddition), GetSignature(BinaryOperatorKind.LiftedUIntAddition), GetSignature(BinaryOperatorKind.LiftedLongAddition), GetSignature(BinaryOperatorKind.LiftedULongAddition), GetSignature(BinaryOperatorKind.LiftedFloatAddition), GetSignature(BinaryOperatorKind.LiftedDoubleAddition), GetSignature(BinaryOperatorKind.LiftedDecimalAddition), GetSignature(BinaryOperatorKind.StringConcatenation), GetSignature(BinaryOperatorKind.StringAndObjectConcatenation), GetSignature(BinaryOperatorKind.ObjectAndStringConcatenation), }).AsImmutableOrNull(), (new [] { GetSignature(BinaryOperatorKind.IntSubtraction), GetSignature(BinaryOperatorKind.UIntSubtraction), GetSignature(BinaryOperatorKind.LongSubtraction), GetSignature(BinaryOperatorKind.ULongSubtraction), GetSignature(BinaryOperatorKind.FloatSubtraction), GetSignature(BinaryOperatorKind.DoubleSubtraction), GetSignature(BinaryOperatorKind.DecimalSubtraction), GetSignature(BinaryOperatorKind.LiftedIntSubtraction), GetSignature(BinaryOperatorKind.LiftedUIntSubtraction), GetSignature(BinaryOperatorKind.LiftedLongSubtraction), GetSignature(BinaryOperatorKind.LiftedULongSubtraction), GetSignature(BinaryOperatorKind.LiftedFloatSubtraction), GetSignature(BinaryOperatorKind.LiftedDoubleSubtraction), GetSignature(BinaryOperatorKind.LiftedDecimalSubtraction), }).AsImmutableOrNull(), (new [] { GetSignature(BinaryOperatorKind.IntDivision), GetSignature(BinaryOperatorKind.UIntDivision), GetSignature(BinaryOperatorKind.LongDivision), GetSignature(BinaryOperatorKind.ULongDivision), GetSignature(BinaryOperatorKind.FloatDivision), GetSignature(BinaryOperatorKind.DoubleDivision), GetSignature(BinaryOperatorKind.DecimalDivision), GetSignature(BinaryOperatorKind.LiftedIntDivision), GetSignature(BinaryOperatorKind.LiftedUIntDivision), GetSignature(BinaryOperatorKind.LiftedLongDivision), GetSignature(BinaryOperatorKind.LiftedULongDivision), GetSignature(BinaryOperatorKind.LiftedFloatDivision), GetSignature(BinaryOperatorKind.LiftedDoubleDivision), GetSignature(BinaryOperatorKind.LiftedDecimalDivision), }).AsImmutableOrNull(), (new [] { GetSignature(BinaryOperatorKind.IntRemainder), GetSignature(BinaryOperatorKind.UIntRemainder), GetSignature(BinaryOperatorKind.LongRemainder), GetSignature(BinaryOperatorKind.ULongRemainder), GetSignature(BinaryOperatorKind.FloatRemainder), GetSignature(BinaryOperatorKind.DoubleRemainder), GetSignature(BinaryOperatorKind.DecimalRemainder), GetSignature(BinaryOperatorKind.LiftedIntRemainder), GetSignature(BinaryOperatorKind.LiftedUIntRemainder), GetSignature(BinaryOperatorKind.LiftedLongRemainder), GetSignature(BinaryOperatorKind.LiftedULongRemainder), GetSignature(BinaryOperatorKind.LiftedFloatRemainder), GetSignature(BinaryOperatorKind.LiftedDoubleRemainder), GetSignature(BinaryOperatorKind.LiftedDecimalRemainder), }).AsImmutableOrNull(), (new [] { GetSignature(BinaryOperatorKind.IntLeftShift), GetSignature(BinaryOperatorKind.UIntLeftShift), GetSignature(BinaryOperatorKind.LongLeftShift), GetSignature(BinaryOperatorKind.ULongLeftShift), GetSignature(BinaryOperatorKind.LiftedIntLeftShift), GetSignature(BinaryOperatorKind.LiftedUIntLeftShift), GetSignature(BinaryOperatorKind.LiftedLongLeftShift), GetSignature(BinaryOperatorKind.LiftedULongLeftShift), }).AsImmutableOrNull(), (new [] { GetSignature(BinaryOperatorKind.IntRightShift), GetSignature(BinaryOperatorKind.UIntRightShift), GetSignature(BinaryOperatorKind.LongRightShift), GetSignature(BinaryOperatorKind.ULongRightShift), GetSignature(BinaryOperatorKind.LiftedIntRightShift), GetSignature(BinaryOperatorKind.LiftedUIntRightShift), GetSignature(BinaryOperatorKind.LiftedLongRightShift), GetSignature(BinaryOperatorKind.LiftedULongRightShift), }).AsImmutableOrNull(), (new [] { GetSignature(BinaryOperatorKind.IntEqual), GetSignature(BinaryOperatorKind.UIntEqual), GetSignature(BinaryOperatorKind.LongEqual), GetSignature(BinaryOperatorKind.ULongEqual), GetSignature(BinaryOperatorKind.FloatEqual), GetSignature(BinaryOperatorKind.DoubleEqual), GetSignature(BinaryOperatorKind.DecimalEqual), GetSignature(BinaryOperatorKind.BoolEqual), GetSignature(BinaryOperatorKind.LiftedIntEqual), GetSignature(BinaryOperatorKind.LiftedUIntEqual), GetSignature(BinaryOperatorKind.LiftedLongEqual), GetSignature(BinaryOperatorKind.LiftedULongEqual), GetSignature(BinaryOperatorKind.LiftedFloatEqual), GetSignature(BinaryOperatorKind.LiftedDoubleEqual), GetSignature(BinaryOperatorKind.LiftedDecimalEqual), GetSignature(BinaryOperatorKind.LiftedBoolEqual), GetSignature(BinaryOperatorKind.ObjectEqual), GetSignature(BinaryOperatorKind.StringEqual), }).AsImmutableOrNull(), (new [] { GetSignature(BinaryOperatorKind.IntNotEqual), GetSignature(BinaryOperatorKind.UIntNotEqual), GetSignature(BinaryOperatorKind.LongNotEqual), GetSignature(BinaryOperatorKind.ULongNotEqual), GetSignature(BinaryOperatorKind.FloatNotEqual), GetSignature(BinaryOperatorKind.DoubleNotEqual), GetSignature(BinaryOperatorKind.DecimalNotEqual), GetSignature(BinaryOperatorKind.BoolNotEqual), GetSignature(BinaryOperatorKind.LiftedIntNotEqual), GetSignature(BinaryOperatorKind.LiftedUIntNotEqual), GetSignature(BinaryOperatorKind.LiftedLongNotEqual), GetSignature(BinaryOperatorKind.LiftedULongNotEqual), GetSignature(BinaryOperatorKind.LiftedFloatNotEqual), GetSignature(BinaryOperatorKind.LiftedDoubleNotEqual), GetSignature(BinaryOperatorKind.LiftedDecimalNotEqual), GetSignature(BinaryOperatorKind.LiftedBoolNotEqual), GetSignature(BinaryOperatorKind.ObjectNotEqual), GetSignature(BinaryOperatorKind.StringNotEqual), }).AsImmutableOrNull(), (new [] { GetSignature(BinaryOperatorKind.IntGreaterThan), GetSignature(BinaryOperatorKind.UIntGreaterThan), GetSignature(BinaryOperatorKind.LongGreaterThan), GetSignature(BinaryOperatorKind.ULongGreaterThan), GetSignature(BinaryOperatorKind.FloatGreaterThan), GetSignature(BinaryOperatorKind.DoubleGreaterThan), GetSignature(BinaryOperatorKind.DecimalGreaterThan), GetSignature(BinaryOperatorKind.LiftedIntGreaterThan), GetSignature(BinaryOperatorKind.LiftedUIntGreaterThan), GetSignature(BinaryOperatorKind.LiftedLongGreaterThan), GetSignature(BinaryOperatorKind.LiftedULongGreaterThan), GetSignature(BinaryOperatorKind.LiftedFloatGreaterThan), GetSignature(BinaryOperatorKind.LiftedDoubleGreaterThan), GetSignature(BinaryOperatorKind.LiftedDecimalGreaterThan), }).AsImmutableOrNull(), (new [] { GetSignature(BinaryOperatorKind.IntLessThan), GetSignature(BinaryOperatorKind.UIntLessThan), GetSignature(BinaryOperatorKind.LongLessThan), GetSignature(BinaryOperatorKind.ULongLessThan), GetSignature(BinaryOperatorKind.FloatLessThan), GetSignature(BinaryOperatorKind.DoubleLessThan), GetSignature(BinaryOperatorKind.DecimalLessThan), GetSignature(BinaryOperatorKind.LiftedIntLessThan), GetSignature(BinaryOperatorKind.LiftedUIntLessThan), GetSignature(BinaryOperatorKind.LiftedLongLessThan), GetSignature(BinaryOperatorKind.LiftedULongLessThan), GetSignature(BinaryOperatorKind.LiftedFloatLessThan), GetSignature(BinaryOperatorKind.LiftedDoubleLessThan), GetSignature(BinaryOperatorKind.LiftedDecimalLessThan), }).AsImmutableOrNull(), (new [] { GetSignature(BinaryOperatorKind.IntGreaterThanOrEqual), GetSignature(BinaryOperatorKind.UIntGreaterThanOrEqual), GetSignature(BinaryOperatorKind.LongGreaterThanOrEqual), GetSignature(BinaryOperatorKind.ULongGreaterThanOrEqual), GetSignature(BinaryOperatorKind.FloatGreaterThanOrEqual), GetSignature(BinaryOperatorKind.DoubleGreaterThanOrEqual), GetSignature(BinaryOperatorKind.DecimalGreaterThanOrEqual), GetSignature(BinaryOperatorKind.LiftedIntGreaterThanOrEqual), GetSignature(BinaryOperatorKind.LiftedUIntGreaterThanOrEqual), GetSignature(BinaryOperatorKind.LiftedLongGreaterThanOrEqual), GetSignature(BinaryOperatorKind.LiftedULongGreaterThanOrEqual), GetSignature(BinaryOperatorKind.LiftedFloatGreaterThanOrEqual), GetSignature(BinaryOperatorKind.LiftedDoubleGreaterThanOrEqual), GetSignature(BinaryOperatorKind.LiftedDecimalGreaterThanOrEqual), }).AsImmutableOrNull(), (new [] { GetSignature(BinaryOperatorKind.IntLessThanOrEqual), GetSignature(BinaryOperatorKind.UIntLessThanOrEqual), GetSignature(BinaryOperatorKind.LongLessThanOrEqual), GetSignature(BinaryOperatorKind.ULongLessThanOrEqual), GetSignature(BinaryOperatorKind.FloatLessThanOrEqual), GetSignature(BinaryOperatorKind.DoubleLessThanOrEqual), GetSignature(BinaryOperatorKind.DecimalLessThanOrEqual), GetSignature(BinaryOperatorKind.LiftedIntLessThanOrEqual), GetSignature(BinaryOperatorKind.LiftedUIntLessThanOrEqual), GetSignature(BinaryOperatorKind.LiftedLongLessThanOrEqual), GetSignature(BinaryOperatorKind.LiftedULongLessThanOrEqual), GetSignature(BinaryOperatorKind.LiftedFloatLessThanOrEqual), GetSignature(BinaryOperatorKind.LiftedDoubleLessThanOrEqual), GetSignature(BinaryOperatorKind.LiftedDecimalLessThanOrEqual), }).AsImmutableOrNull(), (new [] { GetSignature(BinaryOperatorKind.IntAnd), GetSignature(BinaryOperatorKind.UIntAnd), GetSignature(BinaryOperatorKind.LongAnd), GetSignature(BinaryOperatorKind.ULongAnd), GetSignature(BinaryOperatorKind.BoolAnd), GetSignature(BinaryOperatorKind.LiftedIntAnd), GetSignature(BinaryOperatorKind.LiftedUIntAnd), GetSignature(BinaryOperatorKind.LiftedLongAnd), GetSignature(BinaryOperatorKind.LiftedULongAnd), GetSignature(BinaryOperatorKind.LiftedBoolAnd), }).AsImmutableOrNull(), (new [] { GetSignature(BinaryOperatorKind.IntXor), GetSignature(BinaryOperatorKind.UIntXor), GetSignature(BinaryOperatorKind.LongXor), GetSignature(BinaryOperatorKind.ULongXor), GetSignature(BinaryOperatorKind.BoolXor), GetSignature(BinaryOperatorKind.LiftedIntXor), GetSignature(BinaryOperatorKind.LiftedUIntXor), GetSignature(BinaryOperatorKind.LiftedLongXor), GetSignature(BinaryOperatorKind.LiftedULongXor), GetSignature(BinaryOperatorKind.LiftedBoolXor), }).AsImmutableOrNull(), (new [] { GetSignature(BinaryOperatorKind.IntOr), GetSignature(BinaryOperatorKind.UIntOr), GetSignature(BinaryOperatorKind.LongOr), GetSignature(BinaryOperatorKind.ULongOr), GetSignature(BinaryOperatorKind.BoolOr), GetSignature(BinaryOperatorKind.LiftedIntOr), GetSignature(BinaryOperatorKind.LiftedUIntOr), GetSignature(BinaryOperatorKind.LiftedLongOr), GetSignature(BinaryOperatorKind.LiftedULongOr), GetSignature(BinaryOperatorKind.LiftedBoolOr), }).AsImmutableOrNull(), }; var allOperators = new[] { nonLogicalOperators, logicalOperators }; Interlocked.CompareExchange(ref builtInOperators, allOperators, null); } operators.AddRange(builtInOperators[kind.IsLogical() ? 1 : 0][kind.OperatorIndex()]); }
internal void GetSimpleBuiltInOperators(BinaryOperatorKind kind, ArrayBuilder <BinaryOperatorSignature> operators) { if (builtInOperators == null) { var logicalOperators = new ImmutableArray <BinaryOperatorSignature>[] { ImmutableArray <BinaryOperatorSignature> .Empty, //multiplication ImmutableArray <BinaryOperatorSignature> .Empty, //addition ImmutableArray <BinaryOperatorSignature> .Empty, //subtraction ImmutableArray <BinaryOperatorSignature> .Empty, //division ImmutableArray <BinaryOperatorSignature> .Empty, //remainder ImmutableArray <BinaryOperatorSignature> .Empty, //left shift ImmutableArray <BinaryOperatorSignature> .Empty, //right shift ImmutableArray <BinaryOperatorSignature> .Empty, //equal ImmutableArray <BinaryOperatorSignature> .Empty, //not equal ImmutableArray <BinaryOperatorSignature> .Empty, //greater than ImmutableArray <BinaryOperatorSignature> .Empty, //less than ImmutableArray <BinaryOperatorSignature> .Empty, //greater than or equal ImmutableArray <BinaryOperatorSignature> .Empty, //less than or equal ImmutableArray.Create <BinaryOperatorSignature>(GetSignature(BinaryOperatorKind.LogicalBoolAnd)), //and ImmutableArray <BinaryOperatorSignature> .Empty, //xor ImmutableArray.Create <BinaryOperatorSignature>(GetSignature(BinaryOperatorKind.LogicalBoolOr)), //or }; var nonLogicalOperators = new ImmutableArray <BinaryOperatorSignature>[] { (new [] { GetSignature(BinaryOperatorKind.IntMultiplication), GetSignature(BinaryOperatorKind.UIntMultiplication), GetSignature(BinaryOperatorKind.LongMultiplication), GetSignature(BinaryOperatorKind.ULongMultiplication), GetSignature(BinaryOperatorKind.FloatMultiplication), GetSignature(BinaryOperatorKind.DoubleMultiplication), GetSignature(BinaryOperatorKind.DecimalMultiplication), GetSignature(BinaryOperatorKind.LiftedIntMultiplication), GetSignature(BinaryOperatorKind.LiftedUIntMultiplication), GetSignature(BinaryOperatorKind.LiftedLongMultiplication), GetSignature(BinaryOperatorKind.LiftedULongMultiplication), GetSignature(BinaryOperatorKind.LiftedFloatMultiplication), GetSignature(BinaryOperatorKind.LiftedDoubleMultiplication), GetSignature(BinaryOperatorKind.LiftedDecimalMultiplication), }).AsImmutableOrNull(), (new [] { GetSignature(BinaryOperatorKind.IntAddition), GetSignature(BinaryOperatorKind.UIntAddition), GetSignature(BinaryOperatorKind.LongAddition), GetSignature(BinaryOperatorKind.ULongAddition), GetSignature(BinaryOperatorKind.FloatAddition), GetSignature(BinaryOperatorKind.DoubleAddition), GetSignature(BinaryOperatorKind.DecimalAddition), GetSignature(BinaryOperatorKind.LiftedIntAddition), GetSignature(BinaryOperatorKind.LiftedUIntAddition), GetSignature(BinaryOperatorKind.LiftedLongAddition), GetSignature(BinaryOperatorKind.LiftedULongAddition), GetSignature(BinaryOperatorKind.LiftedFloatAddition), GetSignature(BinaryOperatorKind.LiftedDoubleAddition), GetSignature(BinaryOperatorKind.LiftedDecimalAddition), GetSignature(BinaryOperatorKind.StringConcatenation), GetSignature(BinaryOperatorKind.StringAndObjectConcatenation), GetSignature(BinaryOperatorKind.ObjectAndStringConcatenation), }).AsImmutableOrNull(), (new [] { GetSignature(BinaryOperatorKind.IntSubtraction), GetSignature(BinaryOperatorKind.UIntSubtraction), GetSignature(BinaryOperatorKind.LongSubtraction), GetSignature(BinaryOperatorKind.ULongSubtraction), GetSignature(BinaryOperatorKind.FloatSubtraction), GetSignature(BinaryOperatorKind.DoubleSubtraction), GetSignature(BinaryOperatorKind.DecimalSubtraction), GetSignature(BinaryOperatorKind.LiftedIntSubtraction), GetSignature(BinaryOperatorKind.LiftedUIntSubtraction), GetSignature(BinaryOperatorKind.LiftedLongSubtraction), GetSignature(BinaryOperatorKind.LiftedULongSubtraction), GetSignature(BinaryOperatorKind.LiftedFloatSubtraction), GetSignature(BinaryOperatorKind.LiftedDoubleSubtraction), GetSignature(BinaryOperatorKind.LiftedDecimalSubtraction), }).AsImmutableOrNull(), (new [] { GetSignature(BinaryOperatorKind.IntDivision), GetSignature(BinaryOperatorKind.UIntDivision), GetSignature(BinaryOperatorKind.LongDivision), GetSignature(BinaryOperatorKind.ULongDivision), GetSignature(BinaryOperatorKind.FloatDivision), GetSignature(BinaryOperatorKind.DoubleDivision), GetSignature(BinaryOperatorKind.DecimalDivision), GetSignature(BinaryOperatorKind.LiftedIntDivision), GetSignature(BinaryOperatorKind.LiftedUIntDivision), GetSignature(BinaryOperatorKind.LiftedLongDivision), GetSignature(BinaryOperatorKind.LiftedULongDivision), GetSignature(BinaryOperatorKind.LiftedFloatDivision), GetSignature(BinaryOperatorKind.LiftedDoubleDivision), GetSignature(BinaryOperatorKind.LiftedDecimalDivision), }).AsImmutableOrNull(), (new [] { GetSignature(BinaryOperatorKind.IntRemainder), GetSignature(BinaryOperatorKind.UIntRemainder), GetSignature(BinaryOperatorKind.LongRemainder), GetSignature(BinaryOperatorKind.ULongRemainder), GetSignature(BinaryOperatorKind.FloatRemainder), GetSignature(BinaryOperatorKind.DoubleRemainder), GetSignature(BinaryOperatorKind.DecimalRemainder), GetSignature(BinaryOperatorKind.LiftedIntRemainder), GetSignature(BinaryOperatorKind.LiftedUIntRemainder), GetSignature(BinaryOperatorKind.LiftedLongRemainder), GetSignature(BinaryOperatorKind.LiftedULongRemainder), GetSignature(BinaryOperatorKind.LiftedFloatRemainder), GetSignature(BinaryOperatorKind.LiftedDoubleRemainder), GetSignature(BinaryOperatorKind.LiftedDecimalRemainder), }).AsImmutableOrNull(), (new [] { GetSignature(BinaryOperatorKind.IntLeftShift), GetSignature(BinaryOperatorKind.UIntLeftShift), GetSignature(BinaryOperatorKind.LongLeftShift), GetSignature(BinaryOperatorKind.ULongLeftShift), GetSignature(BinaryOperatorKind.LiftedIntLeftShift), GetSignature(BinaryOperatorKind.LiftedUIntLeftShift), GetSignature(BinaryOperatorKind.LiftedLongLeftShift), GetSignature(BinaryOperatorKind.LiftedULongLeftShift), }).AsImmutableOrNull(), (new [] { GetSignature(BinaryOperatorKind.IntRightShift), GetSignature(BinaryOperatorKind.UIntRightShift), GetSignature(BinaryOperatorKind.LongRightShift), GetSignature(BinaryOperatorKind.ULongRightShift), GetSignature(BinaryOperatorKind.LiftedIntRightShift), GetSignature(BinaryOperatorKind.LiftedUIntRightShift), GetSignature(BinaryOperatorKind.LiftedLongRightShift), GetSignature(BinaryOperatorKind.LiftedULongRightShift), }).AsImmutableOrNull(), (new [] { GetSignature(BinaryOperatorKind.IntEqual), GetSignature(BinaryOperatorKind.UIntEqual), GetSignature(BinaryOperatorKind.LongEqual), GetSignature(BinaryOperatorKind.ULongEqual), GetSignature(BinaryOperatorKind.FloatEqual), GetSignature(BinaryOperatorKind.DoubleEqual), GetSignature(BinaryOperatorKind.DecimalEqual), GetSignature(BinaryOperatorKind.BoolEqual), GetSignature(BinaryOperatorKind.LiftedIntEqual), GetSignature(BinaryOperatorKind.LiftedUIntEqual), GetSignature(BinaryOperatorKind.LiftedLongEqual), GetSignature(BinaryOperatorKind.LiftedULongEqual), GetSignature(BinaryOperatorKind.LiftedFloatEqual), GetSignature(BinaryOperatorKind.LiftedDoubleEqual), GetSignature(BinaryOperatorKind.LiftedDecimalEqual), GetSignature(BinaryOperatorKind.LiftedBoolEqual), GetSignature(BinaryOperatorKind.ObjectEqual), GetSignature(BinaryOperatorKind.StringEqual), }).AsImmutableOrNull(), (new [] { GetSignature(BinaryOperatorKind.IntNotEqual), GetSignature(BinaryOperatorKind.UIntNotEqual), GetSignature(BinaryOperatorKind.LongNotEqual), GetSignature(BinaryOperatorKind.ULongNotEqual), GetSignature(BinaryOperatorKind.FloatNotEqual), GetSignature(BinaryOperatorKind.DoubleNotEqual), GetSignature(BinaryOperatorKind.DecimalNotEqual), GetSignature(BinaryOperatorKind.BoolNotEqual), GetSignature(BinaryOperatorKind.LiftedIntNotEqual), GetSignature(BinaryOperatorKind.LiftedUIntNotEqual), GetSignature(BinaryOperatorKind.LiftedLongNotEqual), GetSignature(BinaryOperatorKind.LiftedULongNotEqual), GetSignature(BinaryOperatorKind.LiftedFloatNotEqual), GetSignature(BinaryOperatorKind.LiftedDoubleNotEqual), GetSignature(BinaryOperatorKind.LiftedDecimalNotEqual), GetSignature(BinaryOperatorKind.LiftedBoolNotEqual), GetSignature(BinaryOperatorKind.ObjectNotEqual), GetSignature(BinaryOperatorKind.StringNotEqual), }).AsImmutableOrNull(), (new [] { GetSignature(BinaryOperatorKind.IntGreaterThan), GetSignature(BinaryOperatorKind.UIntGreaterThan), GetSignature(BinaryOperatorKind.LongGreaterThan), GetSignature(BinaryOperatorKind.ULongGreaterThan), GetSignature(BinaryOperatorKind.FloatGreaterThan), GetSignature(BinaryOperatorKind.DoubleGreaterThan), GetSignature(BinaryOperatorKind.DecimalGreaterThan), GetSignature(BinaryOperatorKind.LiftedIntGreaterThan), GetSignature(BinaryOperatorKind.LiftedUIntGreaterThan), GetSignature(BinaryOperatorKind.LiftedLongGreaterThan), GetSignature(BinaryOperatorKind.LiftedULongGreaterThan), GetSignature(BinaryOperatorKind.LiftedFloatGreaterThan), GetSignature(BinaryOperatorKind.LiftedDoubleGreaterThan), GetSignature(BinaryOperatorKind.LiftedDecimalGreaterThan), }).AsImmutableOrNull(), (new [] { GetSignature(BinaryOperatorKind.IntLessThan), GetSignature(BinaryOperatorKind.UIntLessThan), GetSignature(BinaryOperatorKind.LongLessThan), GetSignature(BinaryOperatorKind.ULongLessThan), GetSignature(BinaryOperatorKind.FloatLessThan), GetSignature(BinaryOperatorKind.DoubleLessThan), GetSignature(BinaryOperatorKind.DecimalLessThan), GetSignature(BinaryOperatorKind.LiftedIntLessThan), GetSignature(BinaryOperatorKind.LiftedUIntLessThan), GetSignature(BinaryOperatorKind.LiftedLongLessThan), GetSignature(BinaryOperatorKind.LiftedULongLessThan), GetSignature(BinaryOperatorKind.LiftedFloatLessThan), GetSignature(BinaryOperatorKind.LiftedDoubleLessThan), GetSignature(BinaryOperatorKind.LiftedDecimalLessThan), }).AsImmutableOrNull(), (new [] { GetSignature(BinaryOperatorKind.IntGreaterThanOrEqual), GetSignature(BinaryOperatorKind.UIntGreaterThanOrEqual), GetSignature(BinaryOperatorKind.LongGreaterThanOrEqual), GetSignature(BinaryOperatorKind.ULongGreaterThanOrEqual), GetSignature(BinaryOperatorKind.FloatGreaterThanOrEqual), GetSignature(BinaryOperatorKind.DoubleGreaterThanOrEqual), GetSignature(BinaryOperatorKind.DecimalGreaterThanOrEqual), GetSignature(BinaryOperatorKind.LiftedIntGreaterThanOrEqual), GetSignature(BinaryOperatorKind.LiftedUIntGreaterThanOrEqual), GetSignature(BinaryOperatorKind.LiftedLongGreaterThanOrEqual), GetSignature(BinaryOperatorKind.LiftedULongGreaterThanOrEqual), GetSignature(BinaryOperatorKind.LiftedFloatGreaterThanOrEqual), GetSignature(BinaryOperatorKind.LiftedDoubleGreaterThanOrEqual), GetSignature(BinaryOperatorKind.LiftedDecimalGreaterThanOrEqual), }).AsImmutableOrNull(), (new [] { GetSignature(BinaryOperatorKind.IntLessThanOrEqual), GetSignature(BinaryOperatorKind.UIntLessThanOrEqual), GetSignature(BinaryOperatorKind.LongLessThanOrEqual), GetSignature(BinaryOperatorKind.ULongLessThanOrEqual), GetSignature(BinaryOperatorKind.FloatLessThanOrEqual), GetSignature(BinaryOperatorKind.DoubleLessThanOrEqual), GetSignature(BinaryOperatorKind.DecimalLessThanOrEqual), GetSignature(BinaryOperatorKind.LiftedIntLessThanOrEqual), GetSignature(BinaryOperatorKind.LiftedUIntLessThanOrEqual), GetSignature(BinaryOperatorKind.LiftedLongLessThanOrEqual), GetSignature(BinaryOperatorKind.LiftedULongLessThanOrEqual), GetSignature(BinaryOperatorKind.LiftedFloatLessThanOrEqual), GetSignature(BinaryOperatorKind.LiftedDoubleLessThanOrEqual), GetSignature(BinaryOperatorKind.LiftedDecimalLessThanOrEqual), }).AsImmutableOrNull(), (new [] { GetSignature(BinaryOperatorKind.IntAnd), GetSignature(BinaryOperatorKind.UIntAnd), GetSignature(BinaryOperatorKind.LongAnd), GetSignature(BinaryOperatorKind.ULongAnd), GetSignature(BinaryOperatorKind.BoolAnd), GetSignature(BinaryOperatorKind.LiftedIntAnd), GetSignature(BinaryOperatorKind.LiftedUIntAnd), GetSignature(BinaryOperatorKind.LiftedLongAnd), GetSignature(BinaryOperatorKind.LiftedULongAnd), GetSignature(BinaryOperatorKind.LiftedBoolAnd), }).AsImmutableOrNull(), (new [] { GetSignature(BinaryOperatorKind.IntXor), GetSignature(BinaryOperatorKind.UIntXor), GetSignature(BinaryOperatorKind.LongXor), GetSignature(BinaryOperatorKind.ULongXor), GetSignature(BinaryOperatorKind.BoolXor), GetSignature(BinaryOperatorKind.LiftedIntXor), GetSignature(BinaryOperatorKind.LiftedUIntXor), GetSignature(BinaryOperatorKind.LiftedLongXor), GetSignature(BinaryOperatorKind.LiftedULongXor), GetSignature(BinaryOperatorKind.LiftedBoolXor), }).AsImmutableOrNull(), (new [] { GetSignature(BinaryOperatorKind.IntOr), GetSignature(BinaryOperatorKind.UIntOr), GetSignature(BinaryOperatorKind.LongOr), GetSignature(BinaryOperatorKind.ULongOr), GetSignature(BinaryOperatorKind.BoolOr), GetSignature(BinaryOperatorKind.LiftedIntOr), GetSignature(BinaryOperatorKind.LiftedUIntOr), GetSignature(BinaryOperatorKind.LiftedLongOr), GetSignature(BinaryOperatorKind.LiftedULongOr), GetSignature(BinaryOperatorKind.LiftedBoolOr), }).AsImmutableOrNull(), }; var allOperators = new[] { nonLogicalOperators, logicalOperators }; Interlocked.CompareExchange(ref builtInOperators, allOperators, null); } operators.AddRange(builtInOperators[kind.IsLogical() ? 1 : 0][kind.OperatorIndex()]); }