2091 references to BinaryOperatorKind
Microsoft.CodeAnalysis.CSharp (1923)
Binder\Binder.ValueChecks.cs (1)
5449if (binary.OperatorKind == BinaryOperatorKind.Utf8Addition)
Binder\Binder_InterpolatedString.cs (3)
151: FoldStringConcatenation(BinaryOperatorKind.StringConcatenation, resultConstant, value.ConstantValueOpt); 173: FoldStringConcatenation(BinaryOperatorKind.StringConcatenation, resultConstant, constantValue); 543BinaryOperatorKind.StringConcatenation,
Binder\Binder_Operators.cs (310)
38BinaryOperatorKind kind = SyntaxKindToBinaryOperatorKind(node.Kind()); 45BinaryOperatorKind kindOperator = kind.Operator(); 48case BinaryOperatorKind.Addition: 49case BinaryOperatorKind.Subtraction: 69if (IsLegalDynamicOperand(right) && IsLegalDynamicOperand(left) && kind != BinaryOperatorKind.UnsignedRightShift) 86kind.WithType(BinaryOperatorKind.Dynamic).WithOverflowChecksIfApplicable(CheckOverflowAtRuntime), 250isUnsignedRightShift: bestSignature.Kind.Operator() == BinaryOperatorKind.UnsignedRightShift, bestSignature.ConstrainedToTypeOpt, diagnostics); 323BinaryOperatorKind kind, 374BinaryOperatorKind kind, 420BinaryOperatorKind kind, 571BinaryOperatorKind kind, 654BinaryOperatorKind kind, 690private BoundExpression BindEventAssignment(AssignmentExpressionSyntax node, BoundEventAccess left, BoundExpression right, BinaryOperatorKind opKind, BindingDiagnosticBag diagnostics) 692Debug.Assert(opKind == BinaryOperatorKind.Addition || opKind == BinaryOperatorKind.Subtraction); 715bool isAddition = opKind == BinaryOperatorKind.Addition; 801BinaryOperatorKind kind, 814if (!leftValidOperand || !rightValidOperand || kind == BinaryOperatorKind.UnsignedRightShift) 828if (!IsValidDynamicCondition(left, isNegative: kind == BinaryOperatorKind.LogicalAnd, diagnostics, userDefinedOperator: out userDefinedOperator)) 832Error(diagnostics, ErrorCode.ERR_InvalidDynamicCondition, node.Left, left.Type, kind == BinaryOperatorKind.LogicalAnd ? "false" : "true"); 845operatorKind: (hasError ? kind : kind.WithType(BinaryOperatorKind.Dynamic)).WithOverflowChecksIfApplicable(CheckOverflowAtRuntime), 939BinaryOperatorKind kind = SyntaxKindToBinaryOperatorKind(node.Kind()); 970bool isEquality = kind == BinaryOperatorKind.Equal || kind == BinaryOperatorKind.NotEqual; 973return new BoundLiteral(node, ConstantValue.Create(kind == BinaryOperatorKind.Equal), GetSpecialType(SpecialType.System_Boolean, diagnostics, node)); 977(kind == BinaryOperatorKind.Equal || kind == BinaryOperatorKind.NotEqual)) 984&& kind == BinaryOperatorKind.Addition 989var stringConstant = FoldBinaryOperator(node, BinaryOperatorKind.StringConcatenation, left, right, right.Type, diagnostics); 990return new BoundBinaryOperator(node, BinaryOperatorKind.StringConcatenation, BoundBinaryOperator.UncommonData.UnconvertedInterpolatedStringAddition(stringConstant), LookupResultKind.Empty, left, right, right.Type); 1017BinaryOperatorKind resultOperatorKind = signature.Kind; 1022resultOperatorKind &= ~BinaryOperatorKind.TypeMask; 1040if ((resultOperatorKind & BinaryOperatorKind.Pointer) == BinaryOperatorKind.Pointer && 1063isUnsignedRightShift: resultOperatorKind.Operator() == BinaryOperatorKind.UnsignedRightShift, signature.ConstrainedToTypeOpt, diagnostics); 1071if (foundOperator && (resultOperatorKind.OperandTypes() != BinaryOperatorKind.NullableNull)) 1078resultOperatorKind is BinaryOperatorKind.ObjectEqual or BinaryOperatorKind.ObjectNotEqual && 1134private bool BindSimpleBinaryOperatorParts(BinaryExpressionSyntax node, BindingDiagnosticBag diagnostics, BoundExpression left, BoundExpression right, BinaryOperatorKind kind, 1158BinaryOperatorKind kind, 1186bool isObjectEquality = signature.Kind == BinaryOperatorKind.ObjectEqual || signature.Kind == BinaryOperatorKind.ObjectNotEqual; 1195(signature.Kind.Operator() == BinaryOperatorKind.Equal || signature.Kind.Operator() == BinaryOperatorKind.NotEqual) && 1201resultSignature = new BinaryOperatorSignature(kind | BinaryOperatorKind.NullableNull, leftType: null, rightType: null, 1304private void ReportAssignmentOperatorError(AssignmentExpressionSyntax node, BinaryOperatorKind kind, BindingDiagnosticBag diagnostics, BoundExpression left, BoundExpression right, 1433BinaryOperatorKind kind = SyntaxKindToBinaryOperatorKind(node.Kind()); 1435Debug.Assert(kind == BinaryOperatorKind.LogicalAnd || kind == BinaryOperatorKind.LogicalOr); 1444var constantValue = FoldBinaryOperator(node, kind | BinaryOperatorKind.Bool, left, right, left.Type, diagnostics); 1447return new BoundBinaryOperator(node, kind | BinaryOperatorKind.Bool, constantValue, methodOpt: null, constrainedToTypeOpt: null, 1518var resultKind = kind | signature.Kind.OperandTypes(); 1521resultKind |= BinaryOperatorKind.Lifted; 1529UnaryOperatorAnalysisResult trueFalseOperator = (kind == BinaryOperatorKind.LogicalAnd ? falseOperator : trueOperator).GetValueOrDefault(); 1677Debug.Assert(signature.Kind.OperandTypes() == BinaryOperatorKind.UserDefined); 2012private TypeSymbol GetBinaryOperatorErrorType(BinaryOperatorKind kind, BindingDiagnosticBag diagnostics, CSharpSyntaxNode node) 2016case BinaryOperatorKind.Equal: 2017case BinaryOperatorKind.NotEqual: 2018case BinaryOperatorKind.GreaterThan: 2019case BinaryOperatorKind.LessThan: 2020case BinaryOperatorKind.GreaterThanOrEqual: 2021case BinaryOperatorKind.LessThanOrEqual: 2029BinaryOperatorKind kind, 2045BinaryOperatorKind kind, 2086BinaryOperatorKind kind, 2146BinaryOperatorKind kind, 2231private bool IsTypelessExpressionAllowedInBinaryOperator(BinaryOperatorKind kind, BoundExpression left, BoundExpression right) 2242bool isEquality = kind == BinaryOperatorKind.Equal || kind == BinaryOperatorKind.NotEqual; 2458private static object FoldDecimalBinaryOperators(BinaryOperatorKind kind, ConstantValue valueLeft, ConstantValue valueRight) 2474case BinaryOperatorKind.DecimalAddition: 2476case BinaryOperatorKind.DecimalSubtraction: 2478case BinaryOperatorKind.DecimalMultiplication: 2480case BinaryOperatorKind.DecimalDivision: 2482case BinaryOperatorKind.DecimalRemainder: 2489private static object FoldNativeIntegerOverflowingBinaryOperator(BinaryOperatorKind kind, ConstantValue valueLeft, ConstantValue valueRight) 2498case BinaryOperatorKind.NIntAddition: 2500case BinaryOperatorKind.NUIntAddition: 2502case BinaryOperatorKind.NIntSubtraction: 2504case BinaryOperatorKind.NUIntSubtraction: 2506case BinaryOperatorKind.NIntMultiplication: 2508case BinaryOperatorKind.NUIntMultiplication: 2510case BinaryOperatorKind.NIntDivision: 2512case BinaryOperatorKind.NIntRemainder: 2514case BinaryOperatorKind.NIntLeftShift: 2520case BinaryOperatorKind.NUIntLeftShift: 2532private static object FoldUncheckedIntegralBinaryOperator(BinaryOperatorKind kind, ConstantValue valueLeft, ConstantValue valueRight) 2541case BinaryOperatorKind.IntAddition: 2543case BinaryOperatorKind.LongAddition: 2545case BinaryOperatorKind.UIntAddition: 2547case BinaryOperatorKind.ULongAddition: 2549case BinaryOperatorKind.IntSubtraction: 2551case BinaryOperatorKind.LongSubtraction: 2553case BinaryOperatorKind.UIntSubtraction: 2555case BinaryOperatorKind.ULongSubtraction: 2557case BinaryOperatorKind.IntMultiplication: 2559case BinaryOperatorKind.LongMultiplication: 2561case BinaryOperatorKind.UIntMultiplication: 2563case BinaryOperatorKind.ULongMultiplication: 2567case BinaryOperatorKind.IntDivision: 2575case BinaryOperatorKind.LongDivision: 2588private static object FoldCheckedIntegralBinaryOperator(BinaryOperatorKind kind, ConstantValue valueLeft, ConstantValue valueRight) 2597case BinaryOperatorKind.IntAddition: 2599case BinaryOperatorKind.LongAddition: 2601case BinaryOperatorKind.UIntAddition: 2603case BinaryOperatorKind.ULongAddition: 2605case BinaryOperatorKind.IntSubtraction: 2607case BinaryOperatorKind.LongSubtraction: 2609case BinaryOperatorKind.UIntSubtraction: 2611case BinaryOperatorKind.ULongSubtraction: 2613case BinaryOperatorKind.IntMultiplication: 2615case BinaryOperatorKind.LongMultiplication: 2617case BinaryOperatorKind.UIntMultiplication: 2619case BinaryOperatorKind.ULongMultiplication: 2621case BinaryOperatorKind.IntDivision: 2623case BinaryOperatorKind.LongDivision: 2631internal static TypeSymbol GetEnumType(BinaryOperatorKind kind, BoundExpression left, BoundExpression right) 2635case BinaryOperatorKind.EnumAndUnderlyingAddition: 2636case BinaryOperatorKind.EnumAndUnderlyingSubtraction: 2637case BinaryOperatorKind.EnumAnd: 2638case BinaryOperatorKind.EnumOr: 2639case BinaryOperatorKind.EnumXor: 2640case BinaryOperatorKind.EnumEqual: 2641case BinaryOperatorKind.EnumGreaterThan: 2642case BinaryOperatorKind.EnumGreaterThanOrEqual: 2643case BinaryOperatorKind.EnumLessThan: 2644case BinaryOperatorKind.EnumLessThanOrEqual: 2645case BinaryOperatorKind.EnumNotEqual: 2646case BinaryOperatorKind.EnumSubtraction: 2648case BinaryOperatorKind.UnderlyingAndEnumAddition: 2649case BinaryOperatorKind.UnderlyingAndEnumSubtraction: 2680BinaryOperatorKind kind, 2714BinaryOperatorKind newKind = kind.Operator().WithType(newLeftOperand.Type!.SpecialType); 2718case BinaryOperatorKind.Addition: 2719case BinaryOperatorKind.Subtraction: 2720case BinaryOperatorKind.And: 2721case BinaryOperatorKind.Or: 2722case BinaryOperatorKind.Xor: 2726case BinaryOperatorKind.LessThan: 2727case BinaryOperatorKind.LessThanOrEqual: 2728case BinaryOperatorKind.GreaterThan: 2729case BinaryOperatorKind.GreaterThanOrEqual: 2730case BinaryOperatorKind.Equal: 2731case BinaryOperatorKind.NotEqual: 2743TypeSymbol resultType = kind == BinaryOperatorKind.EnumSubtraction ? underlyingType : enumType; 2755BinaryOperatorKind kind, 2910private static ConstantValue? TryFoldingNullableEquality(BinaryOperatorKind kind, BoundExpression left, BoundExpression right) 2914BinaryOperatorKind op = kind.Operator(); 2915if (op == BinaryOperatorKind.Equal || op == BinaryOperatorKind.NotEqual) 2932return (leftIsNull == rightIsNull) == (op == BinaryOperatorKind.Equal) ? ConstantValue.True : ConstantValue.False; 2943private static object? FoldNeverOverflowBinaryOperators(BinaryOperatorKind kind, ConstantValue valueLeft, ConstantValue valueRight) 2952case BinaryOperatorKind.ObjectEqual: 2956case BinaryOperatorKind.ObjectNotEqual: 2960case BinaryOperatorKind.DoubleAddition: 2962case BinaryOperatorKind.FloatAddition: 2964case BinaryOperatorKind.DoubleSubtraction: 2966case BinaryOperatorKind.FloatSubtraction: 2968case BinaryOperatorKind.DoubleMultiplication: 2970case BinaryOperatorKind.FloatMultiplication: 2972case BinaryOperatorKind.DoubleDivision: 2974case BinaryOperatorKind.FloatDivision: 2976case BinaryOperatorKind.DoubleRemainder: 2978case BinaryOperatorKind.FloatRemainder: 2980case BinaryOperatorKind.IntLeftShift: 2982case BinaryOperatorKind.LongLeftShift: 2984case BinaryOperatorKind.UIntLeftShift: 2986case BinaryOperatorKind.ULongLeftShift: 2988case BinaryOperatorKind.IntRightShift: 2989case BinaryOperatorKind.NIntRightShift: 2991case BinaryOperatorKind.IntUnsignedRightShift: 2993case BinaryOperatorKind.NIntUnsignedRightShift: 2995case BinaryOperatorKind.LongRightShift: 2997case BinaryOperatorKind.LongUnsignedRightShift: 2999case BinaryOperatorKind.UIntRightShift: 3000case BinaryOperatorKind.NUIntRightShift: 3001case BinaryOperatorKind.UIntUnsignedRightShift: 3002case BinaryOperatorKind.NUIntUnsignedRightShift: 3004case BinaryOperatorKind.ULongRightShift: 3005case BinaryOperatorKind.ULongUnsignedRightShift: 3007case BinaryOperatorKind.BoolAnd: 3009case BinaryOperatorKind.IntAnd: 3010case BinaryOperatorKind.NIntAnd: 3012case BinaryOperatorKind.LongAnd: 3014case BinaryOperatorKind.UIntAnd: 3015case BinaryOperatorKind.NUIntAnd: 3017case BinaryOperatorKind.ULongAnd: 3019case BinaryOperatorKind.BoolOr: 3021case BinaryOperatorKind.IntOr: 3022case BinaryOperatorKind.NIntOr: 3024case BinaryOperatorKind.LongOr: 3026case BinaryOperatorKind.UIntOr: 3027case BinaryOperatorKind.NUIntOr: 3029case BinaryOperatorKind.ULongOr: 3031case BinaryOperatorKind.BoolXor: 3033case BinaryOperatorKind.IntXor: 3034case BinaryOperatorKind.NIntXor: 3036case BinaryOperatorKind.LongXor: 3038case BinaryOperatorKind.UIntXor: 3039case BinaryOperatorKind.NUIntXor: 3041case BinaryOperatorKind.ULongXor: 3043case BinaryOperatorKind.LogicalBoolAnd: 3045case BinaryOperatorKind.LogicalBoolOr: 3047case BinaryOperatorKind.BoolEqual: 3049case BinaryOperatorKind.StringEqual: 3051case BinaryOperatorKind.DecimalEqual: 3053case BinaryOperatorKind.FloatEqual: 3055case BinaryOperatorKind.DoubleEqual: 3057case BinaryOperatorKind.IntEqual: 3058case BinaryOperatorKind.NIntEqual: 3060case BinaryOperatorKind.LongEqual: 3062case BinaryOperatorKind.UIntEqual: 3063case BinaryOperatorKind.NUIntEqual: 3065case BinaryOperatorKind.ULongEqual: 3067case BinaryOperatorKind.BoolNotEqual: 3069case BinaryOperatorKind.StringNotEqual: 3071case BinaryOperatorKind.DecimalNotEqual: 3073case BinaryOperatorKind.FloatNotEqual: 3075case BinaryOperatorKind.DoubleNotEqual: 3077case BinaryOperatorKind.IntNotEqual: 3078case BinaryOperatorKind.NIntNotEqual: 3080case BinaryOperatorKind.LongNotEqual: 3082case BinaryOperatorKind.UIntNotEqual: 3083case BinaryOperatorKind.NUIntNotEqual: 3085case BinaryOperatorKind.ULongNotEqual: 3087case BinaryOperatorKind.DecimalLessThan: 3089case BinaryOperatorKind.FloatLessThan: 3091case BinaryOperatorKind.DoubleLessThan: 3093case BinaryOperatorKind.IntLessThan: 3094case BinaryOperatorKind.NIntLessThan: 3096case BinaryOperatorKind.LongLessThan: 3098case BinaryOperatorKind.UIntLessThan: 3099case BinaryOperatorKind.NUIntLessThan: 3101case BinaryOperatorKind.ULongLessThan: 3103case BinaryOperatorKind.DecimalGreaterThan: 3105case BinaryOperatorKind.FloatGreaterThan: 3107case BinaryOperatorKind.DoubleGreaterThan: 3109case BinaryOperatorKind.IntGreaterThan: 3110case BinaryOperatorKind.NIntGreaterThan: 3112case BinaryOperatorKind.LongGreaterThan: 3114case BinaryOperatorKind.UIntGreaterThan: 3115case BinaryOperatorKind.NUIntGreaterThan: 3117case BinaryOperatorKind.ULongGreaterThan: 3119case BinaryOperatorKind.DecimalLessThanOrEqual: 3121case BinaryOperatorKind.FloatLessThanOrEqual: 3123case BinaryOperatorKind.DoubleLessThanOrEqual: 3125case BinaryOperatorKind.IntLessThanOrEqual: 3126case BinaryOperatorKind.NIntLessThanOrEqual: 3128case BinaryOperatorKind.LongLessThanOrEqual: 3130case BinaryOperatorKind.UIntLessThanOrEqual: 3131case BinaryOperatorKind.NUIntLessThanOrEqual: 3133case BinaryOperatorKind.ULongLessThanOrEqual: 3135case BinaryOperatorKind.DecimalGreaterThanOrEqual: 3137case BinaryOperatorKind.FloatGreaterThanOrEqual: 3139case BinaryOperatorKind.DoubleGreaterThanOrEqual: 3141case BinaryOperatorKind.IntGreaterThanOrEqual: 3142case BinaryOperatorKind.NIntGreaterThanOrEqual: 3144case BinaryOperatorKind.LongGreaterThanOrEqual: 3146case BinaryOperatorKind.UIntGreaterThanOrEqual: 3147case BinaryOperatorKind.NUIntGreaterThanOrEqual: 3149case BinaryOperatorKind.ULongGreaterThanOrEqual: 3151case BinaryOperatorKind.UIntDivision: 3152case BinaryOperatorKind.NUIntDivision: 3154case BinaryOperatorKind.ULongDivision: 3158case BinaryOperatorKind.IntRemainder: 3160case BinaryOperatorKind.LongRemainder: 3162case BinaryOperatorKind.UIntRemainder: 3163case BinaryOperatorKind.NUIntRemainder: 3165case BinaryOperatorKind.ULongRemainder: 3175private static ConstantValue? FoldStringConcatenation(BinaryOperatorKind kind, ConstantValue valueLeft, ConstantValue valueRight) 3180if (kind == BinaryOperatorKind.StringConcatenation) 3193public static BinaryOperatorKind SyntaxKindToBinaryOperatorKind(SyntaxKind kind) 3198case SyntaxKind.MultiplyExpression: return BinaryOperatorKind.Multiplication; 3200case SyntaxKind.DivideExpression: return BinaryOperatorKind.Division; 3202case SyntaxKind.ModuloExpression: return BinaryOperatorKind.Remainder; 3204case SyntaxKind.AddExpression: return BinaryOperatorKind.Addition; 3206case SyntaxKind.SubtractExpression: return BinaryOperatorKind.Subtraction; 3208case SyntaxKind.RightShiftExpression: return BinaryOperatorKind.RightShift; 3210case SyntaxKind.UnsignedRightShiftExpression: return BinaryOperatorKind.UnsignedRightShift; 3212case SyntaxKind.LeftShiftExpression: return BinaryOperatorKind.LeftShift; 3213case SyntaxKind.EqualsExpression: return BinaryOperatorKind.Equal; 3214case SyntaxKind.NotEqualsExpression: return BinaryOperatorKind.NotEqual; 3215case SyntaxKind.GreaterThanExpression: return BinaryOperatorKind.GreaterThan; 3216case SyntaxKind.LessThanExpression: return BinaryOperatorKind.LessThan; 3217case SyntaxKind.GreaterThanOrEqualExpression: return BinaryOperatorKind.GreaterThanOrEqual; 3218case SyntaxKind.LessThanOrEqualExpression: return BinaryOperatorKind.LessThanOrEqual; 3220case SyntaxKind.BitwiseAndExpression: return BinaryOperatorKind.And; 3222case SyntaxKind.BitwiseOrExpression: return BinaryOperatorKind.Or; 3224case SyntaxKind.ExclusiveOrExpression: return BinaryOperatorKind.Xor; 3225case SyntaxKind.LogicalAndExpression: return BinaryOperatorKind.LogicalAnd; 3226case SyntaxKind.LogicalOrExpression: return BinaryOperatorKind.LogicalOr; 4728private static bool IsDivisionByZero(BinaryOperatorKind kind, ConstantValue valueRight) 4734case BinaryOperatorKind.DecimalDivision: 4735case BinaryOperatorKind.DecimalRemainder: 4737case BinaryOperatorKind.IntDivision: 4738case BinaryOperatorKind.IntRemainder: 4739case BinaryOperatorKind.NIntDivision: 4740case BinaryOperatorKind.NIntRemainder: 4742case BinaryOperatorKind.LongDivision: 4743case BinaryOperatorKind.LongRemainder: 4745case BinaryOperatorKind.UIntDivision: 4746case BinaryOperatorKind.UIntRemainder: 4747case BinaryOperatorKind.NUIntDivision: 4748case BinaryOperatorKind.NUIntRemainder: 4750case BinaryOperatorKind.ULongDivision: 4751case BinaryOperatorKind.ULongRemainder: 6083private void CheckNativeIntegerFeatureAvailability(BinaryOperatorKind operatorKind, SyntaxNode syntax, BindingDiagnosticBag diagnostics) 6090switch (operatorKind & BinaryOperatorKind.TypeMask) 6092case BinaryOperatorKind.NInt: 6093case BinaryOperatorKind.NUInt:
Binder\Binder_Patterns.cs (32)
2070BinaryOperatorKind operation = tokenKindToBinaryOperatorKind(node.OperatorToken.Kind()); 2071if (operation == BinaryOperatorKind.Equal) 2077BinaryOperatorKind opType = RelationalOperatorType(type.EnumUnderlyingTypeOrSelf()); 2080case BinaryOperatorKind.Float: 2081case BinaryOperatorKind.Double: 2088case BinaryOperatorKind.String: 2089case BinaryOperatorKind.Bool: 2090case BinaryOperatorKind.Error: 2114static BinaryOperatorKind tokenKindToBinaryOperatorKind(SyntaxKind kind) => kind switch 2116SyntaxKind.LessThanEqualsToken => BinaryOperatorKind.LessThanOrEqual, 2117SyntaxKind.LessThanToken => BinaryOperatorKind.LessThan, 2118SyntaxKind.GreaterThanToken => BinaryOperatorKind.GreaterThan, 2119SyntaxKind.GreaterThanEqualsToken => BinaryOperatorKind.GreaterThanOrEqual, 2121_ => BinaryOperatorKind.Equal, 2130internal static BinaryOperatorKind RelationalOperatorType(TypeSymbol type) => type.SpecialType switch 2132SpecialType.System_Single => BinaryOperatorKind.Float, 2133SpecialType.System_Double => BinaryOperatorKind.Double, 2134SpecialType.System_Char => BinaryOperatorKind.Char, 2135SpecialType.System_SByte => BinaryOperatorKind.Int, // operands are converted to int 2136SpecialType.System_Byte => BinaryOperatorKind.Int, // operands are converted to int 2137SpecialType.System_UInt16 => BinaryOperatorKind.Int, // operands are converted to int 2138SpecialType.System_Int16 => BinaryOperatorKind.Int, // operands are converted to int 2139SpecialType.System_Int32 => BinaryOperatorKind.Int, 2140SpecialType.System_UInt32 => BinaryOperatorKind.UInt, 2141SpecialType.System_Int64 => BinaryOperatorKind.Long, 2142SpecialType.System_UInt64 => BinaryOperatorKind.ULong, 2143SpecialType.System_Decimal => BinaryOperatorKind.Decimal, 2144SpecialType.System_String => BinaryOperatorKind.String, 2145SpecialType.System_Boolean => BinaryOperatorKind.Bool, 2146SpecialType.System_IntPtr when type.IsNativeIntegerType => BinaryOperatorKind.NInt, 2147SpecialType.System_UIntPtr when type.IsNativeIntegerType => BinaryOperatorKind.NUInt, 2148_ => BinaryOperatorKind.Error,
Binder\Binder_TupleOperators.cs (9)
25private BoundTupleBinaryOperator BindTupleBinaryOperator(BinaryExpressionSyntax node, BinaryOperatorKind kind, 82private TupleBinaryOperatorInfo BindTupleBinaryOperatorInfo(BinaryExpressionSyntax node, BinaryOperatorKind kind, 126private void PrepareBoolConversionAndTruthOperator(TypeSymbol type, BinaryExpressionSyntax node, BinaryOperatorKind binaryOperator, BindingDiagnosticBag diagnostics, 149case BinaryOperatorKind.Equal: 152case BinaryOperatorKind.NotEqual: 183private TupleBinaryOperatorInfo BindTupleDynamicBinaryOperatorSingleInfo(BinaryExpressionSyntax node, BinaryOperatorKind kind, 197BinaryOperatorKind elementOperatorKind = hasError ? kind : kind.WithType(BinaryOperatorKind.Dynamic); 206private TupleBinaryOperatorInfo.Multiple BindTupleBinaryOperatorNestedInfo(BinaryExpressionSyntax node, BinaryOperatorKind kind,
Binder\DecisionDagBuilder.cs (15)
909if (ValueSetFactory.ForInput(input)?.Related(BinaryOperatorKind.Equal, constantValue).IsEmpty == true) 1745return resultForRelation(BinaryOperatorKind.Equal, t.Value); 1757resultForRelation(BinaryOperatorKind relation, ConstantValue value) 2015handleRelationWithValue(BinaryOperatorKind.Equal, v2.Value, 2020BinaryOperatorKind relation, 2878BinaryOperatorKind.LessThan => "<", 2879BinaryOperatorKind.LessThanOrEqual => "<=", 2880BinaryOperatorKind.GreaterThan => ">", 2881BinaryOperatorKind.GreaterThanOrEqual => ">=", 3467Debug.Assert(t.Relation == BinaryOperatorKind.GreaterThanOrEqual); 3482return knownResult(BinaryOperatorKind.Equal, t.Value, offset) ?? 3494static Tests? knownResult(BinaryOperatorKind relation, ConstantValue constant, int offset) 3497IConstantValueSet possibleValues = fac.Related(BinaryOperatorKind.LessThanOrEqual, int.MaxValue - offset); 3820if (lengthValues.All(BinaryOperatorKind.Equal, lengthValue)) 3828if (!dagBuilder._forLowering && lengthValues.Any(BinaryOperatorKind.Equal, lengthValue))
Binder\DecisionDagBuilder_ListPatterns.cs (1)
50? new BoundDagRelationalTest(syntax, BinaryOperatorKind.IntGreaterThanOrEqual, ConstantValue.Create(subpatterns.Length - 1), lengthTemp)
Binder\PatternExplainer.cs (7)
464if (lengthValues.All(BinaryOperatorKind.Equal, lengthValue)) 736addRelation(BinaryOperatorKind.Equal, v.Value); 743void addRelation(BinaryOperatorKind relation, ConstantValue value) 786remainingValues.Any(BinaryOperatorKind.Equal, constantValue)) 807if (remainingValues.Any(BinaryOperatorKind.GreaterThan, ConstantValue.Create(int.MaxValue))) 810if (remainingValues.Any(BinaryOperatorKind.LessThan, ConstantValue.Create(int.MinValue))) 815if (remainingValues.Any(BinaryOperatorKind.GreaterThan, ConstantValue.Create(uint.MaxValue)))
Binder\Semantics\Operators\BinaryOperatorEasyOut.cs (78)
14private const BinaryOperatorKind ERR = BinaryOperatorKind.Error; 15private const BinaryOperatorKind OBJ = BinaryOperatorKind.Object; 16private const BinaryOperatorKind STR = BinaryOperatorKind.String; 17private const BinaryOperatorKind OSC = BinaryOperatorKind.ObjectAndString; 18private const BinaryOperatorKind SOC = BinaryOperatorKind.StringAndObject; 19private const BinaryOperatorKind INT = BinaryOperatorKind.Int; 20private const BinaryOperatorKind UIN = BinaryOperatorKind.UInt; 21private const BinaryOperatorKind LNG = BinaryOperatorKind.Long; 22private const BinaryOperatorKind ULG = BinaryOperatorKind.ULong; 23private const BinaryOperatorKind NIN = BinaryOperatorKind.NInt; 24private const BinaryOperatorKind NUI = BinaryOperatorKind.NUInt; 25private const BinaryOperatorKind FLT = BinaryOperatorKind.Float; 26private const BinaryOperatorKind DBL = BinaryOperatorKind.Double; 27private const BinaryOperatorKind DEC = BinaryOperatorKind.Decimal; 28private const BinaryOperatorKind BOL = BinaryOperatorKind.Bool; 29private const BinaryOperatorKind LIN = BinaryOperatorKind.Lifted | BinaryOperatorKind.Int; 30private const BinaryOperatorKind LUN = BinaryOperatorKind.Lifted | BinaryOperatorKind.UInt; 31private const BinaryOperatorKind LLG = BinaryOperatorKind.Lifted | BinaryOperatorKind.Long; 32private const BinaryOperatorKind LUL = BinaryOperatorKind.Lifted | BinaryOperatorKind.ULong; 33private const BinaryOperatorKind LNI = BinaryOperatorKind.Lifted | BinaryOperatorKind.NInt; 34private const BinaryOperatorKind LNU = BinaryOperatorKind.Lifted | BinaryOperatorKind.NUInt; 35private const BinaryOperatorKind LFL = BinaryOperatorKind.Lifted | BinaryOperatorKind.Float; 36private const BinaryOperatorKind LDB = BinaryOperatorKind.Lifted | BinaryOperatorKind.Double; 37private const BinaryOperatorKind LDC = BinaryOperatorKind.Lifted | BinaryOperatorKind.Decimal; 38private const BinaryOperatorKind LBL = BinaryOperatorKind.Lifted | BinaryOperatorKind.Bool; 41private static readonly BinaryOperatorKind[,] s_arithmetic = 79private static readonly BinaryOperatorKind[,] s_addition = 117private static readonly BinaryOperatorKind[,] s_shift = 159private static readonly BinaryOperatorKind[,] s_equality = 197private static readonly BinaryOperatorKind[,] s_logical = 234private static readonly BinaryOperatorKind[][,] s_opkind = 255public static BinaryOperatorKind OpKind(BinaryOperatorKind kind, TypeSymbol left, TypeSymbol right) 260return BinaryOperatorKind.Error; 265return BinaryOperatorKind.Error; 268var result = BinaryOperatorKind.Error; 277if (!kind.IsLogical() || (leftIndex == (int)BinaryOperatorKind.Bool && rightIndex == (int)BinaryOperatorKind.Bool)) 282return result == BinaryOperatorKind.Error ? result : result | kind; 286private void BinaryOperatorEasyOut(BinaryOperatorKind kind, BoundExpression left, BoundExpression right, BinaryOperatorOverloadResolutionResult result) 305var easyOut = BinopEasyOut.OpKind(kind, leftType, rightType); 307if (easyOut == BinaryOperatorKind.Error)
Binder\Semantics\Operators\BinaryOperatorOverloadResolution.cs (151)
22BinaryOperatorKind kind, 41internal void BinaryOperatorOverloadResolution_EasyOut(BinaryOperatorKind kind, BoundExpression left, BoundExpression right, BinaryOperatorOverloadResolutionResult result) 52BinaryOperatorKind underlyingKind = kind & ~BinaryOperatorKind.Logical; 58BinaryOperatorKind kind, 220private bool GetUserDefinedBinaryOperatorsFromInterfaces(BinaryOperatorKind kind, bool isChecked, 318private void AddDelegateOperation(BinaryOperatorKind kind, TypeSymbol delegateType, 323case BinaryOperatorKind.Equal: 324case BinaryOperatorKind.NotEqual: 325operators.Add(new BinaryOperatorSignature(kind | BinaryOperatorKind.Delegate, delegateType, delegateType, Compilation.GetSpecialType(SpecialType.System_Boolean))); 328case BinaryOperatorKind.Addition: 329case BinaryOperatorKind.Subtraction: 331operators.Add(new BinaryOperatorSignature(kind | BinaryOperatorKind.Delegate, delegateType, delegateType, delegateType)); 336private void GetDelegateOperations(BinaryOperatorKind kind, BoundExpression left, BoundExpression right, 345case BinaryOperatorKind.Multiplication: 346case BinaryOperatorKind.Division: 347case BinaryOperatorKind.Remainder: 348case BinaryOperatorKind.RightShift: 349case BinaryOperatorKind.UnsignedRightShift: 350case BinaryOperatorKind.LeftShift: 351case BinaryOperatorKind.And: 352case BinaryOperatorKind.Or: 353case BinaryOperatorKind.Xor: 354case BinaryOperatorKind.GreaterThan: 355case BinaryOperatorKind.LessThan: 356case BinaryOperatorKind.GreaterThanOrEqual: 357case BinaryOperatorKind.LessThanOrEqual: 358case BinaryOperatorKind.LogicalAnd: 359case BinaryOperatorKind.LogicalOr: 362case BinaryOperatorKind.Addition: 363case BinaryOperatorKind.Subtraction: 364case BinaryOperatorKind.Equal: 365case BinaryOperatorKind.NotEqual: 391case BinaryOperatorKind.Equal: 392case BinaryOperatorKind.NotEqual: 454bool useIdentityConversion = kind == BinaryOperatorKind.Equal || kind == BinaryOperatorKind.NotEqual; 468if ((kind == BinaryOperatorKind.Equal || kind == BinaryOperatorKind.NotEqual) 477private void GetEnumOperation(BinaryOperatorKind kind, TypeSymbol enumType, BoundExpression right, ArrayBuilder<BinaryOperatorSignature> operators) 496case BinaryOperatorKind.Addition: 497operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.EnumAndUnderlyingAddition, enumType, underlying, enumType)); 498operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.UnderlyingAndEnumAddition, underlying, enumType, enumType)); 499operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.LiftedEnumAndUnderlyingAddition, nullableEnum, nullableUnderlying, nullableEnum)); 500operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.LiftedUnderlyingAndEnumAddition, nullableUnderlying, nullableEnum, nullableEnum)); 502case BinaryOperatorKind.Subtraction: 505operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.EnumSubtraction, enumType, enumType, underlying)); 506operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.EnumAndUnderlyingSubtraction, enumType, underlying, enumType)); 507operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.LiftedEnumSubtraction, nullableEnum, nullableEnum, nullableUnderlying)); 508operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.LiftedEnumAndUnderlyingSubtraction, nullableEnum, nullableUnderlying, nullableEnum)); 518operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.EnumSubtraction, enumType, enumType, underlying) 520operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.EnumAndUnderlyingSubtraction, enumType, underlying, enumType) 522operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.LiftedEnumSubtraction, nullableEnum, nullableEnum, nullableUnderlying) 524operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.LiftedEnumAndUnderlyingSubtraction, nullableEnum, nullableUnderlying, nullableEnum) 528operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.UnderlyingAndEnumSubtraction, underlying, enumType, enumType) 530operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.LiftedUnderlyingAndEnumSubtraction, nullableUnderlying, nullableEnum, nullableEnum) 534case BinaryOperatorKind.Equal: 535case BinaryOperatorKind.NotEqual: 536case BinaryOperatorKind.GreaterThan: 537case BinaryOperatorKind.LessThan: 538case BinaryOperatorKind.GreaterThanOrEqual: 539case BinaryOperatorKind.LessThanOrEqual: 541operators.Add(new BinaryOperatorSignature(kind | BinaryOperatorKind.Enum, enumType, enumType, boolean)); 542operators.Add(new BinaryOperatorSignature(kind | BinaryOperatorKind.Lifted | BinaryOperatorKind.Enum, nullableEnum, nullableEnum, boolean)); 544case BinaryOperatorKind.And: 545case BinaryOperatorKind.Or: 546case BinaryOperatorKind.Xor: 547operators.Add(new BinaryOperatorSignature(kind | BinaryOperatorKind.Enum, enumType, enumType, enumType)); 548operators.Add(new BinaryOperatorSignature(kind | BinaryOperatorKind.Lifted | BinaryOperatorKind.Enum, nullableEnum, nullableEnum, nullableEnum)); 554BinaryOperatorKind kind, 563case BinaryOperatorKind.Addition: 564operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.PointerAndIntAddition, pointerType, Compilation.GetSpecialType(SpecialType.System_Int32), pointerType)); 565operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.PointerAndUIntAddition, pointerType, Compilation.GetSpecialType(SpecialType.System_UInt32), pointerType)); 566operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.PointerAndLongAddition, pointerType, Compilation.GetSpecialType(SpecialType.System_Int64), pointerType)); 567operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.PointerAndULongAddition, pointerType, Compilation.GetSpecialType(SpecialType.System_UInt64), pointerType)); 568operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.IntAndPointerAddition, Compilation.GetSpecialType(SpecialType.System_Int32), pointerType, pointerType)); 569operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.UIntAndPointerAddition, Compilation.GetSpecialType(SpecialType.System_UInt32), pointerType, pointerType)); 570operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.LongAndPointerAddition, Compilation.GetSpecialType(SpecialType.System_Int64), pointerType, pointerType)); 571operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.ULongAndPointerAddition, Compilation.GetSpecialType(SpecialType.System_UInt64), pointerType, pointerType)); 573case BinaryOperatorKind.Subtraction: 574operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.PointerAndIntSubtraction, pointerType, Compilation.GetSpecialType(SpecialType.System_Int32), pointerType)); 575operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.PointerAndUIntSubtraction, pointerType, Compilation.GetSpecialType(SpecialType.System_UInt32), pointerType)); 576operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.PointerAndLongSubtraction, pointerType, Compilation.GetSpecialType(SpecialType.System_Int64), pointerType)); 577operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.PointerAndULongSubtraction, pointerType, Compilation.GetSpecialType(SpecialType.System_UInt64), pointerType)); 578operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.PointerSubtraction, pointerType, pointerType, Compilation.GetSpecialType(SpecialType.System_Int64))); 584BinaryOperatorKind kind, 589case BinaryOperatorKind.Equal: 590case BinaryOperatorKind.NotEqual: 591case BinaryOperatorKind.GreaterThan: 592case BinaryOperatorKind.LessThan: 593case BinaryOperatorKind.GreaterThanOrEqual: 594case BinaryOperatorKind.LessThanOrEqual: 596operators.Add(new BinaryOperatorSignature(kind | BinaryOperatorKind.Pointer, voidPointerType, voidPointerType, Compilation.GetSpecialType(SpecialType.System_Boolean))); 601private void GetEnumOperations(BinaryOperatorKind kind, BoundExpression left, BoundExpression right, ArrayBuilder<BinaryOperatorSignature> results) 610case BinaryOperatorKind.Multiplication: 611case BinaryOperatorKind.Division: 612case BinaryOperatorKind.Remainder: 613case BinaryOperatorKind.RightShift: 614case BinaryOperatorKind.UnsignedRightShift: 615case BinaryOperatorKind.LeftShift: 616case BinaryOperatorKind.LogicalAnd: 617case BinaryOperatorKind.LogicalOr: 636case BinaryOperatorKind.And: 637case BinaryOperatorKind.Or: 638case BinaryOperatorKind.Xor: 645case BinaryOperatorKind.Addition: 652case BinaryOperatorKind.Subtraction: 659case BinaryOperatorKind.Equal: 660case BinaryOperatorKind.NotEqual: 661case BinaryOperatorKind.GreaterThan: 662case BinaryOperatorKind.LessThan: 663case BinaryOperatorKind.GreaterThanOrEqual: 664case BinaryOperatorKind.LessThanOrEqual: 687BinaryOperatorKind kind, 719private void GetAllBuiltInOperators(BinaryOperatorKind kind, bool isChecked, BoundExpression left, BoundExpression right, ArrayBuilder<BinaryOperatorAnalysisResult> results, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 725bool isEquality = kind == BinaryOperatorKind.Equal || kind == BinaryOperatorKind.NotEqual; 765if (kind.Operator() is BinaryOperatorKind.Addition && 787return value is BoundUtf8String or BoundBinaryOperator { OperatorKind: BinaryOperatorKind.Utf8Addition }; 796private void GetReferenceEquality(BinaryOperatorKind kind, ArrayBuilder<BinaryOperatorSignature> operators) 799operators.Add(new BinaryOperatorSignature(kind | BinaryOperatorKind.Object, @object, @object, Compilation.GetSpecialType(SpecialType.System_Boolean))); 865BinaryOperatorKind kind, 933internal static void GetStaticUserDefinedBinaryOperatorMethodNames(BinaryOperatorKind kind, bool isChecked, out string name1, out string? name2Opt) 950BinaryOperatorKind kind, 989private static void GetDeclaredUserDefinedBinaryOperators(TypeSymbol? constrainedToTypeOpt, NamedTypeSymbol type, BinaryOperatorKind kind, string name, ArrayBuilder<BinaryOperatorSignature> operators) 997private static void GetDeclaredUserDefinedBinaryOperators(TypeSymbol? constrainedToTypeOpt, ArrayBuilder<MethodSymbol> typeOperators, BinaryOperatorKind kind, string name, ArrayBuilder<BinaryOperatorSignature> operators) 1016operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.UserDefined | kind, leftOperandType, rightOperandType, resultType, op, constrainedToTypeOpt)); 1020void AddLiftedUserDefinedBinaryOperators(TypeSymbol? constrainedToTypeOpt, BinaryOperatorKind kind, ArrayBuilder<BinaryOperatorSignature> operators) 1034BinaryOperatorKind.Lifted | BinaryOperatorKind.UserDefined | kind, 1040BinaryOperatorKind.Lifted | BinaryOperatorKind.UserDefined | kind, 1055private static LiftingResult UserDefinedBinaryOperatorCanBeLifted(TypeSymbol left, TypeSymbol right, TypeSymbol result, BinaryOperatorKind kind) 1080case BinaryOperatorKind.Equal: 1081case BinaryOperatorKind.NotEqual: 1085goto case BinaryOperatorKind.GreaterThan; 1086case BinaryOperatorKind.GreaterThan: 1087case BinaryOperatorKind.GreaterThanOrEqual: 1088case BinaryOperatorKind.LessThan: 1089case BinaryOperatorKind.LessThanOrEqual: 1424private static void AssertNotChecked(BinaryOperatorKind kind) 1426Debug.Assert((kind & ~BinaryOperatorKind.Checked) == kind, "Did not expect operator to be checked. Consider using .Operator() to mask."); 1433BinaryOperatorKind kind, 1472static void getDeclaredUserDefinedBinaryOperatorsInScope(ArrayBuilder<Symbol> extensionCandidatesInSingleScope, BinaryOperatorKind kind, string name1, string? name2Opt, ArrayBuilder<BinaryOperatorSignature> operators) 1503static void getDeclaredUserDefinedBinaryOperators(ArrayBuilder<Symbol> extensionCandidatesInSingleScope, BinaryOperatorKind kind, string name, ArrayBuilder<BinaryOperatorSignature> operators) 1512void inferTypeArgumentsAndRemoveInapplicableToReceiverType(BinaryOperatorKind kind, BoundExpression left, BoundExpression right, ArrayBuilder<BinaryOperatorSignature> operators, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 1560BinaryOperatorKind.Lifted | BinaryOperatorKind.UserDefined | kind, 1568inferredCandidate = new BinaryOperatorSignature(BinaryOperatorKind.UserDefined | kind, leftOperandType, rightOperandType, resultType, method, constrainedToTypeOpt: null);
Binder\Semantics\Operators\BinaryOperatorSignature.cs (3)
23public readonly BinaryOperatorKind Kind; 32public BinaryOperatorSignature(BinaryOperatorKind kind, TypeSymbol leftType, TypeSymbol rightType, TypeSymbol returnType) 43public BinaryOperatorSignature(BinaryOperatorKind kind, TypeSymbol leftType, TypeSymbol rightType, TypeSymbol returnType, MethodSymbol method, TypeSymbol constrainedToTypeOpt)
Binder\Semantics\Operators\OperatorFacts.cs (20)
250public static string BinaryOperatorNameFromOperatorKind(BinaryOperatorKind kind, bool isChecked) 252switch (kind & BinaryOperatorKind.OpMask) 254case BinaryOperatorKind.Addition: return isChecked ? WellKnownMemberNames.CheckedAdditionOperatorName : WellKnownMemberNames.AdditionOperatorName; 255case BinaryOperatorKind.And: return WellKnownMemberNames.BitwiseAndOperatorName; 256case BinaryOperatorKind.Division: return isChecked ? WellKnownMemberNames.CheckedDivisionOperatorName : WellKnownMemberNames.DivisionOperatorName; 257case BinaryOperatorKind.Equal: return WellKnownMemberNames.EqualityOperatorName; 258case BinaryOperatorKind.GreaterThan: return WellKnownMemberNames.GreaterThanOperatorName; 259case BinaryOperatorKind.GreaterThanOrEqual: return WellKnownMemberNames.GreaterThanOrEqualOperatorName; 260case BinaryOperatorKind.LeftShift: return WellKnownMemberNames.LeftShiftOperatorName; 261case BinaryOperatorKind.LessThan: return WellKnownMemberNames.LessThanOperatorName; 262case BinaryOperatorKind.LessThanOrEqual: return WellKnownMemberNames.LessThanOrEqualOperatorName; 263case BinaryOperatorKind.Multiplication: return isChecked ? WellKnownMemberNames.CheckedMultiplyOperatorName : WellKnownMemberNames.MultiplyOperatorName; 264case BinaryOperatorKind.Or: return WellKnownMemberNames.BitwiseOrOperatorName; 265case BinaryOperatorKind.NotEqual: return WellKnownMemberNames.InequalityOperatorName; 266case BinaryOperatorKind.Remainder: return WellKnownMemberNames.ModulusOperatorName; 267case BinaryOperatorKind.RightShift: return WellKnownMemberNames.RightShiftOperatorName; 268case BinaryOperatorKind.UnsignedRightShift: return WellKnownMemberNames.UnsignedRightShiftOperatorName; 269case BinaryOperatorKind.Subtraction: return isChecked ? WellKnownMemberNames.CheckedSubtractionOperatorName : WellKnownMemberNames.SubtractionOperatorName; 270case BinaryOperatorKind.Xor: return WellKnownMemberNames.ExclusiveOrOperatorName; 272throw ExceptionUtilities.UnexpectedValue(kind & BinaryOperatorKind.OpMask);
Binder\Semantics\Operators\OperatorKindExtensions.cs (121)
127public static int OperatorIndex(this BinaryOperatorKind kind) 132public static BinaryOperatorKind Operator(this BinaryOperatorKind kind) 134return kind & BinaryOperatorKind.OpMask; 137public static BinaryOperatorKind Unlifted(this BinaryOperatorKind kind) 139return kind & ~BinaryOperatorKind.Lifted; 142public static BinaryOperatorKind OperatorWithLogical(this BinaryOperatorKind kind) 144return kind & (BinaryOperatorKind.OpMask | BinaryOperatorKind.Logical); 147public static BinaryOperatorKind WithType(this BinaryOperatorKind kind, SpecialType type) 149Debug.Assert(kind == (kind & ~BinaryOperatorKind.TypeMask)); 153return kind | BinaryOperatorKind.Int; 155return kind | BinaryOperatorKind.UInt; 157return kind | BinaryOperatorKind.Long; 159return kind | BinaryOperatorKind.ULong; 183public static BinaryOperatorKind WithType(this BinaryOperatorKind kind, BinaryOperatorKind type) 185Debug.Assert(kind == (kind & ~BinaryOperatorKind.TypeMask)); 186Debug.Assert(type == (type & BinaryOperatorKind.TypeMask)); 190public static bool IsLifted(this BinaryOperatorKind kind) 192return 0 != (kind & BinaryOperatorKind.Lifted); 195public static bool IsDynamic(this BinaryOperatorKind kind) 197return kind.OperandTypes() == BinaryOperatorKind.Dynamic; 200public static bool IsComparison(this BinaryOperatorKind kind) 204case BinaryOperatorKind.Equal: 205case BinaryOperatorKind.NotEqual: 206case BinaryOperatorKind.GreaterThan: 207case BinaryOperatorKind.GreaterThanOrEqual: 208case BinaryOperatorKind.LessThan: 209case BinaryOperatorKind.LessThanOrEqual: 215public static bool IsChecked(this BinaryOperatorKind kind) 217return 0 != (kind & BinaryOperatorKind.Checked); 220public static bool EmitsAsCheckedInstruction(this BinaryOperatorKind kind) 229case BinaryOperatorKind.Addition: 230case BinaryOperatorKind.Subtraction: 231case BinaryOperatorKind.Multiplication: 238public static BinaryOperatorKind WithOverflowChecksIfApplicable(this BinaryOperatorKind kind, bool enabled) 246return kind | BinaryOperatorKind.Checked; 253case BinaryOperatorKind.Addition: 254case BinaryOperatorKind.Subtraction: 255case BinaryOperatorKind.Multiplication: 256case BinaryOperatorKind.Division: 257return kind | BinaryOperatorKind.Checked; 264return kind & ~BinaryOperatorKind.Checked; 268public static bool IsEnum(this BinaryOperatorKind kind) 272case BinaryOperatorKind.Enum: 273case BinaryOperatorKind.EnumAndUnderlying: 274case BinaryOperatorKind.UnderlyingAndEnum: 286public static bool IsIntegral(this BinaryOperatorKind kind) 290case BinaryOperatorKind.Int: 291case BinaryOperatorKind.UInt: 292case BinaryOperatorKind.Long: 293case BinaryOperatorKind.ULong: 294case BinaryOperatorKind.NInt: 295case BinaryOperatorKind.NUInt: 296case BinaryOperatorKind.Char: 297case BinaryOperatorKind.Enum: 298case BinaryOperatorKind.EnumAndUnderlying: 299case BinaryOperatorKind.UnderlyingAndEnum: 300case BinaryOperatorKind.Pointer: 301case BinaryOperatorKind.PointerAndInt: 302case BinaryOperatorKind.PointerAndUInt: 303case BinaryOperatorKind.PointerAndLong: 304case BinaryOperatorKind.PointerAndULong: 305case BinaryOperatorKind.IntAndPointer: 306case BinaryOperatorKind.UIntAndPointer: 307case BinaryOperatorKind.LongAndPointer: 308case BinaryOperatorKind.ULongAndPointer: 315public static bool IsLogical(this BinaryOperatorKind kind) 317return 0 != (kind & BinaryOperatorKind.Logical); 320public static BinaryOperatorKind OperandTypes(this BinaryOperatorKind kind) 322return kind & BinaryOperatorKind.TypeMask; 325public static bool IsUserDefined(this BinaryOperatorKind kind) 327return (kind & BinaryOperatorKind.TypeMask) == BinaryOperatorKind.UserDefined; 330public static bool IsShift(this BinaryOperatorKind kind) 332BinaryOperatorKind type = kind.Operator(); 333return type == BinaryOperatorKind.LeftShift || type == BinaryOperatorKind.RightShift || type == BinaryOperatorKind.UnsignedRightShift; 336public static ExpressionType ToExpressionType(this BinaryOperatorKind kind, bool isCompoundAssignment) 342case BinaryOperatorKind.Multiplication: return ExpressionType.MultiplyAssign; 343case BinaryOperatorKind.Addition: return ExpressionType.AddAssign; 344case BinaryOperatorKind.Subtraction: return ExpressionType.SubtractAssign; 345case BinaryOperatorKind.Division: return ExpressionType.DivideAssign; 346case BinaryOperatorKind.Remainder: return ExpressionType.ModuloAssign; 347case BinaryOperatorKind.LeftShift: return ExpressionType.LeftShiftAssign; 348case BinaryOperatorKind.RightShift: return ExpressionType.RightShiftAssign; 349case BinaryOperatorKind.And: return ExpressionType.AndAssign; 350case BinaryOperatorKind.Xor: return ExpressionType.ExclusiveOrAssign; 351case BinaryOperatorKind.Or: return ExpressionType.OrAssign; 358case BinaryOperatorKind.Multiplication: return ExpressionType.Multiply; 359case BinaryOperatorKind.Addition: return ExpressionType.Add; 360case BinaryOperatorKind.Subtraction: return ExpressionType.Subtract; 361case BinaryOperatorKind.Division: return ExpressionType.Divide; 362case BinaryOperatorKind.Remainder: return ExpressionType.Modulo; 363case BinaryOperatorKind.LeftShift: return ExpressionType.LeftShift; 364case BinaryOperatorKind.RightShift: return ExpressionType.RightShift; 365case BinaryOperatorKind.Equal: return ExpressionType.Equal; 366case BinaryOperatorKind.NotEqual: return ExpressionType.NotEqual; 367case BinaryOperatorKind.GreaterThan: return ExpressionType.GreaterThan; 368case BinaryOperatorKind.LessThan: return ExpressionType.LessThan; 369case BinaryOperatorKind.GreaterThanOrEqual: return ExpressionType.GreaterThanOrEqual; 370case BinaryOperatorKind.LessThanOrEqual: return ExpressionType.LessThanOrEqual; 371case BinaryOperatorKind.And: return ExpressionType.And; 372case BinaryOperatorKind.Xor: return ExpressionType.ExclusiveOr; 373case BinaryOperatorKind.Or: return ExpressionType.Or; 404public static string Dump(this BinaryOperatorKind kind) 407if ((kind & BinaryOperatorKind.Lifted) != 0) b.Append("Lifted"); 408if ((kind & BinaryOperatorKind.Logical) != 0) b.Append("Logical"); 409if ((kind & BinaryOperatorKind.Checked) != 0) b.Append("Checked"); 410var type = kind & BinaryOperatorKind.TypeMask; 412var op = kind & BinaryOperatorKind.OpMask;
BoundTree\BoundDagRelationalTest.cs (1)
9public BinaryOperatorKind Relation => OperatorKind.Operator();
BoundTree\BoundDagTest.cs (4)
124BinaryOperatorKind.LessThan => "<", 125BinaryOperatorKind.LessThanOrEqual => "<=", 126BinaryOperatorKind.GreaterThan => ">", 127BinaryOperatorKind.GreaterThanOrEqual => ">=",
BoundTree\BoundNode_Source.cs (5)
462string relation = (relationalPattern.Relation & BinaryOperatorKind.OpMask) switch 464BinaryOperatorKind.GreaterThan => ">", 465BinaryOperatorKind.GreaterThanOrEqual => ">=", 466BinaryOperatorKind.LessThan => "<", 467BinaryOperatorKind.LessThanOrEqual => "<=",
BoundTree\Constructors.cs (3)
414BinaryOperatorKind operatorKind, 437BinaryOperatorKind operatorKind, 450public BoundBinaryOperator Update(BinaryOperatorKind operatorKind,
BoundTree\TupleBinaryOperatorInfo.cs (4)
47internal readonly BinaryOperatorKind Kind; 59BinaryOperatorKind kind, 140internal readonly BinaryOperatorKind Kind; 142internal NullNull(BinaryOperatorKind kind)
CodeGen\EmitConversion.cs (1)
163(fromPredefTypeKind == Cci.PrimitiveTypeCode.IntPtr && conversion.Operand is BoundBinaryOperator { OperatorKind: BinaryOperatorKind.Division })); // pointer subtraction: see LocalRewriter.RewritePointerSubtraction()
CodeGen\EmitOperators.cs (75)
60var operatorKind = expression.OperatorKind; 101var operatorKind = binary.OperatorKind; 179case BinaryOperatorKind.Multiplication: 183case BinaryOperatorKind.Addition: 187case BinaryOperatorKind.Subtraction: 191case BinaryOperatorKind.Division: 202case BinaryOperatorKind.Remainder: 213case BinaryOperatorKind.LeftShift: 217case BinaryOperatorKind.RightShift: 228case BinaryOperatorKind.UnsignedRightShift: 232case BinaryOperatorKind.And: 236case BinaryOperatorKind.Xor: 240case BinaryOperatorKind.Or: 304case BinaryOperatorKind.LogicalOr: 311goto case BinaryOperatorKind.LogicalAnd; 313case BinaryOperatorKind.LogicalAnd: 330case BinaryOperatorKind.And: 336case BinaryOperatorKind.Or: 342case BinaryOperatorKind.Xor: 353case BinaryOperatorKind.NotEqual: 356goto case BinaryOperatorKind.Equal; 358case BinaryOperatorKind.Equal: 419case BinaryOperatorKind.LessThan: 423case BinaryOperatorKind.LessThanOrEqual: 428case BinaryOperatorKind.GreaterThan: 432case BinaryOperatorKind.GreaterThanOrEqual: 651case BinaryOperatorKind.EnumAndUnderlyingAddition: 652case BinaryOperatorKind.EnumSubtraction: 653case BinaryOperatorKind.EnumAndUnderlyingSubtraction: 656case BinaryOperatorKind.EnumAnd: 657case BinaryOperatorKind.EnumOr: 658case BinaryOperatorKind.EnumXor: 662case BinaryOperatorKind.UnderlyingAndEnumSubtraction: 663case BinaryOperatorKind.UnderlyingAndEnumAddition: 702case BinaryOperatorKind.Multiplication: 713case BinaryOperatorKind.Addition: 724case BinaryOperatorKind.Subtraction: 740private static bool OperatorHasSideEffects(BinaryOperatorKind kind) 744case BinaryOperatorKind.Division: 745case BinaryOperatorKind.Remainder: 778BinaryOperatorKind opKind = op.OperatorKind; 779Debug.Assert(opKind.Operator() != BinaryOperatorKind.UnsignedRightShift); 781BinaryOperatorKind type = opKind.OperandTypes(); 784case BinaryOperatorKind.Enum: 785case BinaryOperatorKind.EnumAndUnderlying: 788case BinaryOperatorKind.UnderlyingAndEnum: 791case BinaryOperatorKind.UInt: 792case BinaryOperatorKind.NUInt: 793case BinaryOperatorKind.ULong: 794case BinaryOperatorKind.ULongAndPointer: 795case BinaryOperatorKind.PointerAndInt: 796case BinaryOperatorKind.PointerAndUInt: 797case BinaryOperatorKind.PointerAndLong: 798case BinaryOperatorKind.PointerAndULong: 799case BinaryOperatorKind.Pointer: 803case BinaryOperatorKind.IntAndPointer: 804case BinaryOperatorKind.LongAndPointer: 806case BinaryOperatorKind.UIntAndPointer: 812private static bool IsConditional(BinaryOperatorKind opKind) 816case BinaryOperatorKind.LogicalAnd: 817case BinaryOperatorKind.LogicalOr: 818case BinaryOperatorKind.Equal: 819case BinaryOperatorKind.NotEqual: 820case BinaryOperatorKind.LessThan: 821case BinaryOperatorKind.LessThanOrEqual: 822case BinaryOperatorKind.GreaterThan: 823case BinaryOperatorKind.GreaterThanOrEqual: 826case BinaryOperatorKind.And: 827case BinaryOperatorKind.Or: 828case BinaryOperatorKind.Xor: 829return opKind.OperandTypes() == BinaryOperatorKind.Bool; 835private static bool IsFloat(BinaryOperatorKind opKind) 837var type = opKind.OperandTypes(); 840case BinaryOperatorKind.Float: 841case BinaryOperatorKind.Double:
CodeGen\EmitStatement.cs (24)
230var opKind = condition.OperatorKind.Operator(); 232Debug.Assert(opKind == BinaryOperatorKind.Equal || 233opKind == BinaryOperatorKind.NotEqual); 274if (opKind == BinaryOperatorKind.NotEqual) 305case BinaryOperatorKind.Equal: 309case BinaryOperatorKind.NotEqual: 313case BinaryOperatorKind.LessThan: 317case BinaryOperatorKind.LessThanOrEqual: 321case BinaryOperatorKind.GreaterThan: 325case BinaryOperatorKind.GreaterThanOrEqual: 424if (binOp.OperatorKind.OperatorWithLogical() is BinaryOperatorKind.LogicalOr or BinaryOperatorKind.LogicalAnd) 445binary.OperatorKind.OperatorWithLogical() is BinaryOperatorKind.LogicalOr or BinaryOperatorKind.LogicalAnd) 447if (binary.OperatorKind.OperatorWithLogical() is BinaryOperatorKind.LogicalOr ? !top.sense : top.sense) 494case BinaryOperatorKind.LogicalOr: 495case BinaryOperatorKind.LogicalAnd: 498case BinaryOperatorKind.Equal: 499case BinaryOperatorKind.NotEqual: 507goto case BinaryOperatorKind.LessThan; 509case BinaryOperatorKind.LessThan: 510case BinaryOperatorKind.LessThanOrEqual: 511case BinaryOperatorKind.GreaterThan: 512case BinaryOperatorKind.GreaterThanOrEqual:
CodeGen\Optimizer.cs (2)
1519var isLogical = (binary.OperatorKind & BinaryOperatorKind.Logical) != 0; 1558var isLogical = (node.OperatorKind & BinaryOperatorKind.Logical) != 0;
Compilation\BuiltInOperators.cs (368)
297builder.Add(GetSignature((BinaryOperatorKind)kind)); 303internal void GetSimpleBuiltInOperators(BinaryOperatorKind kind, ArrayBuilder<BinaryOperatorSignature> operators, bool skipNativeIntegerOperators) 322ImmutableArray.Create<BinaryOperatorSignature>(GetSignature(BinaryOperatorKind.LogicalBoolAnd)), //and 324ImmutableArray.Create<BinaryOperatorSignature>(GetSignature(BinaryOperatorKind.LogicalBoolOr)), //or 332(int)BinaryOperatorKind.IntMultiplication, 333(int)BinaryOperatorKind.UIntMultiplication, 334(int)BinaryOperatorKind.LongMultiplication, 335(int)BinaryOperatorKind.ULongMultiplication, 336(int)BinaryOperatorKind.NIntMultiplication, 337(int)BinaryOperatorKind.NUIntMultiplication, 338(int)BinaryOperatorKind.FloatMultiplication, 339(int)BinaryOperatorKind.DoubleMultiplication, 340(int)BinaryOperatorKind.DecimalMultiplication, 341(int)BinaryOperatorKind.LiftedIntMultiplication, 342(int)BinaryOperatorKind.LiftedUIntMultiplication, 343(int)BinaryOperatorKind.LiftedLongMultiplication, 344(int)BinaryOperatorKind.LiftedULongMultiplication, 345(int)BinaryOperatorKind.LiftedNIntMultiplication, 346(int)BinaryOperatorKind.LiftedNUIntMultiplication, 347(int)BinaryOperatorKind.LiftedFloatMultiplication, 348(int)BinaryOperatorKind.LiftedDoubleMultiplication, 349(int)BinaryOperatorKind.LiftedDecimalMultiplication, 353(int)BinaryOperatorKind.IntAddition, 354(int)BinaryOperatorKind.UIntAddition, 355(int)BinaryOperatorKind.LongAddition, 356(int)BinaryOperatorKind.ULongAddition, 357(int)BinaryOperatorKind.NIntAddition, 358(int)BinaryOperatorKind.NUIntAddition, 359(int)BinaryOperatorKind.FloatAddition, 360(int)BinaryOperatorKind.DoubleAddition, 361(int)BinaryOperatorKind.DecimalAddition, 362(int)BinaryOperatorKind.LiftedIntAddition, 363(int)BinaryOperatorKind.LiftedUIntAddition, 364(int)BinaryOperatorKind.LiftedLongAddition, 365(int)BinaryOperatorKind.LiftedULongAddition, 366(int)BinaryOperatorKind.LiftedNIntAddition, 367(int)BinaryOperatorKind.LiftedNUIntAddition, 368(int)BinaryOperatorKind.LiftedFloatAddition, 369(int)BinaryOperatorKind.LiftedDoubleAddition, 370(int)BinaryOperatorKind.LiftedDecimalAddition, 371(int)BinaryOperatorKind.StringConcatenation, 372(int)BinaryOperatorKind.StringAndObjectConcatenation, 373(int)BinaryOperatorKind.ObjectAndStringConcatenation, 377(int)BinaryOperatorKind.IntSubtraction, 378(int)BinaryOperatorKind.UIntSubtraction, 379(int)BinaryOperatorKind.LongSubtraction, 380(int)BinaryOperatorKind.ULongSubtraction, 381(int)BinaryOperatorKind.NIntSubtraction, 382(int)BinaryOperatorKind.NUIntSubtraction, 383(int)BinaryOperatorKind.FloatSubtraction, 384(int)BinaryOperatorKind.DoubleSubtraction, 385(int)BinaryOperatorKind.DecimalSubtraction, 386(int)BinaryOperatorKind.LiftedIntSubtraction, 387(int)BinaryOperatorKind.LiftedUIntSubtraction, 388(int)BinaryOperatorKind.LiftedLongSubtraction, 389(int)BinaryOperatorKind.LiftedULongSubtraction, 390(int)BinaryOperatorKind.LiftedNIntSubtraction, 391(int)BinaryOperatorKind.LiftedNUIntSubtraction, 392(int)BinaryOperatorKind.LiftedFloatSubtraction, 393(int)BinaryOperatorKind.LiftedDoubleSubtraction, 394(int)BinaryOperatorKind.LiftedDecimalSubtraction, 398(int)BinaryOperatorKind.IntDivision, 399(int)BinaryOperatorKind.UIntDivision, 400(int)BinaryOperatorKind.LongDivision, 401(int)BinaryOperatorKind.ULongDivision, 402(int)BinaryOperatorKind.NIntDivision, 403(int)BinaryOperatorKind.NUIntDivision, 404(int)BinaryOperatorKind.FloatDivision, 405(int)BinaryOperatorKind.DoubleDivision, 406(int)BinaryOperatorKind.DecimalDivision, 407(int)BinaryOperatorKind.LiftedIntDivision, 408(int)BinaryOperatorKind.LiftedUIntDivision, 409(int)BinaryOperatorKind.LiftedLongDivision, 410(int)BinaryOperatorKind.LiftedULongDivision, 411(int)BinaryOperatorKind.LiftedNIntDivision, 412(int)BinaryOperatorKind.LiftedNUIntDivision, 413(int)BinaryOperatorKind.LiftedFloatDivision, 414(int)BinaryOperatorKind.LiftedDoubleDivision, 415(int)BinaryOperatorKind.LiftedDecimalDivision, 419(int)BinaryOperatorKind.IntRemainder, 420(int)BinaryOperatorKind.UIntRemainder, 421(int)BinaryOperatorKind.LongRemainder, 422(int)BinaryOperatorKind.ULongRemainder, 423(int)BinaryOperatorKind.NIntRemainder, 424(int)BinaryOperatorKind.NUIntRemainder, 425(int)BinaryOperatorKind.FloatRemainder, 426(int)BinaryOperatorKind.DoubleRemainder, 427(int)BinaryOperatorKind.DecimalRemainder, 428(int)BinaryOperatorKind.LiftedIntRemainder, 429(int)BinaryOperatorKind.LiftedUIntRemainder, 430(int)BinaryOperatorKind.LiftedLongRemainder, 431(int)BinaryOperatorKind.LiftedULongRemainder, 432(int)BinaryOperatorKind.LiftedNIntRemainder, 433(int)BinaryOperatorKind.LiftedNUIntRemainder, 434(int)BinaryOperatorKind.LiftedFloatRemainder, 435(int)BinaryOperatorKind.LiftedDoubleRemainder, 436(int)BinaryOperatorKind.LiftedDecimalRemainder, 440(int)BinaryOperatorKind.IntLeftShift, 441(int)BinaryOperatorKind.UIntLeftShift, 442(int)BinaryOperatorKind.LongLeftShift, 443(int)BinaryOperatorKind.ULongLeftShift, 444(int)BinaryOperatorKind.NIntLeftShift, 445(int)BinaryOperatorKind.NUIntLeftShift, 446(int)BinaryOperatorKind.LiftedIntLeftShift, 447(int)BinaryOperatorKind.LiftedUIntLeftShift, 448(int)BinaryOperatorKind.LiftedLongLeftShift, 449(int)BinaryOperatorKind.LiftedULongLeftShift, 450(int)BinaryOperatorKind.LiftedNIntLeftShift, 451(int)BinaryOperatorKind.LiftedNUIntLeftShift, 455(int)BinaryOperatorKind.IntRightShift, 456(int)BinaryOperatorKind.UIntRightShift, 457(int)BinaryOperatorKind.LongRightShift, 458(int)BinaryOperatorKind.ULongRightShift, 459(int)BinaryOperatorKind.NIntRightShift, 460(int)BinaryOperatorKind.NUIntRightShift, 461(int)BinaryOperatorKind.LiftedIntRightShift, 462(int)BinaryOperatorKind.LiftedUIntRightShift, 463(int)BinaryOperatorKind.LiftedLongRightShift, 464(int)BinaryOperatorKind.LiftedULongRightShift, 465(int)BinaryOperatorKind.LiftedNIntRightShift, 466(int)BinaryOperatorKind.LiftedNUIntRightShift, 470(int)BinaryOperatorKind.IntEqual, 471(int)BinaryOperatorKind.UIntEqual, 472(int)BinaryOperatorKind.LongEqual, 473(int)BinaryOperatorKind.ULongEqual, 474(int)BinaryOperatorKind.NIntEqual, 475(int)BinaryOperatorKind.NUIntEqual, 476(int)BinaryOperatorKind.FloatEqual, 477(int)BinaryOperatorKind.DoubleEqual, 478(int)BinaryOperatorKind.DecimalEqual, 479(int)BinaryOperatorKind.BoolEqual, 480(int)BinaryOperatorKind.LiftedIntEqual, 481(int)BinaryOperatorKind.LiftedUIntEqual, 482(int)BinaryOperatorKind.LiftedLongEqual, 483(int)BinaryOperatorKind.LiftedULongEqual, 484(int)BinaryOperatorKind.LiftedNIntEqual, 485(int)BinaryOperatorKind.LiftedNUIntEqual, 486(int)BinaryOperatorKind.LiftedFloatEqual, 487(int)BinaryOperatorKind.LiftedDoubleEqual, 488(int)BinaryOperatorKind.LiftedDecimalEqual, 489(int)BinaryOperatorKind.LiftedBoolEqual, 490(int)BinaryOperatorKind.ObjectEqual, 491(int)BinaryOperatorKind.StringEqual, 495(int)BinaryOperatorKind.IntNotEqual, 496(int)BinaryOperatorKind.UIntNotEqual, 497(int)BinaryOperatorKind.LongNotEqual, 498(int)BinaryOperatorKind.ULongNotEqual, 499(int)BinaryOperatorKind.NIntNotEqual, 500(int)BinaryOperatorKind.NUIntNotEqual, 501(int)BinaryOperatorKind.FloatNotEqual, 502(int)BinaryOperatorKind.DoubleNotEqual, 503(int)BinaryOperatorKind.DecimalNotEqual, 504(int)BinaryOperatorKind.BoolNotEqual, 505(int)BinaryOperatorKind.LiftedIntNotEqual, 506(int)BinaryOperatorKind.LiftedUIntNotEqual, 507(int)BinaryOperatorKind.LiftedLongNotEqual, 508(int)BinaryOperatorKind.LiftedULongNotEqual, 509(int)BinaryOperatorKind.LiftedNIntNotEqual, 510(int)BinaryOperatorKind.LiftedNUIntNotEqual, 511(int)BinaryOperatorKind.LiftedFloatNotEqual, 512(int)BinaryOperatorKind.LiftedDoubleNotEqual, 513(int)BinaryOperatorKind.LiftedDecimalNotEqual, 514(int)BinaryOperatorKind.LiftedBoolNotEqual, 515(int)BinaryOperatorKind.ObjectNotEqual, 516(int)BinaryOperatorKind.StringNotEqual, 520(int)BinaryOperatorKind.IntGreaterThan, 521(int)BinaryOperatorKind.UIntGreaterThan, 522(int)BinaryOperatorKind.LongGreaterThan, 523(int)BinaryOperatorKind.ULongGreaterThan, 524(int)BinaryOperatorKind.NIntGreaterThan, 525(int)BinaryOperatorKind.NUIntGreaterThan, 526(int)BinaryOperatorKind.FloatGreaterThan, 527(int)BinaryOperatorKind.DoubleGreaterThan, 528(int)BinaryOperatorKind.DecimalGreaterThan, 529(int)BinaryOperatorKind.LiftedIntGreaterThan, 530(int)BinaryOperatorKind.LiftedUIntGreaterThan, 531(int)BinaryOperatorKind.LiftedLongGreaterThan, 532(int)BinaryOperatorKind.LiftedULongGreaterThan, 533(int)BinaryOperatorKind.LiftedNIntGreaterThan, 534(int)BinaryOperatorKind.LiftedNUIntGreaterThan, 535(int)BinaryOperatorKind.LiftedFloatGreaterThan, 536(int)BinaryOperatorKind.LiftedDoubleGreaterThan, 537(int)BinaryOperatorKind.LiftedDecimalGreaterThan, 541(int)BinaryOperatorKind.IntLessThan, 542(int)BinaryOperatorKind.UIntLessThan, 543(int)BinaryOperatorKind.LongLessThan, 544(int)BinaryOperatorKind.ULongLessThan, 545(int)BinaryOperatorKind.NIntLessThan, 546(int)BinaryOperatorKind.NUIntLessThan, 547(int)BinaryOperatorKind.FloatLessThan, 548(int)BinaryOperatorKind.DoubleLessThan, 549(int)BinaryOperatorKind.DecimalLessThan, 550(int)BinaryOperatorKind.LiftedIntLessThan, 551(int)BinaryOperatorKind.LiftedUIntLessThan, 552(int)BinaryOperatorKind.LiftedLongLessThan, 553(int)BinaryOperatorKind.LiftedULongLessThan, 554(int)BinaryOperatorKind.LiftedNIntLessThan, 555(int)BinaryOperatorKind.LiftedNUIntLessThan, 556(int)BinaryOperatorKind.LiftedFloatLessThan, 557(int)BinaryOperatorKind.LiftedDoubleLessThan, 558(int)BinaryOperatorKind.LiftedDecimalLessThan, 562(int)BinaryOperatorKind.IntGreaterThanOrEqual, 563(int)BinaryOperatorKind.UIntGreaterThanOrEqual, 564(int)BinaryOperatorKind.LongGreaterThanOrEqual, 565(int)BinaryOperatorKind.ULongGreaterThanOrEqual, 566(int)BinaryOperatorKind.NIntGreaterThanOrEqual, 567(int)BinaryOperatorKind.NUIntGreaterThanOrEqual, 568(int)BinaryOperatorKind.FloatGreaterThanOrEqual, 569(int)BinaryOperatorKind.DoubleGreaterThanOrEqual, 570(int)BinaryOperatorKind.DecimalGreaterThanOrEqual, 571(int)BinaryOperatorKind.LiftedIntGreaterThanOrEqual, 572(int)BinaryOperatorKind.LiftedUIntGreaterThanOrEqual, 573(int)BinaryOperatorKind.LiftedLongGreaterThanOrEqual, 574(int)BinaryOperatorKind.LiftedULongGreaterThanOrEqual, 575(int)BinaryOperatorKind.LiftedNIntGreaterThanOrEqual, 576(int)BinaryOperatorKind.LiftedNUIntGreaterThanOrEqual, 577(int)BinaryOperatorKind.LiftedFloatGreaterThanOrEqual, 578(int)BinaryOperatorKind.LiftedDoubleGreaterThanOrEqual, 579(int)BinaryOperatorKind.LiftedDecimalGreaterThanOrEqual, 583(int)BinaryOperatorKind.IntLessThanOrEqual, 584(int)BinaryOperatorKind.UIntLessThanOrEqual, 585(int)BinaryOperatorKind.LongLessThanOrEqual, 586(int)BinaryOperatorKind.ULongLessThanOrEqual, 587(int)BinaryOperatorKind.NIntLessThanOrEqual, 588(int)BinaryOperatorKind.NUIntLessThanOrEqual, 589(int)BinaryOperatorKind.FloatLessThanOrEqual, 590(int)BinaryOperatorKind.DoubleLessThanOrEqual, 591(int)BinaryOperatorKind.DecimalLessThanOrEqual, 592(int)BinaryOperatorKind.LiftedIntLessThanOrEqual, 593(int)BinaryOperatorKind.LiftedUIntLessThanOrEqual, 594(int)BinaryOperatorKind.LiftedLongLessThanOrEqual, 595(int)BinaryOperatorKind.LiftedULongLessThanOrEqual, 596(int)BinaryOperatorKind.LiftedNIntLessThanOrEqual, 597(int)BinaryOperatorKind.LiftedNUIntLessThanOrEqual, 598(int)BinaryOperatorKind.LiftedFloatLessThanOrEqual, 599(int)BinaryOperatorKind.LiftedDoubleLessThanOrEqual, 600(int)BinaryOperatorKind.LiftedDecimalLessThanOrEqual, 604(int)BinaryOperatorKind.IntAnd, 605(int)BinaryOperatorKind.UIntAnd, 606(int)BinaryOperatorKind.LongAnd, 607(int)BinaryOperatorKind.ULongAnd, 608(int)BinaryOperatorKind.NIntAnd, 609(int)BinaryOperatorKind.NUIntAnd, 610(int)BinaryOperatorKind.BoolAnd, 611(int)BinaryOperatorKind.LiftedIntAnd, 612(int)BinaryOperatorKind.LiftedUIntAnd, 613(int)BinaryOperatorKind.LiftedLongAnd, 614(int)BinaryOperatorKind.LiftedULongAnd, 615(int)BinaryOperatorKind.LiftedNIntAnd, 616(int)BinaryOperatorKind.LiftedNUIntAnd, 617(int)BinaryOperatorKind.LiftedBoolAnd, 621(int)BinaryOperatorKind.IntXor, 622(int)BinaryOperatorKind.UIntXor, 623(int)BinaryOperatorKind.LongXor, 624(int)BinaryOperatorKind.ULongXor, 625(int)BinaryOperatorKind.NIntXor, 626(int)BinaryOperatorKind.NUIntXor, 627(int)BinaryOperatorKind.BoolXor, 628(int)BinaryOperatorKind.LiftedIntXor, 629(int)BinaryOperatorKind.LiftedUIntXor, 630(int)BinaryOperatorKind.LiftedLongXor, 631(int)BinaryOperatorKind.LiftedULongXor, 632(int)BinaryOperatorKind.LiftedNIntXor, 633(int)BinaryOperatorKind.LiftedNUIntXor, 634(int)BinaryOperatorKind.LiftedBoolXor, 638(int)BinaryOperatorKind.IntOr, 639(int)BinaryOperatorKind.UIntOr, 640(int)BinaryOperatorKind.LongOr, 641(int)BinaryOperatorKind.ULongOr, 642(int)BinaryOperatorKind.NIntOr, 643(int)BinaryOperatorKind.NUIntOr, 644(int)BinaryOperatorKind.BoolOr, 645(int)BinaryOperatorKind.LiftedIntOr, 646(int)BinaryOperatorKind.LiftedUIntOr, 647(int)BinaryOperatorKind.LiftedLongOr, 648(int)BinaryOperatorKind.LiftedULongOr, 649(int)BinaryOperatorKind.LiftedNIntOr, 650(int)BinaryOperatorKind.LiftedNUIntOr, 651(int)BinaryOperatorKind.LiftedBoolOr, 655(int)BinaryOperatorKind.IntUnsignedRightShift, 656(int)BinaryOperatorKind.UIntUnsignedRightShift, 657(int)BinaryOperatorKind.LongUnsignedRightShift, 658(int)BinaryOperatorKind.ULongUnsignedRightShift, 659(int)BinaryOperatorKind.NIntUnsignedRightShift, 660(int)BinaryOperatorKind.NUIntUnsignedRightShift, 661(int)BinaryOperatorKind.LiftedIntUnsignedRightShift, 662(int)BinaryOperatorKind.LiftedUIntUnsignedRightShift, 663(int)BinaryOperatorKind.LiftedLongUnsignedRightShift, 664(int)BinaryOperatorKind.LiftedULongUnsignedRightShift, 665(int)BinaryOperatorKind.LiftedNIntUnsignedRightShift, 666(int)BinaryOperatorKind.LiftedNUIntUnsignedRightShift, 681case BinaryOperatorKind.NInt: 682case BinaryOperatorKind.NUInt: 696static readonlySpanOfByte => new BinaryOperatorSignature(BinaryOperatorKind.Utf8Addition, readonlySpanOfByte, readonlySpanOfByte, readonlySpanOfByte), 702internal BinaryOperatorSignature GetSignature(BinaryOperatorKind kind) 707case BinaryOperatorKind.Multiplication: 708case BinaryOperatorKind.Division: 709case BinaryOperatorKind.Subtraction: 710case BinaryOperatorKind.Remainder: 711case BinaryOperatorKind.And: 712case BinaryOperatorKind.Or: 713case BinaryOperatorKind.Xor: 715case BinaryOperatorKind.Addition: 717case BinaryOperatorKind.LeftShift: 718case BinaryOperatorKind.RightShift: 719case BinaryOperatorKind.UnsignedRightShift: 727case BinaryOperatorKind.Equal: 728case BinaryOperatorKind.NotEqual: 729case BinaryOperatorKind.GreaterThan: 730case BinaryOperatorKind.LessThan: 731case BinaryOperatorKind.GreaterThanOrEqual: 732case BinaryOperatorKind.LessThanOrEqual: 738private TypeSymbol LeftType(BinaryOperatorKind kind) 748case BinaryOperatorKind.Int: return _compilation.GetSpecialType(SpecialType.System_Int32); 749case BinaryOperatorKind.UInt: return _compilation.GetSpecialType(SpecialType.System_UInt32); 750case BinaryOperatorKind.Long: return _compilation.GetSpecialType(SpecialType.System_Int64); 751case BinaryOperatorKind.ULong: return _compilation.GetSpecialType(SpecialType.System_UInt64); 752case BinaryOperatorKind.NInt: return _compilation.CreateNativeIntegerTypeSymbol(signed: true); 753case BinaryOperatorKind.NUInt: return _compilation.CreateNativeIntegerTypeSymbol(signed: false); 754case BinaryOperatorKind.Float: return _compilation.GetSpecialType(SpecialType.System_Single); 755case BinaryOperatorKind.Double: return _compilation.GetSpecialType(SpecialType.System_Double); 756case BinaryOperatorKind.Decimal: return _compilation.GetSpecialType(SpecialType.System_Decimal); 757case BinaryOperatorKind.Bool: return _compilation.GetSpecialType(SpecialType.System_Boolean); 758case BinaryOperatorKind.ObjectAndString: 759case BinaryOperatorKind.Object: 761case BinaryOperatorKind.String: 762case BinaryOperatorKind.StringAndObject: 770private TypeSymbol RightType(BinaryOperatorKind kind) 780case BinaryOperatorKind.Int: return _compilation.GetSpecialType(SpecialType.System_Int32); 781case BinaryOperatorKind.UInt: return _compilation.GetSpecialType(SpecialType.System_UInt32); 782case BinaryOperatorKind.Long: return _compilation.GetSpecialType(SpecialType.System_Int64); 783case BinaryOperatorKind.ULong: return _compilation.GetSpecialType(SpecialType.System_UInt64); 784case BinaryOperatorKind.NInt: return _compilation.CreateNativeIntegerTypeSymbol(signed: true); 785case BinaryOperatorKind.NUInt: return _compilation.CreateNativeIntegerTypeSymbol(signed: false); 786case BinaryOperatorKind.Float: return _compilation.GetSpecialType(SpecialType.System_Single); 787case BinaryOperatorKind.Double: return _compilation.GetSpecialType(SpecialType.System_Double); 788case BinaryOperatorKind.Decimal: return _compilation.GetSpecialType(SpecialType.System_Decimal); 789case BinaryOperatorKind.Bool: return _compilation.GetSpecialType(SpecialType.System_Boolean); 790case BinaryOperatorKind.ObjectAndString: 791case BinaryOperatorKind.String: 793case BinaryOperatorKind.StringAndObject: 794case BinaryOperatorKind.Object: 802private TypeSymbol ReturnType(BinaryOperatorKind kind) 812case BinaryOperatorKind.Int: return _compilation.GetSpecialType(SpecialType.System_Int32); 813case BinaryOperatorKind.UInt: return _compilation.GetSpecialType(SpecialType.System_UInt32); 814case BinaryOperatorKind.Long: return _compilation.GetSpecialType(SpecialType.System_Int64); 815case BinaryOperatorKind.ULong: return _compilation.GetSpecialType(SpecialType.System_UInt64); 816case BinaryOperatorKind.NInt: return _compilation.CreateNativeIntegerTypeSymbol(signed: true); 817case BinaryOperatorKind.NUInt: return _compilation.CreateNativeIntegerTypeSymbol(signed: false); 818case BinaryOperatorKind.Float: return _compilation.GetSpecialType(SpecialType.System_Single); 819case BinaryOperatorKind.Double: return _compilation.GetSpecialType(SpecialType.System_Double); 820case BinaryOperatorKind.Decimal: return _compilation.GetSpecialType(SpecialType.System_Decimal); 821case BinaryOperatorKind.Bool: return _compilation.GetSpecialType(SpecialType.System_Boolean); 822case BinaryOperatorKind.Object: return _compilation.GetSpecialType(SpecialType.System_Object); 823case BinaryOperatorKind.ObjectAndString: 824case BinaryOperatorKind.StringAndObject: 825case BinaryOperatorKind.String: 833private TypeSymbol LiftedType(BinaryOperatorKind kind) 839BinaryOperatorKind.Int => _compilation.GetSpecialType(SpecialType.System_Int32), 840BinaryOperatorKind.UInt => _compilation.GetSpecialType(SpecialType.System_UInt32), 841BinaryOperatorKind.Long => _compilation.GetSpecialType(SpecialType.System_Int64), 842BinaryOperatorKind.ULong => _compilation.GetSpecialType(SpecialType.System_UInt64), 843BinaryOperatorKind.NInt => _compilation.CreateNativeIntegerTypeSymbol(signed: true), 844BinaryOperatorKind.NUInt => _compilation.CreateNativeIntegerTypeSymbol(signed: false), 845BinaryOperatorKind.Float => _compilation.GetSpecialType(SpecialType.System_Single), 846BinaryOperatorKind.Double => _compilation.GetSpecialType(SpecialType.System_Double), 847BinaryOperatorKind.Decimal => _compilation.GetSpecialType(SpecialType.System_Decimal), 848BinaryOperatorKind.Bool => _compilation.GetSpecialType(SpecialType.System_Boolean),
Compilation\CSharpCompilation.cs (32)
4474var binaryKind = Binder.SyntaxKindToBinaryOperatorKind(SyntaxFacts.GetBinaryExpression(syntaxKind)); 4480var easyOutBinaryKind = OverloadResolution.BinopEasyOut.OpKind(binaryKind, csharpLeftType, csharpRightType); 4482if (easyOutBinaryKind != BinaryOperatorKind.Error) 4498if (binaryKind is BinaryOperatorKind.Equal or BinaryOperatorKind.NotEqual && 4515if (binaryKind is BinaryOperatorKind.Equal or BinaryOperatorKind.NotEqual && 4523if (binaryKind is BinaryOperatorKind.Addition or BinaryOperatorKind.Subtraction && 4538if (binaryKind is BinaryOperatorKind.Equal or 4539BinaryOperatorKind.NotEqual or 4540BinaryOperatorKind.GreaterThan or 4541BinaryOperatorKind.LessThan or 4542BinaryOperatorKind.GreaterThanOrEqual or 4543BinaryOperatorKind.LessThanOrEqual && 4553if (binaryKind is BinaryOperatorKind.And or 4554BinaryOperatorKind.Or or 4555BinaryOperatorKind.Xor && 4566if (binaryKind is BinaryOperatorKind.Addition or BinaryOperatorKind.Subtraction) 4584if (binaryKind is BinaryOperatorKind.Subtraction && 4593if (binaryKind is BinaryOperatorKind.Equal or 4594BinaryOperatorKind.NotEqual or 4595BinaryOperatorKind.GreaterThan or 4596BinaryOperatorKind.LessThan or 4597BinaryOperatorKind.GreaterThanOrEqual or 4598BinaryOperatorKind.LessThanOrEqual && 4607if (binaryKind is BinaryOperatorKind.Addition && 4616if (binaryKind is BinaryOperatorKind.Addition && 4625if (binaryKind is BinaryOperatorKind.Subtraction && 4634if (binaryKind is BinaryOperatorKind.Subtraction && 4643if (binaryKind is BinaryOperatorKind.Addition &&
Compilation\CSharpSemanticModel.cs (9)
3873BinaryOperatorKind operandType = binaryOperator.OperatorKind.OperandTypes(); 3874BinaryOperatorKind op = binaryOperator.OperatorKind.Operator(); 3877if (operandType == 0 || operandType == BinaryOperatorKind.UserDefined || binaryOperator.ResultKind != LookupResultKind.Viable || binaryOperator.OperatorKind.IsLogical()) 3889(op == BinaryOperatorKind.Equal || op == BinaryOperatorKind.NotEqual) && 3915private static Symbol GetIntrinsicOperatorSymbol(BinaryOperatorKind op, bool isDynamic, TypeSymbol leftType, TypeSymbol rightType, TypeSymbol returnType, bool isChecked) 3946BinaryOperatorKind operandType = compoundAssignment.Operator.Kind.OperandTypes(); 3947BinaryOperatorKind op = compoundAssignment.Operator.Kind.Operator(); 3950if (operandType == 0 || operandType == BinaryOperatorKind.UserDefined || compoundAssignment.ResultKind != LookupResultKind.Viable)
Compiler\AnonymousTypeMethodBodySynthesizer.cs (1)
129BoundExpression retExpression = F.Binary(BinaryOperatorKind.ObjectNotEqual,
Compiler\MethodBodySynthesizer.cs (1)
500operatorKind: BinaryOperatorKind.ObjectEqual,
Compiler\MethodBodySynthesizer.Lowered.cs (11)
85F.Binary(BinaryOperatorKind.ObjectNotEqual, F.SpecialType(SpecialType.System_Boolean), 95F.Binary(BinaryOperatorKind.Multiplication, hashCode.Type, 96F.Binary(BinaryOperatorKind.Xor, hashCode.Type, 107F.Binary(BinaryOperatorKind.Addition, i.Type, 112F.Binary(BinaryOperatorKind.LessThan, F.SpecialType(SpecialType.System_Boolean), 182F.Binary(BinaryOperatorKind.Multiplication, hashCode.Type, 183F.Binary(BinaryOperatorKind.Xor, hashCode.Type, 196F.Binary(BinaryOperatorKind.Addition, i.Type, 201F.Binary(BinaryOperatorKind.LessThan, F.SpecialType(SpecialType.System_Boolean), 367currentHashValue = F.Binary(BinaryOperatorKind.IntMultiplication, system_Int32, currentHashValue, boundHashFactor); 370currentHashValue = F.Binary(BinaryOperatorKind.IntAddition,
Emitter\Model\SynthesizedPrivateImplementationDetailsStaticConstructor.cs (1)
55factory.Array(payloadArrayType.ElementType, factory.Binary(BinaryOperatorKind.Addition, factory.SpecialType(SpecialType.System_Int32), factory.MaximumMethodDefIndex(), factory.Literal(1))));
FlowAnalysis\AbstractFlowPass.cs (9)
2533BinaryOperatorKind kind; 2551var op = kind.Operator(); 2552var isAnd = op == BinaryOperatorKind.And; 2553var isBool = kind.OperandTypes() == BinaryOperatorKind.Bool; 2556Debug.Assert(isAnd || op == BinaryOperatorKind.Or); 2704var kind = binary.OperatorKind; 2705return kind.Operator() is BinaryOperatorKind.Equal or BinaryOperatorKind.NotEqual 2717=> binary.OperatorKind.Operator() == BinaryOperatorKind.Equal;
FlowAnalysis\NullableWalker.cs (28)
5340private TypeWithState InferResultNullability(BinaryOperatorKind operatorKind, MethodSymbol? methodOpt, TypeSymbol resultType, TypeWithState leftType, TypeWithState rightType) 5366case BinaryOperatorKind.DelegateCombination: 5369case BinaryOperatorKind.DelegateRemoval: 5397&& binary.OperatorKind.Operator() is BinaryOperatorKind.Equal or BinaryOperatorKind.NotEqual) 5468=> binary.OperatorKind.Operator() == BinaryOperatorKind.Equal; 5500if (binary.OperatorKind.Operator() is not (BinaryOperatorKind.Equal or BinaryOperatorKind.NotEqual)) 5578BinaryOperatorKind operatorKind, 5645&& operatorKind.Operator() is BinaryOperatorKind.GreaterThan or BinaryOperatorKind.GreaterThanOrEqual or BinaryOperatorKind.LessThan or BinaryOperatorKind.LessThanOrEqual) 5782BinaryOperatorKind op = binary.OperatorKind.Operator(); 5784if (op == BinaryOperatorKind.Equal || op == BinaryOperatorKind.NotEqual) 5800bool nonNullCase = op != BinaryOperatorKind.Equal; // true represents WhenTrue 5824case BinaryOperatorKind.Equal: 5825case BinaryOperatorKind.GreaterThan: 5826case BinaryOperatorKind.LessThan: 5827case BinaryOperatorKind.GreaterThanOrEqual: 5828case BinaryOperatorKind.LessThanOrEqual: 5832case BinaryOperatorKind.NotEqual: 12875static void getBinaryConditionalOperatorInfo(BinaryOperatorKind kind, out bool isAnd, out bool isBool) 12877BinaryOperatorKind op = kind.Operator(); 12878isAnd = op == BinaryOperatorKind.And; 12879isBool = kind.OperandTypes() == BinaryOperatorKind.Bool; 12880Debug.Assert(isAnd || op == BinaryOperatorKind.Or);
Generated\BoundNodes.xml.Generated.cs (15)
1688public BoundBinaryOperator(SyntaxNode syntax, BinaryOperatorKind operatorKind, BoundBinaryOperator.UncommonData? data, LookupResultKind resultKind, BoundExpression left, BoundExpression right, TypeSymbol type, bool hasErrors = false) 1705public BinaryOperatorKind OperatorKind { get; } 1712public BoundBinaryOperator Update(BinaryOperatorKind operatorKind, BoundBinaryOperator.UncommonData? data, LookupResultKind resultKind, BoundExpression left, BoundExpression right, TypeSymbol type) 1726public BoundTupleBinaryOperator(SyntaxNode syntax, BoundExpression left, BoundExpression right, BinaryOperatorKind operatorKind, TupleBinaryOperatorInfo.Multiple operators, TypeSymbol type, bool hasErrors = false) 1744public BinaryOperatorKind OperatorKind { get; } 1750public BoundTupleBinaryOperator Update(BoundExpression left, BoundExpression right, BinaryOperatorKind operatorKind, TupleBinaryOperatorInfo.Multiple operators, TypeSymbol type) 1764public BoundUserDefinedConditionalLogicalOperator(SyntaxNode syntax, BinaryOperatorKind operatorKind, MethodSymbol logicalOperator, MethodSymbol trueOperator, MethodSymbol falseOperator, BoundValuePlaceholder? trueFalseOperandPlaceholder, BoundExpression? trueFalseOperandConversion, TypeSymbol? constrainedToTypeOpt, LookupResultKind resultKind, ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt, BoundExpression left, BoundExpression right, TypeSymbol type, bool hasErrors = false) 1790public BinaryOperatorKind OperatorKind { get; } 1803public BoundUserDefinedConditionalLogicalOperator Update(BinaryOperatorKind operatorKind, MethodSymbol logicalOperator, MethodSymbol trueOperator, MethodSymbol falseOperator, BoundValuePlaceholder? trueFalseOperandPlaceholder, BoundExpression? trueFalseOperandConversion, TypeSymbol? constrainedToTypeOpt, LookupResultKind resultKind, ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt, BoundExpression left, BoundExpression right, TypeSymbol type) 5403public BoundDagRelationalTest(SyntaxNode syntax, BinaryOperatorKind operatorKind, ConstantValue value, BoundDagTemp input, bool hasErrors = false) 5414public BinaryOperatorKind OperatorKind { get; } 5420public BoundDagRelationalTest Update(BinaryOperatorKind operatorKind, ConstantValue value, BoundDagTemp input) 8726public BoundRelationalPattern(SyntaxNode syntax, BinaryOperatorKind relation, BoundExpression value, ConstantValue constantValue, bool isUnionMatching, TypeSymbol inputType, TypeSymbol narrowedType, bool hasErrors = false) 8745public BinaryOperatorKind Relation { get; } 8753public BoundRelationalPattern Update(BinaryOperatorKind relation, BoundExpression value, ConstantValue constantValue, bool isUnionMatching, TypeSymbol inputType, TypeSymbol narrowedType)
Lowering\ClosureConversion\ExpressionLambdaRewriter.cs (22)
392private static WellKnownMember GetBinaryOperatorFactory(BinaryOperatorKind opKind, MethodSymbol methodOpt, out bool isChecked, out bool isLifted, out bool requiresLifted) 400case BinaryOperatorKind.Addition: 408case BinaryOperatorKind.Multiplication: 416case BinaryOperatorKind.Subtraction: 424case BinaryOperatorKind.Division: 428case BinaryOperatorKind.Remainder: 432case BinaryOperatorKind.And: 440case BinaryOperatorKind.Xor: 444case BinaryOperatorKind.Or: 452case BinaryOperatorKind.LeftShift: 456case BinaryOperatorKind.RightShift: 460case BinaryOperatorKind.Equal: 464case BinaryOperatorKind.NotEqual: 468case BinaryOperatorKind.LessThan: 472case BinaryOperatorKind.LessThanOrEqual: 476case BinaryOperatorKind.GreaterThan: 480case BinaryOperatorKind.GreaterThanOrEqual: 494private BoundExpression VisitBinaryOperator(BinaryOperatorKind opKind, MethodSymbol methodOpt, TypeSymbol type, BoundExpression left, BoundExpression right) 512case BinaryOperatorKind.EnumAndUnderlying: 513case BinaryOperatorKind.UnderlyingAndEnum: 514case BinaryOperatorKind.Enum: 516var enumOperand = (opKind.OperandTypes() == BinaryOperatorKind.UnderlyingAndEnum) ? right : left;
Lowering\DiagnosticsPass_ExpressionTrees.cs (1)
754var unary = node.OperatorKind.Operator() == BinaryOperatorKind.And ? node.FalseOperator : node.TrueOperator;
Lowering\DiagnosticsPass_Warnings.cs (27)
278if (_inExpressionLambda && node.OperatorKind.Operator() == BinaryOperatorKind.UnsignedRightShift) 326if (node.OperatorKind == BinaryOperatorKind.ObjectEqual || node.OperatorKind == BinaryOperatorKind.ObjectNotEqual) 349private static bool ConvertedHasEqual(BinaryOperatorKind oldOperatorKind, BoundNode node, out TypeSymbol type) 361string opName = (oldOperatorKind == BinaryOperatorKind.ObjectEqual) ? WellKnownMemberNames.EqualityOperatorName : WellKnownMemberNames.InequalityOperatorName; 459private void CheckForBitwiseOrSignExtend(BoundExpression node, BinaryOperatorKind operatorKind, BoundExpression leftOperand, BoundExpression rightOperand) 508case BinaryOperatorKind.LiftedUIntOr: 509case BinaryOperatorKind.LiftedIntOr: 510case BinaryOperatorKind.LiftedULongOr: 511case BinaryOperatorKind.LiftedLongOr: 512case BinaryOperatorKind.UIntOr: 513case BinaryOperatorKind.IntOr: 514case BinaryOperatorKind.ULongOr: 515case BinaryOperatorKind.LongOr: 750if (node.OperatorKind.OperandTypes() != BinaryOperatorKind.NullableNull) 757case BinaryOperatorKind.Equal: 758case BinaryOperatorKind.NotEqual: 764string always = node.OperatorKind.Operator() == BinaryOperatorKind.NotEqual ? "true" : "false"; 790case BinaryOperatorKind.LessThan: 791case BinaryOperatorKind.LessThanOrEqual: 792case BinaryOperatorKind.GreaterThan: 793case BinaryOperatorKind.GreaterThanOrEqual: 806case BinaryOperatorKind.Equal: 807case BinaryOperatorKind.NotEqual: 813string always = node.OperatorKind.Operator() == BinaryOperatorKind.NotEqual ? "true" : "false"; 824case BinaryOperatorKind.Or: 825case BinaryOperatorKind.And:
Lowering\Instrumentation\CodeCoverageInstrumenter.cs (1)
291BinaryOperatorKind.ObjectEqual,
Lowering\LocalRewriter\LocalRewriter.DecisionDagRewriter.cs (7)
644splitCases(ImmutableArray<(ConstantValue value, LabelSymbol label)> cases, BinaryOperatorKind op, ConstantValue value) 732_fac.Related(BinaryOperatorKind.LessThanOrEqual, x, y) ? 733(_fac.Related(BinaryOperatorKind.LessThanOrEqual, y, x) ? 0 : -1) : 821var lessThanOrEqualOperator = input.Type.SpecialType switch 823SpecialType.System_Single => BinaryOperatorKind.FloatLessThanOrEqual, 824SpecialType.System_Double => BinaryOperatorKind.DoubleLessThanOrEqual, 825SpecialType.System_Decimal => BinaryOperatorKind.DecimalLessThanOrEqual,
Lowering\LocalRewriter\LocalRewriter.DecisionDagRewriter.ValueDispatchNode.cs (12)
63/// For <see cref="BinaryOperatorKind.LessThan"/> and <see cref="BinaryOperatorKind.LessThanOrEqual"/>, 65/// is <see cref="Right"/>; for <see cref="BinaryOperatorKind.GreaterThan"/> and 66/// <see cref="BinaryOperatorKind.GreaterThanOrEqual"/> it is reversed. 67/// See <see cref="IsReversed(BinaryOperatorKind)"/> for where that is computed. 81public readonly BinaryOperatorKind Operator; 86private RelationalDispatch(SyntaxNode syntax, ConstantValue value, BinaryOperatorKind op, ValueDispatchNode left, ValueDispatchNode right) : base(syntax) 100private static bool IsReversed(BinaryOperatorKind op) => op.Operator() switch { BinaryOperatorKind.GreaterThan => true, BinaryOperatorKind.GreaterThanOrEqual => true, _ => false }; 133public static ValueDispatchNode CreateBalanced(SyntaxNode syntax, ConstantValue value, BinaryOperatorKind op, ValueDispatchNode whenTrue, ValueDispatchNode whenFalse) 140private static ValueDispatchNode CreateBalancedCore(SyntaxNode syntax, ConstantValue value, BinaryOperatorKind op, ValueDispatchNode left, ValueDispatchNode right)
Lowering\LocalRewriter\LocalRewriter.PatternLocalRewriter.cs (12)
373return MakeNullCheck(d.Syntax, input, input.Type.IsNullableType() ? BinaryOperatorKind.NullableNullNotEqual : BinaryOperatorKind.NotEqual); 380return MakeNullCheck(d.Syntax, input, input.Type.IsNullableType() ? BinaryOperatorKind.NullableNullEqual : BinaryOperatorKind.Equal); 396private BoundExpression MakeNullCheck(SyntaxNode syntax, BoundExpression rewrittenExpr, BinaryOperatorKind operatorKind) 424var operatorType = Binder.RelationalOperatorType(comparisonType); 425Debug.Assert(operatorType != BinaryOperatorKind.Error); 426var operatorKind = BinaryOperatorKind.Equal | operatorType; 430protected BoundExpression MakeRelationalTest(SyntaxNode syntax, BoundExpression input, BinaryOperatorKind operatorKind, ConstantValue value) 435Debug.Assert(operatorKind.Operator() == BinaryOperatorKind.Equal); 441if (operatorKind.OperandTypes() == BinaryOperatorKind.Int && comparisonType.SpecialType != SpecialType.System_Int32)
Lowering\LocalRewriter\LocalRewriter_BinaryOperator.cs (224)
72var operatorKind = node.OperatorKind; 89operatorKind.Operator() == BinaryOperatorKind.And ? node.FalseOperator : node.TrueOperator, 93var andOperatorCall = LowerUserDefinedBinaryOperator(syntax, operatorKind & ~BinaryOperatorKind.Logical, boundTemp, loweredRight, type, node.LogicalOperator, node.ConstrainedToTypeOpt); 123if (node.OperatorKind is BinaryOperatorKind.Utf8Addition) 145if (current.InterpolatedStringHandlerData is not null || current.OperatorKind is BinaryOperatorKind.Utf8Addition || IsBinaryStringConcatenation(current)) 169Debug.Assert(node.OperatorKind == BinaryOperatorKind.StringConcatenation); 183BinaryOperatorKind operatorKind, 199BinaryOperatorKind operatorKind, 215case BinaryOperatorKind.ObjectAndStringConcatenation: 216case BinaryOperatorKind.StringAndObjectConcatenation: 217case BinaryOperatorKind.StringConcatenation: 219case BinaryOperatorKind.DelegateCombination: 221case BinaryOperatorKind.DelegateRemoval: 223case BinaryOperatorKind.DelegateEqual: 225case BinaryOperatorKind.DelegateNotEqual: 259case BinaryOperatorKind.NullableNullEqual: 260case BinaryOperatorKind.NullableNullNotEqual: 263case BinaryOperatorKind.ObjectAndStringConcatenation: 264case BinaryOperatorKind.StringAndObjectConcatenation: 265case BinaryOperatorKind.StringConcatenation: 268case BinaryOperatorKind.StringEqual: 271case BinaryOperatorKind.StringNotEqual: 274case BinaryOperatorKind.DelegateCombination: 277case BinaryOperatorKind.DelegateRemoval: 280case BinaryOperatorKind.DelegateEqual: 283case BinaryOperatorKind.DelegateNotEqual: 286case BinaryOperatorKind.LogicalBoolAnd: 293operatorKind &= ~BinaryOperatorKind.Logical; 298case BinaryOperatorKind.LogicalBoolOr: 305operatorKind &= ~BinaryOperatorKind.Logical; 310case BinaryOperatorKind.BoolAnd: 331case BinaryOperatorKind.BoolOr: 336case BinaryOperatorKind.BoolEqual: 350case BinaryOperatorKind.BoolNotEqual: 364case BinaryOperatorKind.BoolXor: 378case BinaryOperatorKind.IntLeftShift: 379case BinaryOperatorKind.UIntLeftShift: 380case BinaryOperatorKind.IntRightShift: 381case BinaryOperatorKind.UIntRightShift: 382case BinaryOperatorKind.IntUnsignedRightShift: 383case BinaryOperatorKind.UIntUnsignedRightShift: 386case BinaryOperatorKind.LongLeftShift: 387case BinaryOperatorKind.ULongLeftShift: 388case BinaryOperatorKind.LongRightShift: 389case BinaryOperatorKind.ULongRightShift: 390case BinaryOperatorKind.LongUnsignedRightShift: 391case BinaryOperatorKind.ULongUnsignedRightShift: 394case BinaryOperatorKind.NIntRightShift: 395case BinaryOperatorKind.NUIntRightShift: 396case BinaryOperatorKind.NIntUnsignedRightShift: 397case BinaryOperatorKind.NUIntUnsignedRightShift: 398case BinaryOperatorKind.NIntLeftShift: 399case BinaryOperatorKind.NUIntLeftShift: 402case BinaryOperatorKind.DecimalAddition: 403case BinaryOperatorKind.DecimalSubtraction: 404case BinaryOperatorKind.DecimalMultiplication: 405case BinaryOperatorKind.DecimalDivision: 406case BinaryOperatorKind.DecimalRemainder: 407case BinaryOperatorKind.DecimalEqual: 408case BinaryOperatorKind.DecimalNotEqual: 409case BinaryOperatorKind.DecimalLessThan: 410case BinaryOperatorKind.DecimalLessThanOrEqual: 411case BinaryOperatorKind.DecimalGreaterThan: 412case BinaryOperatorKind.DecimalGreaterThanOrEqual: 415case BinaryOperatorKind.PointerAndIntAddition: 416case BinaryOperatorKind.PointerAndUIntAddition: 417case BinaryOperatorKind.PointerAndLongAddition: 418case BinaryOperatorKind.PointerAndULongAddition: 419case BinaryOperatorKind.PointerAndIntSubtraction: 420case BinaryOperatorKind.PointerAndUIntSubtraction: 421case BinaryOperatorKind.PointerAndLongSubtraction: 422case BinaryOperatorKind.PointerAndULongSubtraction: 429case BinaryOperatorKind.IntAndPointerAddition: 430case BinaryOperatorKind.UIntAndPointerAddition: 431case BinaryOperatorKind.LongAndPointerAddition: 432case BinaryOperatorKind.ULongAndPointerAddition: 439case BinaryOperatorKind.PointerSubtraction: 442case BinaryOperatorKind.IntAddition: 443case BinaryOperatorKind.UIntAddition: 444case BinaryOperatorKind.LongAddition: 445case BinaryOperatorKind.ULongAddition: 456case BinaryOperatorKind.IntSubtraction: 457case BinaryOperatorKind.LongSubtraction: 458case BinaryOperatorKind.UIntSubtraction: 459case BinaryOperatorKind.ULongSubtraction: 466case BinaryOperatorKind.IntMultiplication: 467case BinaryOperatorKind.LongMultiplication: 468case BinaryOperatorKind.UIntMultiplication: 469case BinaryOperatorKind.ULongMultiplication: 488case BinaryOperatorKind.IntGreaterThan: 489case BinaryOperatorKind.IntLessThanOrEqual: 493var newOp = operatorKind == BinaryOperatorKind.IntGreaterThan ? 494BinaryOperatorKind.NotEqual : 495BinaryOperatorKind.Equal; 497operatorKind &= ~BinaryOperatorKind.OpMask; 503case BinaryOperatorKind.IntLessThan: 504case BinaryOperatorKind.IntGreaterThanOrEqual: 508var newOp = operatorKind == BinaryOperatorKind.IntLessThan ? 509BinaryOperatorKind.NotEqual : 510BinaryOperatorKind.Equal; 512operatorKind &= ~BinaryOperatorKind.OpMask; 518case BinaryOperatorKind.IntEqual: 519case BinaryOperatorKind.IntNotEqual: 531case BinaryOperatorKind.Utf8Addition: 545private BoundExpression RewriteLiftedBinaryOperator(SyntaxNode syntax, BinaryOperatorKind operatorKind, BoundExpression loweredLeft, BoundExpression loweredRight, TypeSymbol type, MethodSymbol? method, TypeSymbol? constrainedToTypeOpt) 553operatorKind != BinaryOperatorKind.LiftedBoolOr && operatorKind != BinaryOperatorKind.LiftedBoolAnd && 574if (operatorKind.Operator() == BinaryOperatorKind.NotEqual || 575operatorKind.Operator() == BinaryOperatorKind.Equal) 605BinaryOperatorKind operatorKind, 614Debug.Assert(operatorKind.Operator() == BinaryOperatorKind.And || operatorKind.Operator() == BinaryOperatorKind.Or); 625bool isAnd = operatorKind.Operator() == BinaryOperatorKind.And; 689result = _factory.Binary(BinaryOperatorKind.LogicalOr, boolean, leftTest, result); 733private BoundExpression MakeTruthTestForDynamicLogicalOperator(SyntaxNode syntax, BinaryOperatorKind operatorKind, BoundExpression loweredLeft, TypeSymbol boolean, MethodSymbol? leftTruthOperator, TypeSymbol? constrainedToTypeOpt, bool negative) 788BinaryOperatorKind operatorKind, 816BinaryOperatorKind kind, 835return MakeLiteral(syntax, ConstantValue.Create(kind.Operator() == BinaryOperatorKind.Equal), boolType); 858BinaryOperatorKind operatorKind = kind.Operator(); 862BoundExpression result = MakeLiteral(syntax, ConstantValue.Create(operatorKind == BinaryOperatorKind.NotEqual), boolType); 889if (operatorKind == BinaryOperatorKind.Equal || operatorKind == BinaryOperatorKind.NotEqual) 892BoundExpression result = operatorKind == BinaryOperatorKind.Equal ? 899BoundExpression falseExpr = MakeBooleanConstant(syntax, operatorKind == BinaryOperatorKind.NotEqual); 956BinaryOperatorKind kind, 1019if (kind.Operator() is BinaryOperatorKind.Equal or BinaryOperatorKind.NotEqual) 1056BinaryOperatorKind leftOperator; 1057BinaryOperatorKind rightOperator; 1059BinaryOperatorKind operatorKind = kind.Operator(); 1062case BinaryOperatorKind.Equal: 1063case BinaryOperatorKind.NotEqual: 1064leftOperator = BinaryOperatorKind.Equal; 1065rightOperator = BinaryOperatorKind.BoolEqual; 1069rightOperator = BinaryOperatorKind.BoolAnd; 1097operatorKind: BinaryOperatorKind.BoolAnd, 1106if (operatorKind == BinaryOperatorKind.NotEqual) 1146BinaryOperatorKind kind, 1230BinaryOperatorKind conditionOperator; 1231BinaryOperatorKind operatorKind = kind.Operator(); 1234case BinaryOperatorKind.Equal: 1235case BinaryOperatorKind.NotEqual: 1236conditionOperator = BinaryOperatorKind.BoolEqual; 1239conditionOperator = BinaryOperatorKind.BoolAnd; 1265if (operatorKind == BinaryOperatorKind.Equal || operatorKind == BinaryOperatorKind.NotEqual) 1280rewrittenAlternative: MakeLiteral(syntax, ConstantValue.Create(operatorKind == BinaryOperatorKind.Equal), boolType), 1293BoundExpression alternative = MakeBooleanConstant(syntax, operatorKind == BinaryOperatorKind.NotEqual); 1314BinaryOperatorKind kind, 1354BinaryOperatorKind kind, 1423BinaryOperatorKind kind, 1477BoundExpression condition = MakeBinaryOperator(syntax, BinaryOperatorKind.BoolAnd, callX_HasValue, callY_HasValue, boolType, method: null, constrainedToTypeOpt: null); 1525BinaryOperatorKind kind, 1539if (kind == BinaryOperatorKind.LiftedBoolAnd || kind == BinaryOperatorKind.LiftedBoolOr) 1676BinaryOperatorKind kind, 1713BoundExpression newNullBool = MakeNewNullableBoolean(syntax, kind == BinaryOperatorKind.LiftedBoolOr); 1718rewrittenConsequence: kind == BinaryOperatorKind.LiftedBoolAnd ? nullBool : newNullBool, 1719rewrittenAlternative: kind == BinaryOperatorKind.LiftedBoolAnd ? newNullBool : nullBool, 1740BoundExpression consequence = kind == BinaryOperatorKind.LiftedBoolAnd ? nullBool : boundTemp; 1741BoundExpression alternative = kind == BinaryOperatorKind.LiftedBoolAnd ? boundTemp : nullBool; 1761BinaryOperatorKind kind, 1801BoundExpression newNullBool = MakeNewNullableBoolean(syntax, kind == BinaryOperatorKind.LiftedBoolOr); 1802BoundExpression consequence = kind == BinaryOperatorKind.LiftedBoolOr ? newNullBool : maybeNullTemp; 1803BoundExpression alternative = kind == BinaryOperatorKind.LiftedBoolOr ? maybeNullTemp : newNullBool; 1822BinaryOperatorKind kind, 1868operatorKind: BinaryOperatorKind.LogicalBoolOr, 1881operatorKind: BinaryOperatorKind.LogicalBoolOr, 1888BoundExpression consequence = kind == BinaryOperatorKind.LiftedBoolAnd ? boundTempY : boundTempX; 1889BoundExpression alternative = kind == BinaryOperatorKind.LiftedBoolAnd ? boundTempX : boundTempY; 1944BinaryOperatorKind kind, 1970return MakeLiteral(syntax, ConstantValue.Create(kind == BinaryOperatorKind.NullableNullEqual), returnType); 1985value: MakeBooleanConstant(syntax, kind == BinaryOperatorKind.NullableNullNotEqual), 2001var whenNull = kind == BinaryOperatorKind.NullableNullEqual ? MakeBooleanConstant(syntax, true) : null; 2007BoundExpression result = kind == BinaryOperatorKind.NullableNullNotEqual ? 2014private BoundExpression RewriteStringEquality(BoundBinaryOperator? oldNode, SyntaxNode syntax, BinaryOperatorKind operatorKind, BoundExpression loweredLeft, BoundExpression loweredRight, TypeSymbol type, SpecialMember member) 2027private BoundExpression RewriteDelegateOperation(SyntaxNode syntax, BinaryOperatorKind operatorKind, BoundExpression loweredLeft, BoundExpression loweredRight, TypeSymbol type, SpecialMember member) 2030if (operatorKind == BinaryOperatorKind.DelegateEqual || operatorKind == BinaryOperatorKind.DelegateNotEqual) 2038operatorKind = (operatorKind & (~BinaryOperatorKind.Delegate)) | BinaryOperatorKind.Object; 2057private BoundExpression RewriteDecimalBinaryOperation(SyntaxNode syntax, BoundExpression loweredLeft, BoundExpression loweredRight, BinaryOperatorKind operatorKind) 2066case BinaryOperatorKind.DecimalAddition: member = SpecialMember.System_Decimal__op_Addition; break; 2067case BinaryOperatorKind.DecimalSubtraction: member = SpecialMember.System_Decimal__op_Subtraction; break; 2068case BinaryOperatorKind.DecimalMultiplication: member = SpecialMember.System_Decimal__op_Multiply; break; 2069case BinaryOperatorKind.DecimalDivision: member = SpecialMember.System_Decimal__op_Division; break; 2070case BinaryOperatorKind.DecimalRemainder: member = SpecialMember.System_Decimal__op_Modulus; break; 2071case BinaryOperatorKind.DecimalEqual: member = SpecialMember.System_Decimal__op_Equality; break; 2072case BinaryOperatorKind.DecimalNotEqual: member = SpecialMember.System_Decimal__op_Inequality; break; 2073case BinaryOperatorKind.DecimalLessThan: member = SpecialMember.System_Decimal__op_LessThan; break; 2074case BinaryOperatorKind.DecimalLessThanOrEqual: member = SpecialMember.System_Decimal__op_LessThanOrEqual; break; 2075case BinaryOperatorKind.DecimalGreaterThan: member = SpecialMember.System_Decimal__op_GreaterThan; break; 2076case BinaryOperatorKind.DecimalGreaterThanOrEqual: member = SpecialMember.System_Decimal__op_GreaterThanOrEqual; break; 2088private BoundExpression MakeNullCheck(SyntaxNode syntax, BoundExpression rewrittenExpr, BinaryOperatorKind operatorKind) 2090Debug.Assert((operatorKind == BinaryOperatorKind.Equal) || (operatorKind == BinaryOperatorKind.NotEqual) || 2091(operatorKind == BinaryOperatorKind.NullableNullEqual) || (operatorKind == BinaryOperatorKind.NullableNullNotEqual)); 2109case BinaryOperatorKind.Equal: 2111case BinaryOperatorKind.NotEqual: 2127operatorKind |= BinaryOperatorKind.NullableNull; 2148BinaryOperatorKind operatorKind, 2172BinaryOperatorKind andOperatorKind = (operatorKind & ~BinaryOperatorKind.OpMask) | BinaryOperatorKind.And; 2210BinaryOperatorKind operatorKind, 2250BinaryOperatorKind andOperatorKind = (operatorKind & ~BinaryOperatorKind.OpMask) | BinaryOperatorKind.And; 2270BinaryOperatorKind kind, 2290Debug.Assert(kind.Operator() == BinaryOperatorKind.Addition); 2295kind = kind & ~BinaryOperatorKind.Checked; 2392BinaryOperatorKind multiplicationKind = BinaryOperatorKind.Multiplication; 2407multiplicationKind |= BinaryOperatorKind.Int; //i.e. signed 2420multiplicationKind |= BinaryOperatorKind.Long; 2432multiplicationKind |= BinaryOperatorKind.Long; 2444multiplicationKind |= BinaryOperatorKind.ULong; 2457multiplicationKind |= BinaryOperatorKind.Checked; 2466BinaryOperatorKind kind, 2484BinaryOperatorKind.Division, 2487kind & ~BinaryOperatorKind.Checked, // For some reason, dev10 never checks for subtraction overflow.
Lowering\LocalRewriter\LocalRewriter_Call.cs (1)
480BinaryOperatorKind.ObjectEqual,
Lowering\LocalRewriter\LocalRewriter_CollectionExpression.cs (4)
938_factory.Binary(BinaryOperatorKind.Addition, indexTemp.Type, indexTemp, _factory.Literal(1)), 1146sideEffects.Add(new BoundAssignmentOperator(rewrittenSpreadOperand.Syntax, indexTemp, _factory.Binary(BinaryOperatorKind.Addition, indexTemp.Type, indexTemp, spreadLength), isRef: false, indexTemp.Type)); 1309_factory.Binary(BinaryOperatorKind.Addition, indexTemp.Type, indexTemp, _factory.Literal(1)), 1485_factory.Binary(BinaryOperatorKind.Addition, sum.Type!, sum, value);
Lowering\LocalRewriter\LocalRewriter_CompoundAssignmentOperator.cs (5)
88var kind = node.Operator.Kind; 91var binaryOperator = kind.Operator(); 100(binaryOperator == BinaryOperatorKind.Addition || binaryOperator == BinaryOperatorKind.Subtraction)) 147(binaryOperator == BinaryOperatorKind.Addition ? "add_" : "remove_") + memberAccess.Name,
Lowering\LocalRewriter\LocalRewriter_Conversion.cs (2)
166Debug.Assert(node.OperatorKind is BinaryOperatorKind.Utf8Addition); 194Debug.Assert(utf8Addition.OperatorKind is BinaryOperatorKind.Utf8Addition);
Lowering\LocalRewriter\LocalRewriter_FixedStatement.cs (5)
474BoundExpression notNullCheck = _factory.MakeNullCheck(factory.Syntax, factory.Local(localSymbol), BinaryOperatorKind.NotEqual); 487BoundExpression addition = factory.Binary(BinaryOperatorKind.PointerAndIntAddition, localType, factory.Local(localSymbol), helperCall); 528BoundExpression notNullCheck = _factory.MakeNullCheck(factory.Syntax, arrayTempInit, BinaryOperatorKind.NotEqual); 551BoundExpression lengthCheck = factory.Binary(BinaryOperatorKind.IntNotEqual, factory.SpecialType(SpecialType.System_Boolean), lengthCall, factory.Literal(0)); 554BoundExpression condition = factory.Binary(BinaryOperatorKind.LogicalBoolAnd, factory.SpecialType(SpecialType.System_Boolean), notNullCheck, lengthCheck);
Lowering\LocalRewriter\LocalRewriter_ForEachStatement.cs (5)
462operatorKind: BinaryOperatorKind.NotEqual, // reference equality 667operatorKind: BinaryOperatorKind.IntLessThan, 963operatorKind: BinaryOperatorKind.IntLessThan, 1167operatorKind: BinaryOperatorKind.IntLessThanOrEqual, 1261operatorKind: BinaryOperatorKind.IntAddition, // unchecked, never overflows since array/string index can't be >= Int32.MaxValue
Lowering\LocalRewriter\LocalRewriter_IsOperator.cs (1)
73return _factory.MakeNullCheck(syntax, rewrittenOperand, BinaryOperatorKind.NotEqual);
Lowering\LocalRewriter\LocalRewriter_NullCoalescingOperator.cs (1)
163BoundExpression nullCheck = _factory.MakeNullCheck(syntax, boundTemp, BinaryOperatorKind.NotEqual);
Lowering\LocalRewriter\LocalRewriter_PointerElementAccess.cs (7)
44BinaryOperatorKind additionKind = BinaryOperatorKind.Addition; 51additionKind |= BinaryOperatorKind.PointerAndIntAddition; 54additionKind |= BinaryOperatorKind.PointerAndUIntAddition; 57additionKind |= BinaryOperatorKind.PointerAndLongAddition; 60additionKind |= BinaryOperatorKind.PointerAndULongAddition; 68additionKind |= BinaryOperatorKind.Checked;
Lowering\LocalRewriter\LocalRewriter_Range.cs (1)
144condition = MakeBinaryOperator(node.Syntax, BinaryOperatorKind.BoolAnd, condition, operandHasValue, boolType, method: null, constrainedToTypeOpt: null);
Lowering\LocalRewriter\LocalRewriter_StackAlloc.cs (3)
148BinaryOperatorKind multiplicationKind = BinaryOperatorKind.Checked | BinaryOperatorKind.UIntMultiplication; //"UInt" just to make it unsigned
Lowering\LocalRewriter\LocalRewriter_StringConcat.cs (6)
20private static bool IsBinaryStringConcatenation(BinaryOperatorKind binaryOperator) 21=> binaryOperator is BinaryOperatorKind.StringConcatenation or BinaryOperatorKind.StringAndObjectConcatenation or BinaryOperatorKind.ObjectAndStringConcatenation; 23private BoundExpression VisitCompoundAssignmentStringConcatenation(BoundExpression left, BoundExpression unvisitedRight, BinaryOperatorKind operatorKind, SyntaxNode syntax) 603SpecialMember member = (current.OperatorKind == BinaryOperatorKind.StringConcatenation) ?
Lowering\LocalRewriter\LocalRewriter_StringInterpolation.cs (1)
183_factory.Binary(BinaryOperatorKind.StringConcatenation, node.Type, result, part);
Lowering\LocalRewriter\LocalRewriter_TupleBinaryOperator.cs (14)
252ArrayBuilder<LocalSymbol> temps, BinaryOperatorKind operatorKind) 264return new BoundLiteral(left.Syntax, ConstantValue.Create(nullnull.Kind == BinaryOperatorKind.Equal), boolType); 272TypeSymbol boolType, ArrayBuilder<LocalSymbol> temps, BinaryOperatorKind operatorKind) 321bool boolValue = operatorKind == BinaryOperatorKind.Equal; // true/false 346_factory.Binary(BinaryOperatorKind.Equal, boolType, leftHasValue, rightHasValue), 491ArrayBuilder<LocalSymbol> temps, BinaryOperatorKind operatorKind) 507var logicalOperator = operatorKind == BinaryOperatorKind.Equal ? BinaryOperatorKind.LogicalBoolAnd : BinaryOperatorKind.LogicalBoolOr; 547BoundExpression left, BoundExpression right, TypeSymbol boolType, BinaryOperatorKind operatorKind) 561if (operatorKind == BinaryOperatorKind.Equal) 574return new BoundLiteral(left.Syntax, ConstantValue.Create(operatorKind == BinaryOperatorKind.Equal), boolType); 591if (operatorKind == BinaryOperatorKind.Equal)
Lowering\LocalRewriter\LocalRewriter_UnaryOperator.cs (47)
52if (node.OperatorKind == UnaryOperatorKind.DynamicTrue && binaryOperator.OperatorKind == BinaryOperatorKind.DynamicLogicalOr || 53node.OperatorKind == UnaryOperatorKind.DynamicFalse && binaryOperator.OperatorKind == BinaryOperatorKind.DynamicLogicalAnd) 893BinaryOperatorKind binaryOperatorKind = GetCorrespondingBinaryOperator(node); 894binaryOperatorKind |= IsIncrement(node) ? BinaryOperatorKind.Addition : BinaryOperatorKind.Subtraction; 930Debug.Assert(binaryOperatorKind.OperandTypes() == BinaryOperatorKind.PointerAndInt); 966private MethodSymbol GetDecimalIncDecOperator(BinaryOperatorKind oper) 971case BinaryOperatorKind.Addition: member = SpecialMember.System_Decimal__op_Increment; break; 972case BinaryOperatorKind.Subtraction: member = SpecialMember.System_Decimal__op_Decrement; break; 983private BoundExpression MakeDecimalIncDecOperator(SyntaxNode syntax, BinaryOperatorKind oper, BoundExpression operand) 990private BoundExpression MakeLiftedDecimalIncDecOperator(SyntaxNode syntax, BinaryOperatorKind oper, BoundExpression operand) 1131private static BinaryOperatorKind GetCorrespondingBinaryOperator(BoundIncrementOperator node) 1139BinaryOperatorKind result; 1146result = BinaryOperatorKind.Int; 1152result = BinaryOperatorKind.UInt; 1155result = BinaryOperatorKind.Long; 1158result = BinaryOperatorKind.ULong; 1161result = BinaryOperatorKind.NInt; 1164result = BinaryOperatorKind.NUInt; 1167result = BinaryOperatorKind.Float; 1170result = BinaryOperatorKind.Double; 1173result = BinaryOperatorKind.Decimal; 1195result = BinaryOperatorKind.Int; 1200result = BinaryOperatorKind.UInt; 1203result = BinaryOperatorKind.Long; 1206result = BinaryOperatorKind.ULong; 1214result = BinaryOperatorKind.PointerAndInt; 1224case BinaryOperatorKind.UInt: 1225case BinaryOperatorKind.Int: 1226case BinaryOperatorKind.ULong: 1227case BinaryOperatorKind.Long: 1228case BinaryOperatorKind.NUInt: 1229case BinaryOperatorKind.NInt: 1230case BinaryOperatorKind.PointerAndInt: 1231result |= (BinaryOperatorKind)unaryOperatorKind.OverflowChecks(); 1237result |= BinaryOperatorKind.Lifted; 1245BinaryOperatorKind binaryOperatorKind) 1250case BinaryOperatorKind.PointerAndInt: 1251case BinaryOperatorKind.Int: 1254case BinaryOperatorKind.UInt: 1257case BinaryOperatorKind.Long: 1260case BinaryOperatorKind.ULong: 1263case BinaryOperatorKind.NInt: 1266case BinaryOperatorKind.NUInt: 1269case BinaryOperatorKind.Float: 1272case BinaryOperatorKind.Double: 1275case BinaryOperatorKind.Decimal:
Lowering\LocalRewriter\LocalRewriter_UsingStatement.cs (1)
392ifCondition = _factory.MakeNullCheck(resourceSyntax, local, BinaryOperatorKind.NotEqual);
Lowering\LocalRewriter\LoweredDynamicOperationFactory.cs (1)
152BinaryOperatorKind operatorKind,
Lowering\SpillSequenceSpiller.cs (3)
1007if (node.OperatorKind == BinaryOperatorKind.LogicalBoolOr || node.OperatorKind == BinaryOperatorKind.LogicalBoolAnd) 1013node.OperatorKind == BinaryOperatorKind.LogicalBoolAnd ? _F.Local(tmp) : _F.Not(_F.Local(tmp)),
Lowering\StateMachineRewriter\ResumableStateMachineStateAllocator.cs (2)
91_increasing ? BinaryOperatorKind.IntGreaterThanOrEqual : BinaryOperatorKind.IntLessThanOrEqual,
Lowering\SyntheticBoundNodeFactory.cs (26)
643public BoundBinaryOperator Binary(BinaryOperatorKind kind, TypeSymbol type, BoundExpression left, BoundExpression right) 666return Binary(BinaryOperatorKind.LogicalBoolAnd, SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Boolean), left, right); 673return Binary(BinaryOperatorKind.LogicalBoolOr, SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Boolean), left, right); 678return Binary(BinaryOperatorKind.IntEqual, SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Boolean), left, right); 683return Binary(BinaryOperatorKind.ObjectEqual, SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Boolean), left, right); 709return Binary(BinaryOperatorKind.ObjectNotEqual, SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Boolean), left, right); 714return Binary(BinaryOperatorKind.IntNotEqual, SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Boolean), left, right); 719return Binary(BinaryOperatorKind.IntLessThan, SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Boolean), left, right); 724return Binary(BinaryOperatorKind.IntGreaterThanOrEqual, SpecialType(CodeAnalysis.SpecialType.System_Boolean), left, right); 729return Binary(BinaryOperatorKind.IntSubtraction, SpecialType(CodeAnalysis.SpecialType.System_Int32), left, right); 734return Binary(BinaryOperatorKind.IntMultiplication, SpecialType(CodeAnalysis.SpecialType.System_Int32), left, right); 1755internal BoundExpression MakeNullCheck(SyntaxNode syntax, BoundExpression rewrittenExpr, BinaryOperatorKind operatorKind) 1757Debug.Assert((operatorKind == BinaryOperatorKind.Equal) || (operatorKind == BinaryOperatorKind.NotEqual) || 1758(operatorKind == BinaryOperatorKind.NullableNullEqual) || (operatorKind == BinaryOperatorKind.NullableNullNotEqual)); 1776case BinaryOperatorKind.Equal: 1778case BinaryOperatorKind.NotEqual: 1794operatorKind |= BinaryOperatorKind.NullableNull; 1797if (operatorKind == BinaryOperatorKind.NullableNullEqual || operatorKind == BinaryOperatorKind.NullableNullNotEqual) 1819BinaryOperatorKind kind, 1845return Literal(kind == BinaryOperatorKind.NullableNullEqual); 1860value: Literal(kind == BinaryOperatorKind.NullableNullNotEqual), 1876var whenNull = kind == BinaryOperatorKind.NullableNullEqual ? Literal(true) : null; 1882BoundExpression result = kind == BinaryOperatorKind.NullableNullNotEqual ?
Operations\CSharpOperationFactory.cs (2)
1562IMethodSymbol unaryOperatorMethod = boundBinaryOperator.OperatorKind.Operator() == CSharp.BinaryOperatorKind.And ? 1573GetConstrainedToTypeForOperator(boundBinaryOperator.OperatorKind.Operator() == CSharp.BinaryOperatorKind.And ?
Operations\CSharpOperationFactory_Methods.cs (20)
547internal static BinaryOperatorKind DeriveBinaryOperatorKind(CSharp.BinaryOperatorKind operatorKind) 551case CSharp.BinaryOperatorKind.Addition: 554case CSharp.BinaryOperatorKind.Subtraction: 557case CSharp.BinaryOperatorKind.Multiplication: 560case CSharp.BinaryOperatorKind.Division: 563case CSharp.BinaryOperatorKind.Remainder: 566case CSharp.BinaryOperatorKind.LeftShift: 569case CSharp.BinaryOperatorKind.RightShift: 572case CSharp.BinaryOperatorKind.UnsignedRightShift: 575case CSharp.BinaryOperatorKind.And: 578case CSharp.BinaryOperatorKind.Or: 581case CSharp.BinaryOperatorKind.Xor: 584case CSharp.BinaryOperatorKind.LessThan: 587case CSharp.BinaryOperatorKind.LessThanOrEqual: 590case CSharp.BinaryOperatorKind.Equal: 593case CSharp.BinaryOperatorKind.NotEqual: 596case CSharp.BinaryOperatorKind.GreaterThanOrEqual: 599case CSharp.BinaryOperatorKind.GreaterThan: 602case CSharp.BinaryOperatorKind.LogicalAnd: 605case CSharp.BinaryOperatorKind.LogicalOr:
Utilities\IConstantValueSetFactory.cs (3)
18IConstantValueSet Related(BinaryOperatorKind relation, ConstantValue value); 23bool Related(BinaryOperatorKind relation, ConstantValue left, ConstantValue right); 55IConstantValueSet<T> Related(BinaryOperatorKind relation, T value);
Utilities\IValueSet.cs (13)
38/// are <see cref="BinaryOperatorKind.Equal"/> for all supported types, and for numeric types we also support 39/// <see cref="BinaryOperatorKind.LessThan"/>, <see cref="BinaryOperatorKind.LessThanOrEqual"/>, <see cref="BinaryOperatorKind.GreaterThan"/>, and 40/// <see cref="BinaryOperatorKind.GreaterThanOrEqual"/>. 42bool Any(BinaryOperatorKind relation, ConstantValue value); 46/// Because of that all four combinations of results from <see cref="Any(BinaryOperatorKind, ConstantValue)"/> and <see cref="All(BinaryOperatorKind, ConstantValue)"/> 51bool All(BinaryOperatorKind relation, ConstantValue value); 88bool Any(BinaryOperatorKind relation, T value); 92/// Because of that all four combinations of results from <see cref="Any(BinaryOperatorKind, T)"/> and <see cref="All(BinaryOperatorKind, T)"/> 97bool All(BinaryOperatorKind relation, T value);
Utilities\ValueSetFactory.BoolValueSet.cs (5)
9using static BinaryOperatorKind; 43public bool Any(BinaryOperatorKind relation, bool value) 56bool IConstantValueSet.Any(BinaryOperatorKind relation, ConstantValue value) => value.IsBad || Any(relation, value.BooleanValue); 58public bool All(BinaryOperatorKind relation, bool value) 71bool IConstantValueSet.All(BinaryOperatorKind relation, ConstantValue value) => !value.IsBad && All(relation, value.BooleanValue);
Utilities\ValueSetFactory.BoolValueSetFactory.cs (5)
11using static BinaryOperatorKind; 28public IConstantValueSet<bool> Related(BinaryOperatorKind relation, bool value) 53IConstantValueSet IConstantValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue value) 58bool IConstantValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue left, ConstantValue right) 60Debug.Assert(relation == BinaryOperatorKind.Equal);
Utilities\ValueSetFactory.ByteTC.cs (2)
10using static BinaryOperatorKind; 24bool INumericTC<byte>.Related(BinaryOperatorKind relation, byte left, byte right)
Utilities\ValueSetFactory.CharTC.cs (2)
10using static BinaryOperatorKind; 24bool INumericTC<char>.Related(BinaryOperatorKind relation, char left, char right)
Utilities\ValueSetFactory.DecimalTC.cs (2)
11using static BinaryOperatorKind; 89bool INumericTC<decimal>.Related(BinaryOperatorKind relation, decimal left, decimal right)
Utilities\ValueSetFactory.DecimalValueSetFactory.cs (3)
21public IConstantValueSet<decimal> Related(BinaryOperatorKind relation, decimal value) => _underlying.Related(relation, DecimalTC.Normalize(value)); 27IConstantValueSet IConstantValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue value) => 30bool IConstantValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue left, ConstantValue right) => _underlying.Related(relation, left, right);
Utilities\ValueSetFactory.DoubleTC.cs (2)
10using static BinaryOperatorKind; 64bool INumericTC<double>.Related(BinaryOperatorKind relation, double left, double right)
Utilities\ValueSetFactory.EnumeratedValueSet.cs (9)
58if (this.Any(BinaryOperatorKind.Equal, (T)(object)"")) 61if (this.Any(BinaryOperatorKind.Equal, (T)(object)c.ToString())) 69if (this.Any(BinaryOperatorKind.Equal, value)) 77public bool Any(BinaryOperatorKind relation, T value) 81case BinaryOperatorKind.Equal: 88bool IConstantValueSet.Any(BinaryOperatorKind relation, ConstantValue value) => value.IsBad || Any(relation, _tc.FromConstantValue(value)); 90public bool All(BinaryOperatorKind relation, T value) 94case BinaryOperatorKind.Equal: 111bool IConstantValueSet.All(BinaryOperatorKind relation, ConstantValue value) => !value.IsBad && All(relation, _tc.FromConstantValue(value));
Utilities\ValueSetFactory.EnumeratedValueSetFactory.cs (5)
10using static BinaryOperatorKind; 27public IConstantValueSet<T> Related(BinaryOperatorKind relation, T value) 38IConstantValueSet IConstantValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue value) => 41bool IConstantValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue left, ConstantValue right) 43Debug.Assert(relation == BinaryOperatorKind.Equal);
Utilities\ValueSetFactory.FloatingValueSet.cs (11)
12using static BinaryOperatorKind; 70public static IConstantValueSet<TFloating> Related(BinaryOperatorKind relation, TFloating value, FloatingTC<TFloating> tc) 76case BinaryOperatorKind.Equal: 77case BinaryOperatorKind.LessThanOrEqual: 78case BinaryOperatorKind.GreaterThanOrEqual: 84case BinaryOperatorKind.LessThan: 85case BinaryOperatorKind.GreaterThan: 138bool IConstantValueSet.Any(BinaryOperatorKind relation, ConstantValue value) => 141public bool Any(BinaryOperatorKind relation, TFloating value) 148bool IConstantValueSet.All(BinaryOperatorKind relation, ConstantValue value) => !value.IsBad && All(relation, _tc.FromConstantValue(value)); 150public bool All(BinaryOperatorKind relation, TFloating value)
Utilities\ValueSetFactory.FloatingValueSetFactory.cs (3)
24public IConstantValueSet<TFloating> Related(BinaryOperatorKind relation, TFloating value) => 35IConstantValueSet IConstantValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue value) => 40bool IConstantValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue left, ConstantValue right)
Utilities\ValueSetFactory.IntTC.cs (2)
10using static BinaryOperatorKind; 34public bool Related(BinaryOperatorKind relation, int left, int right)
Utilities\ValueSetFactory.INumericTC.cs (1)
31bool Related(BinaryOperatorKind relation, T left, T right);
Utilities\ValueSetFactory.LongTC.cs (2)
10using static BinaryOperatorKind; 24bool INumericTC<long>.Related(BinaryOperatorKind relation, long left, long right)
Utilities\ValueSetFactory.NintValueSet.cs (5)
11using static BinaryOperatorKind; 65public bool All(BinaryOperatorKind relation, int value) 74bool IConstantValueSet.All(BinaryOperatorKind relation, ConstantValue value) => value.IsBad || All(relation, value.Int32Value); 76public bool Any(BinaryOperatorKind relation, int value) 85bool IConstantValueSet.Any(BinaryOperatorKind relation, ConstantValue value) => value.IsBad || Any(relation, value.Int32Value);
Utilities\ValueSetFactory.NintValueSetFactory.cs (4)
9using static BinaryOperatorKind; 23public IConstantValueSet<int> Related(BinaryOperatorKind relation, int value) 43IConstantValueSet IConstantValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue value) 48bool IConstantValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue left, ConstantValue right)
Utilities\ValueSetFactory.NonNegativeIntValueSetFactory.cs (4)
10using static BinaryOperatorKind; 25public IConstantValueSet<int> Related(BinaryOperatorKind relation, int value) 57IConstantValueSet IConstantValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue value) => 60bool IConstantValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue left, ConstantValue right) => s_underlying.Related(relation, left, right);
Utilities\ValueSetFactory.NuintValueSet.cs (5)
11using static BinaryOperatorKind; 56public bool All(BinaryOperatorKind relation, uint value) 63bool IConstantValueSet.All(BinaryOperatorKind relation, ConstantValue value) => value.IsBad || All(relation, value.UInt32Value); 65public bool Any(BinaryOperatorKind relation, uint value) 72bool IConstantValueSet.Any(BinaryOperatorKind relation, ConstantValue value) => value.IsBad || Any(relation, value.UInt32Value);
Utilities\ValueSetFactory.NuintValueSetFactory.cs (4)
9using static BinaryOperatorKind; 23public IConstantValueSet<uint> Related(BinaryOperatorKind relation, uint value) 41IConstantValueSet IConstantValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue value) 46bool IConstantValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue left, ConstantValue right)
Utilities\ValueSetFactory.NumericValueSet.cs (6)
15using static BinaryOperatorKind; 64var gz = new NumericValueSetFactory<T>(_tc).Related(BinaryOperatorKind.GreaterThanOrEqual, _tc.Zero); 72public bool Any(BinaryOperatorKind relation, T value) 107bool IConstantValueSet.Any(BinaryOperatorKind relation, ConstantValue value) => value.IsBad || Any(relation, _tc.FromConstantValue(value)); 109public bool All(BinaryOperatorKind relation, T value) 129bool IConstantValueSet.All(BinaryOperatorKind relation, ConstantValue value) => !value.IsBad && All(relation, _tc.FromConstantValue(value));
Utilities\ValueSetFactory.NumericValueSetFactory.cs (4)
10using static BinaryOperatorKind; 29public IConstantValueSet<T> Related(BinaryOperatorKind relation, T value) 52IConstantValueSet IConstantValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue value) => 63bool IConstantValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue left, ConstantValue right)
Utilities\ValueSetFactory.SByteTC.cs (2)
10using static BinaryOperatorKind; 23bool INumericTC<sbyte>.Related(BinaryOperatorKind relation, sbyte left, sbyte right)
Utilities\ValueSetFactory.ShortTC.cs (2)
10using static BinaryOperatorKind; 24bool INumericTC<short>.Related(BinaryOperatorKind relation, short left, short right)
Utilities\ValueSetFactory.SingleTC.cs (2)
10using static BinaryOperatorKind; 68bool INumericTC<float>.Related(BinaryOperatorKind relation, float left, float right)
Utilities\ValueSetFactory.UIntTC.cs (2)
10using static BinaryOperatorKind; 24public bool Related(BinaryOperatorKind relation, uint left, uint right)
Utilities\ValueSetFactory.ULongTC.cs (2)
10using static BinaryOperatorKind; 24bool INumericTC<ulong>.Related(BinaryOperatorKind relation, ulong left, ulong right)
Utilities\ValueSetFactory.UShortTC.cs (2)
10using static BinaryOperatorKind; 24bool INumericTC<ushort>.Related(BinaryOperatorKind relation, ushort left, ushort right)
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (19)
Emit\NumericIntPtrTests.cs (19)
1546BinaryOperatorKind.Addition, 1547BinaryOperatorKind.Subtraction, 1548BinaryOperatorKind.Multiplication, 1549BinaryOperatorKind.Division, 1550BinaryOperatorKind.Remainder, 1551BinaryOperatorKind.LessThan, 1552BinaryOperatorKind.LessThanOrEqual, 1553BinaryOperatorKind.GreaterThan, 1554BinaryOperatorKind.GreaterThanOrEqual, 1555BinaryOperatorKind.LeftShift, 1556BinaryOperatorKind.RightShift, 1557BinaryOperatorKind.Equal, 1558BinaryOperatorKind.NotEqual, 1559BinaryOperatorKind.Or, 1560BinaryOperatorKind.And, 1561BinaryOperatorKind.Xor, 1562BinaryOperatorKind.UnsignedRightShift, 1571foreach (var operatorKind in binaryOperators) 1588static void verifyBinaryOperators(CSharpCompilation comp, BinaryOperatorKind operatorKind, bool skipNativeIntegerOperators)
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (149)
Semantics\NativeIntegerTests.cs (19)
4786BinaryOperatorKind.Addition, 4787BinaryOperatorKind.Subtraction, 4788BinaryOperatorKind.Multiplication, 4789BinaryOperatorKind.Division, 4790BinaryOperatorKind.Remainder, 4791BinaryOperatorKind.LessThan, 4792BinaryOperatorKind.LessThanOrEqual, 4793BinaryOperatorKind.GreaterThan, 4794BinaryOperatorKind.GreaterThanOrEqual, 4795BinaryOperatorKind.LeftShift, 4796BinaryOperatorKind.RightShift, 4797BinaryOperatorKind.Equal, 4798BinaryOperatorKind.NotEqual, 4799BinaryOperatorKind.Or, 4800BinaryOperatorKind.And, 4801BinaryOperatorKind.Xor, 4802BinaryOperatorKind.UnsignedRightShift, 4811foreach (var operatorKind in binaryOperators) 4828static void verifyBinaryOperators(CSharpCompilation comp, BinaryOperatorKind operatorKind, bool skipNativeIntegerOperators)
Semantics\OperatorTests.cs (120)
7341BinaryOperatorKind.Addition, 7342BinaryOperatorKind.Subtraction, 7343BinaryOperatorKind.Multiplication, 7344BinaryOperatorKind.Division, 7345BinaryOperatorKind.Remainder, 7346BinaryOperatorKind.LessThan, 7347BinaryOperatorKind.LessThanOrEqual, 7348BinaryOperatorKind.GreaterThan, 7349BinaryOperatorKind.GreaterThanOrEqual, 7350BinaryOperatorKind.LeftShift, 7351BinaryOperatorKind.RightShift, 7352BinaryOperatorKind.Equal, 7353BinaryOperatorKind.NotEqual, 7354BinaryOperatorKind.Or, 7355BinaryOperatorKind.And, 7356BinaryOperatorKind.Xor, 7357BinaryOperatorKind.UnsignedRightShift, 7360foreach (var op in operators) 7366var signature1 = getBinaryOperator(binder, op, isChecked: false, left, right, useEasyOut: true); 7367var signature2 = getBinaryOperator(binder, op, isChecked: false, left, right, useEasyOut: false); 7368var signature3 = getBinaryOperator(binder, op, isChecked: true, left, right, useEasyOut: false); 7375static BinaryOperatorKind getBinaryOperator(Binder binder, BinaryOperatorKind kind, bool isChecked, BoundExpression left, BoundExpression right, bool useEasyOut) 7389var signature = result.Best.Signature.Kind; 7735BinaryOperatorKind[] operators = 7737BinaryOperatorKind.Addition, 7738BinaryOperatorKind.Subtraction, 7739BinaryOperatorKind.Multiplication, 7740BinaryOperatorKind.Division, 7741BinaryOperatorKind.Remainder, 7742BinaryOperatorKind.Equal, 7743BinaryOperatorKind.NotEqual, 7744BinaryOperatorKind.LessThanOrEqual, 7745BinaryOperatorKind.GreaterThanOrEqual, 7746BinaryOperatorKind.LessThan, 7747BinaryOperatorKind.GreaterThan, 7748BinaryOperatorKind.LeftShift, 7749BinaryOperatorKind.RightShift, 7750BinaryOperatorKind.Xor, 7751BinaryOperatorKind.Or, 7752BinaryOperatorKind.And, 7753BinaryOperatorKind.LogicalOr, 7754BinaryOperatorKind.LogicalAnd, 7755BinaryOperatorKind.UnsignedRightShift, 7883foreach (var op in operators) 7911BinaryOperatorKind[] operators = 7913BinaryOperatorKind.Addition, 7914BinaryOperatorKind.Subtraction, 7915BinaryOperatorKind.Multiplication, 7916BinaryOperatorKind.Division, 7917BinaryOperatorKind.Remainder, 7918BinaryOperatorKind.LeftShift, 7919BinaryOperatorKind.RightShift, 7920BinaryOperatorKind.Xor, 7921BinaryOperatorKind.Or, 7922BinaryOperatorKind.And, 7923BinaryOperatorKind.UnsignedRightShift 8043foreach (var op in operators) 8068BinaryOperatorKind op, 8146case BinaryOperatorKind.LogicalAnd: 8147case BinaryOperatorKind.LogicalOr: 8148case BinaryOperatorKind.UnsignedRightShift when isDynamic: 8156BinaryOperatorKind result = OverloadResolution.BinopEasyOut.OpKind(op, leftType, rightType); 8159if (result == BinaryOperatorKind.Error) 8163signature = new BinaryOperatorSignature(op | BinaryOperatorKind.Dynamic, leftType, rightType, leftType); 8167signature = new BinaryOperatorSignature(op | BinaryOperatorKind.Dynamic, leftType, rightType, rightType); 8169else if ((op == BinaryOperatorKind.Equal || op == BinaryOperatorKind.NotEqual) && 8176signature = new BinaryOperatorSignature(op | BinaryOperatorKind.Delegate, 8183signature = new BinaryOperatorSignature(op | BinaryOperatorKind.Delegate, 8189signature = new BinaryOperatorSignature(op | BinaryOperatorKind.Object, compilation.ObjectType, compilation.ObjectType, 8193else if (op == BinaryOperatorKind.Addition && 8200signature = new BinaryOperatorSignature(op | BinaryOperatorKind.String, leftType, compilation.ObjectType, leftType); 8205signature = new BinaryOperatorSignature(op | BinaryOperatorKind.String, compilation.ObjectType, rightType, rightType); 8208else if (op == BinaryOperatorKind.Addition && 8214signature = new BinaryOperatorSignature(op | BinaryOperatorKind.Pointer, leftType, symbol1.Parameters[1].Type.GetSymbol(), leftType); 8219signature = new BinaryOperatorSignature(op | BinaryOperatorKind.Pointer, symbol1.Parameters[0].Type.GetSymbol(), rightType, rightType); 8223else if (op == BinaryOperatorKind.Subtraction && 8226signature = new BinaryOperatorSignature(op | BinaryOperatorKind.String, leftType, symbol1.Parameters[1].Type.GetSymbol(), leftType); 8229else if (op == BinaryOperatorKind.Subtraction && leftType.IsPointerType() && TypeSymbol.Equals(leftType, rightType, TypeCompareKind.ConsiderEverything2)) 8231signature = new BinaryOperatorSignature(op | BinaryOperatorKind.Pointer, leftType, rightType, compilation.GetSpecialType(SpecialType.System_Int64)); 8233else if ((op == BinaryOperatorKind.Addition || op == BinaryOperatorKind.Subtraction) && 8235(result = OverloadResolution.BinopEasyOut.OpKind(op, leftType.EnumUnderlyingTypeOrSelf(), rightType)) != BinaryOperatorKind.Error && 8238signature = new BinaryOperatorSignature(signature.Kind | BinaryOperatorKind.EnumAndUnderlying, leftType, signature.RightType, leftType); 8240else if ((op == BinaryOperatorKind.Addition || op == BinaryOperatorKind.Subtraction) && 8242(result = OverloadResolution.BinopEasyOut.OpKind(op, leftType, rightType.EnumUnderlyingTypeOrSelf())) != BinaryOperatorKind.Error && 8245signature = new BinaryOperatorSignature(signature.Kind | BinaryOperatorKind.EnumAndUnderlying, signature.LeftType, rightType, rightType); 8247else if (op == BinaryOperatorKind.Subtraction && 8250signature = new BinaryOperatorSignature(op | BinaryOperatorKind.Enum, leftType, rightType, leftType.EnumUnderlyingTypeOrSelf()); 8252else if ((op == BinaryOperatorKind.Equal || 8253op == BinaryOperatorKind.NotEqual || 8254op == BinaryOperatorKind.LessThan || 8255op == BinaryOperatorKind.LessThanOrEqual || 8256op == BinaryOperatorKind.GreaterThan || 8257op == BinaryOperatorKind.GreaterThanOrEqual) && 8260signature = new BinaryOperatorSignature(op | BinaryOperatorKind.Enum, leftType, rightType, compilation.GetSpecialType(SpecialType.System_Boolean)); 8262else if ((op == BinaryOperatorKind.Xor || 8263op == BinaryOperatorKind.And || 8264op == BinaryOperatorKind.Or) && 8267signature = new BinaryOperatorSignature(op | BinaryOperatorKind.Enum, leftType, rightType, leftType); 8269else if ((op == BinaryOperatorKind.Addition || op == BinaryOperatorKind.Subtraction) && 8272signature = new BinaryOperatorSignature(op | BinaryOperatorKind.Delegate, leftType, leftType, leftType); 8274else if ((op == BinaryOperatorKind.Equal || 8275op == BinaryOperatorKind.NotEqual || 8276op == BinaryOperatorKind.LessThan || 8277op == BinaryOperatorKind.LessThanOrEqual || 8278op == BinaryOperatorKind.GreaterThan || 8279op == BinaryOperatorKind.GreaterThanOrEqual) && 8282signature = new BinaryOperatorSignature(op | BinaryOperatorKind.Pointer, 8342else if ((op == BinaryOperatorKind.Equal || op == BinaryOperatorKind.NotEqual) && 8373else if (op == BinaryOperatorKind.Addition || op == BinaryOperatorKind.Subtraction) 8405case BinaryOperatorKind.Multiplication: 8406case BinaryOperatorKind.Addition: 8407case BinaryOperatorKind.Subtraction: 8408case BinaryOperatorKind.Division:
Utilities\ValueSetTests.cs (10)
12using static BinaryOperatorKind; 721var s1 = ForInt.Related(BinaryOperatorKind.Equal, i); 743var s1 = ForInt.Related(BinaryOperatorKind.Equal, j); 764var s1 = ForInt.Related(BinaryOperatorKind.LessThan, i); 772s1 = ForInt.Related(BinaryOperatorKind.GreaterThan, i); 789var s1 = ForInt.Related(BinaryOperatorKind.LessThan, j); 797s1 = ForInt.Related(BinaryOperatorKind.GreaterThan, j); 813var s1 = ForInt.Related(BinaryOperatorKind.Equal, i); 835var s1 = ForInt.Related(BinaryOperatorKind.Equal, j); 878foreach (BinaryOperatorKind relation in new[] { LessThan, Equal, NotEqual })