2056 references to BinaryOperatorKind
Microsoft.CodeAnalysis.CSharp (1888)
Binder\Binder.ValueChecks.cs (1)
4211if (binary.OperatorKind == BinaryOperatorKind.Utf8Addition)
Binder\Binder_InterpolatedString.cs (3)
151: FoldStringConcatenation(BinaryOperatorKind.StringConcatenation, resultConstant, value.ConstantValueOpt); 173: FoldStringConcatenation(BinaryOperatorKind.StringConcatenation, resultConstant, constantValue); 397BinaryOperatorKind.StringConcatenation,
Binder\Binder_Operators.cs (298)
28BinaryOperatorKind kind = SyntaxKindToBinaryOperatorKind(node.Kind()); 35BinaryOperatorKind kindOperator = kind.Operator(); 38case BinaryOperatorKind.Addition: 39case BinaryOperatorKind.Subtraction: 59if (IsLegalDynamicOperand(right) && IsLegalDynamicOperand(left) && kind != BinaryOperatorKind.UnsignedRightShift) 74kind.WithType(BinaryOperatorKind.Dynamic).WithOverflowChecksIfApplicable(CheckOverflowAtRuntime), 180isUnsignedRightShift: bestSignature.Kind.Operator() == BinaryOperatorKind.UnsignedRightShift, bestSignature.ConstrainedToTypeOpt, diagnostics); 258private BoundExpression BindEventAssignment(AssignmentExpressionSyntax node, BoundEventAccess left, BoundExpression right, BinaryOperatorKind opKind, BindingDiagnosticBag diagnostics) 260Debug.Assert(opKind == BinaryOperatorKind.Addition || opKind == BinaryOperatorKind.Subtraction); 283bool isAddition = opKind == BinaryOperatorKind.Addition; 368BinaryOperatorKind kind, 381if (!leftValidOperand || !rightValidOperand || kind == BinaryOperatorKind.UnsignedRightShift) 395if (!IsValidDynamicCondition(left, isNegative: kind == BinaryOperatorKind.LogicalAnd, diagnostics, userDefinedOperator: out userDefinedOperator)) 399Error(diagnostics, ErrorCode.ERR_InvalidDynamicCondition, node.Left, left.Type, kind == BinaryOperatorKind.LogicalAnd ? "false" : "true"); 412operatorKind: (hasError ? kind : kind.WithType(BinaryOperatorKind.Dynamic)).WithOverflowChecksIfApplicable(CheckOverflowAtRuntime), 508BinaryOperatorKind kind = SyntaxKindToBinaryOperatorKind(node.Kind()); 539bool isEquality = kind == BinaryOperatorKind.Equal || kind == BinaryOperatorKind.NotEqual; 542return new BoundLiteral(node, ConstantValue.Create(kind == BinaryOperatorKind.Equal), GetSpecialType(SpecialType.System_Boolean, diagnostics, node)); 546(kind == BinaryOperatorKind.Equal || kind == BinaryOperatorKind.NotEqual)) 553&& kind == BinaryOperatorKind.Addition 558var stringConstant = FoldBinaryOperator(node, BinaryOperatorKind.StringConcatenation, left, right, right.Type, diagnostics); 559return new BoundBinaryOperator(node, BinaryOperatorKind.StringConcatenation, BoundBinaryOperator.UncommonData.UnconvertedInterpolatedStringAddition(stringConstant), LookupResultKind.Empty, left, right, right.Type); 584BinaryOperatorKind resultOperatorKind = signature.Kind; 589resultOperatorKind &= ~BinaryOperatorKind.TypeMask; 605if ((resultOperatorKind & BinaryOperatorKind.Pointer) == BinaryOperatorKind.Pointer && 627isUnsignedRightShift: resultOperatorKind.Operator() == BinaryOperatorKind.UnsignedRightShift, signature.ConstrainedToTypeOpt, diagnostics); 635if (foundOperator && (resultOperatorKind.OperandTypes() != BinaryOperatorKind.NullableNull)) 668private bool BindSimpleBinaryOperatorParts(BinaryExpressionSyntax node, BindingDiagnosticBag diagnostics, BoundExpression left, BoundExpression right, BinaryOperatorKind kind, 691bool isObjectEquality = signature.Kind == BinaryOperatorKind.ObjectEqual || signature.Kind == BinaryOperatorKind.ObjectNotEqual; 700(signature.Kind.Operator() == BinaryOperatorKind.Equal || signature.Kind.Operator() == BinaryOperatorKind.NotEqual) && 706resultSignature = new BinaryOperatorSignature(kind | BinaryOperatorKind.NullableNull, leftType: null, rightType: null, 897BinaryOperatorKind kind = SyntaxKindToBinaryOperatorKind(node.Kind()); 899Debug.Assert(kind == BinaryOperatorKind.LogicalAnd || kind == BinaryOperatorKind.LogicalOr); 908var constantValue = FoldBinaryOperator(node, kind | BinaryOperatorKind.Bool, left, right, left.Type, diagnostics); 911return new BoundBinaryOperator(node, kind | BinaryOperatorKind.Bool, constantValue, methodOpt: null, constrainedToTypeOpt: null, 969var resultKind = kind | signature.Kind.OperandTypes(); 972resultKind |= BinaryOperatorKind.Lifted; 980CheckConstraintLanguageVersionAndRuntimeSupportForOperator(node, kind == BinaryOperatorKind.LogicalAnd ? falseOperator : trueOperator, 1075Debug.Assert(signature.Kind.OperandTypes() == BinaryOperatorKind.UserDefined); 1259private TypeSymbol GetBinaryOperatorErrorType(BinaryOperatorKind kind, BindingDiagnosticBag diagnostics, CSharpSyntaxNode node) 1263case BinaryOperatorKind.Equal: 1264case BinaryOperatorKind.NotEqual: 1265case BinaryOperatorKind.GreaterThan: 1266case BinaryOperatorKind.LessThan: 1267case BinaryOperatorKind.GreaterThanOrEqual: 1268case BinaryOperatorKind.LessThanOrEqual: 1276BinaryOperatorKind kind, 1355private bool IsTypelessExpressionAllowedInBinaryOperator(BinaryOperatorKind kind, BoundExpression left, BoundExpression right) 1366bool isEquality = kind == BinaryOperatorKind.Equal || kind == BinaryOperatorKind.NotEqual; 1456private static object FoldDecimalBinaryOperators(BinaryOperatorKind kind, ConstantValue valueLeft, ConstantValue valueRight) 1472case BinaryOperatorKind.DecimalAddition: 1474case BinaryOperatorKind.DecimalSubtraction: 1476case BinaryOperatorKind.DecimalMultiplication: 1478case BinaryOperatorKind.DecimalDivision: 1480case BinaryOperatorKind.DecimalRemainder: 1487private static object FoldNativeIntegerOverflowingBinaryOperator(BinaryOperatorKind kind, ConstantValue valueLeft, ConstantValue valueRight) 1496case BinaryOperatorKind.NIntAddition: 1498case BinaryOperatorKind.NUIntAddition: 1500case BinaryOperatorKind.NIntSubtraction: 1502case BinaryOperatorKind.NUIntSubtraction: 1504case BinaryOperatorKind.NIntMultiplication: 1506case BinaryOperatorKind.NUIntMultiplication: 1508case BinaryOperatorKind.NIntDivision: 1510case BinaryOperatorKind.NIntRemainder: 1512case BinaryOperatorKind.NIntLeftShift: 1518case BinaryOperatorKind.NUIntLeftShift: 1530private static object FoldUncheckedIntegralBinaryOperator(BinaryOperatorKind kind, ConstantValue valueLeft, ConstantValue valueRight) 1539case BinaryOperatorKind.IntAddition: 1541case BinaryOperatorKind.LongAddition: 1543case BinaryOperatorKind.UIntAddition: 1545case BinaryOperatorKind.ULongAddition: 1547case BinaryOperatorKind.IntSubtraction: 1549case BinaryOperatorKind.LongSubtraction: 1551case BinaryOperatorKind.UIntSubtraction: 1553case BinaryOperatorKind.ULongSubtraction: 1555case BinaryOperatorKind.IntMultiplication: 1557case BinaryOperatorKind.LongMultiplication: 1559case BinaryOperatorKind.UIntMultiplication: 1561case BinaryOperatorKind.ULongMultiplication: 1565case BinaryOperatorKind.IntDivision: 1573case BinaryOperatorKind.LongDivision: 1586private static object FoldCheckedIntegralBinaryOperator(BinaryOperatorKind kind, ConstantValue valueLeft, ConstantValue valueRight) 1595case BinaryOperatorKind.IntAddition: 1597case BinaryOperatorKind.LongAddition: 1599case BinaryOperatorKind.UIntAddition: 1601case BinaryOperatorKind.ULongAddition: 1603case BinaryOperatorKind.IntSubtraction: 1605case BinaryOperatorKind.LongSubtraction: 1607case BinaryOperatorKind.UIntSubtraction: 1609case BinaryOperatorKind.ULongSubtraction: 1611case BinaryOperatorKind.IntMultiplication: 1613case BinaryOperatorKind.LongMultiplication: 1615case BinaryOperatorKind.UIntMultiplication: 1617case BinaryOperatorKind.ULongMultiplication: 1619case BinaryOperatorKind.IntDivision: 1621case BinaryOperatorKind.LongDivision: 1629internal static TypeSymbol GetEnumType(BinaryOperatorKind kind, BoundExpression left, BoundExpression right) 1633case BinaryOperatorKind.EnumAndUnderlyingAddition: 1634case BinaryOperatorKind.EnumAndUnderlyingSubtraction: 1635case BinaryOperatorKind.EnumAnd: 1636case BinaryOperatorKind.EnumOr: 1637case BinaryOperatorKind.EnumXor: 1638case BinaryOperatorKind.EnumEqual: 1639case BinaryOperatorKind.EnumGreaterThan: 1640case BinaryOperatorKind.EnumGreaterThanOrEqual: 1641case BinaryOperatorKind.EnumLessThan: 1642case BinaryOperatorKind.EnumLessThanOrEqual: 1643case BinaryOperatorKind.EnumNotEqual: 1644case BinaryOperatorKind.EnumSubtraction: 1646case BinaryOperatorKind.UnderlyingAndEnumAddition: 1647case BinaryOperatorKind.UnderlyingAndEnumSubtraction: 1678BinaryOperatorKind kind, 1712BinaryOperatorKind newKind = kind.Operator().WithType(newLeftOperand.Type!.SpecialType); 1716case BinaryOperatorKind.Addition: 1717case BinaryOperatorKind.Subtraction: 1718case BinaryOperatorKind.And: 1719case BinaryOperatorKind.Or: 1720case BinaryOperatorKind.Xor: 1724case BinaryOperatorKind.LessThan: 1725case BinaryOperatorKind.LessThanOrEqual: 1726case BinaryOperatorKind.GreaterThan: 1727case BinaryOperatorKind.GreaterThanOrEqual: 1728case BinaryOperatorKind.Equal: 1729case BinaryOperatorKind.NotEqual: 1741TypeSymbol resultType = kind == BinaryOperatorKind.EnumSubtraction ? underlyingType : enumType; 1753BinaryOperatorKind kind, 1908private static ConstantValue? TryFoldingNullableEquality(BinaryOperatorKind kind, BoundExpression left, BoundExpression right) 1912BinaryOperatorKind op = kind.Operator(); 1913if (op == BinaryOperatorKind.Equal || op == BinaryOperatorKind.NotEqual) 1930return (leftIsNull == rightIsNull) == (op == BinaryOperatorKind.Equal) ? ConstantValue.True : ConstantValue.False; 1941private static object? FoldNeverOverflowBinaryOperators(BinaryOperatorKind kind, ConstantValue valueLeft, ConstantValue valueRight) 1950case BinaryOperatorKind.ObjectEqual: 1954case BinaryOperatorKind.ObjectNotEqual: 1958case BinaryOperatorKind.DoubleAddition: 1960case BinaryOperatorKind.FloatAddition: 1962case BinaryOperatorKind.DoubleSubtraction: 1964case BinaryOperatorKind.FloatSubtraction: 1966case BinaryOperatorKind.DoubleMultiplication: 1968case BinaryOperatorKind.FloatMultiplication: 1970case BinaryOperatorKind.DoubleDivision: 1972case BinaryOperatorKind.FloatDivision: 1974case BinaryOperatorKind.DoubleRemainder: 1976case BinaryOperatorKind.FloatRemainder: 1978case BinaryOperatorKind.IntLeftShift: 1980case BinaryOperatorKind.LongLeftShift: 1982case BinaryOperatorKind.UIntLeftShift: 1984case BinaryOperatorKind.ULongLeftShift: 1986case BinaryOperatorKind.IntRightShift: 1987case BinaryOperatorKind.NIntRightShift: 1989case BinaryOperatorKind.IntUnsignedRightShift: 1991case BinaryOperatorKind.NIntUnsignedRightShift: 1993case BinaryOperatorKind.LongRightShift: 1995case BinaryOperatorKind.LongUnsignedRightShift: 1997case BinaryOperatorKind.UIntRightShift: 1998case BinaryOperatorKind.NUIntRightShift: 1999case BinaryOperatorKind.UIntUnsignedRightShift: 2000case BinaryOperatorKind.NUIntUnsignedRightShift: 2002case BinaryOperatorKind.ULongRightShift: 2003case BinaryOperatorKind.ULongUnsignedRightShift: 2005case BinaryOperatorKind.BoolAnd: 2007case BinaryOperatorKind.IntAnd: 2008case BinaryOperatorKind.NIntAnd: 2010case BinaryOperatorKind.LongAnd: 2012case BinaryOperatorKind.UIntAnd: 2013case BinaryOperatorKind.NUIntAnd: 2015case BinaryOperatorKind.ULongAnd: 2017case BinaryOperatorKind.BoolOr: 2019case BinaryOperatorKind.IntOr: 2020case BinaryOperatorKind.NIntOr: 2022case BinaryOperatorKind.LongOr: 2024case BinaryOperatorKind.UIntOr: 2025case BinaryOperatorKind.NUIntOr: 2027case BinaryOperatorKind.ULongOr: 2029case BinaryOperatorKind.BoolXor: 2031case BinaryOperatorKind.IntXor: 2032case BinaryOperatorKind.NIntXor: 2034case BinaryOperatorKind.LongXor: 2036case BinaryOperatorKind.UIntXor: 2037case BinaryOperatorKind.NUIntXor: 2039case BinaryOperatorKind.ULongXor: 2041case BinaryOperatorKind.LogicalBoolAnd: 2043case BinaryOperatorKind.LogicalBoolOr: 2045case BinaryOperatorKind.BoolEqual: 2047case BinaryOperatorKind.StringEqual: 2049case BinaryOperatorKind.DecimalEqual: 2051case BinaryOperatorKind.FloatEqual: 2053case BinaryOperatorKind.DoubleEqual: 2055case BinaryOperatorKind.IntEqual: 2056case BinaryOperatorKind.NIntEqual: 2058case BinaryOperatorKind.LongEqual: 2060case BinaryOperatorKind.UIntEqual: 2061case BinaryOperatorKind.NUIntEqual: 2063case BinaryOperatorKind.ULongEqual: 2065case BinaryOperatorKind.BoolNotEqual: 2067case BinaryOperatorKind.StringNotEqual: 2069case BinaryOperatorKind.DecimalNotEqual: 2071case BinaryOperatorKind.FloatNotEqual: 2073case BinaryOperatorKind.DoubleNotEqual: 2075case BinaryOperatorKind.IntNotEqual: 2076case BinaryOperatorKind.NIntNotEqual: 2078case BinaryOperatorKind.LongNotEqual: 2080case BinaryOperatorKind.UIntNotEqual: 2081case BinaryOperatorKind.NUIntNotEqual: 2083case BinaryOperatorKind.ULongNotEqual: 2085case BinaryOperatorKind.DecimalLessThan: 2087case BinaryOperatorKind.FloatLessThan: 2089case BinaryOperatorKind.DoubleLessThan: 2091case BinaryOperatorKind.IntLessThan: 2092case BinaryOperatorKind.NIntLessThan: 2094case BinaryOperatorKind.LongLessThan: 2096case BinaryOperatorKind.UIntLessThan: 2097case BinaryOperatorKind.NUIntLessThan: 2099case BinaryOperatorKind.ULongLessThan: 2101case BinaryOperatorKind.DecimalGreaterThan: 2103case BinaryOperatorKind.FloatGreaterThan: 2105case BinaryOperatorKind.DoubleGreaterThan: 2107case BinaryOperatorKind.IntGreaterThan: 2108case BinaryOperatorKind.NIntGreaterThan: 2110case BinaryOperatorKind.LongGreaterThan: 2112case BinaryOperatorKind.UIntGreaterThan: 2113case BinaryOperatorKind.NUIntGreaterThan: 2115case BinaryOperatorKind.ULongGreaterThan: 2117case BinaryOperatorKind.DecimalLessThanOrEqual: 2119case BinaryOperatorKind.FloatLessThanOrEqual: 2121case BinaryOperatorKind.DoubleLessThanOrEqual: 2123case BinaryOperatorKind.IntLessThanOrEqual: 2124case BinaryOperatorKind.NIntLessThanOrEqual: 2126case BinaryOperatorKind.LongLessThanOrEqual: 2128case BinaryOperatorKind.UIntLessThanOrEqual: 2129case BinaryOperatorKind.NUIntLessThanOrEqual: 2131case BinaryOperatorKind.ULongLessThanOrEqual: 2133case BinaryOperatorKind.DecimalGreaterThanOrEqual: 2135case BinaryOperatorKind.FloatGreaterThanOrEqual: 2137case BinaryOperatorKind.DoubleGreaterThanOrEqual: 2139case BinaryOperatorKind.IntGreaterThanOrEqual: 2140case BinaryOperatorKind.NIntGreaterThanOrEqual: 2142case BinaryOperatorKind.LongGreaterThanOrEqual: 2144case BinaryOperatorKind.UIntGreaterThanOrEqual: 2145case BinaryOperatorKind.NUIntGreaterThanOrEqual: 2147case BinaryOperatorKind.ULongGreaterThanOrEqual: 2149case BinaryOperatorKind.UIntDivision: 2150case BinaryOperatorKind.NUIntDivision: 2152case BinaryOperatorKind.ULongDivision: 2156case BinaryOperatorKind.IntRemainder: 2158case BinaryOperatorKind.LongRemainder: 2160case BinaryOperatorKind.UIntRemainder: 2161case BinaryOperatorKind.NUIntRemainder: 2163case BinaryOperatorKind.ULongRemainder: 2173private static ConstantValue? FoldStringConcatenation(BinaryOperatorKind kind, ConstantValue valueLeft, ConstantValue valueRight) 2178if (kind == BinaryOperatorKind.StringConcatenation) 2191public static BinaryOperatorKind SyntaxKindToBinaryOperatorKind(SyntaxKind kind) 2196case SyntaxKind.MultiplyExpression: return BinaryOperatorKind.Multiplication; 2198case SyntaxKind.DivideExpression: return BinaryOperatorKind.Division; 2200case SyntaxKind.ModuloExpression: return BinaryOperatorKind.Remainder; 2202case SyntaxKind.AddExpression: return BinaryOperatorKind.Addition; 2204case SyntaxKind.SubtractExpression: return BinaryOperatorKind.Subtraction; 2206case SyntaxKind.RightShiftExpression: return BinaryOperatorKind.RightShift; 2208case SyntaxKind.UnsignedRightShiftExpression: return BinaryOperatorKind.UnsignedRightShift; 2210case SyntaxKind.LeftShiftExpression: return BinaryOperatorKind.LeftShift; 2211case SyntaxKind.EqualsExpression: return BinaryOperatorKind.Equal; 2212case SyntaxKind.NotEqualsExpression: return BinaryOperatorKind.NotEqual; 2213case SyntaxKind.GreaterThanExpression: return BinaryOperatorKind.GreaterThan; 2214case SyntaxKind.LessThanExpression: return BinaryOperatorKind.LessThan; 2215case SyntaxKind.GreaterThanOrEqualExpression: return BinaryOperatorKind.GreaterThanOrEqual; 2216case SyntaxKind.LessThanOrEqualExpression: return BinaryOperatorKind.LessThanOrEqual; 2218case SyntaxKind.BitwiseAndExpression: return BinaryOperatorKind.And; 2220case SyntaxKind.BitwiseOrExpression: return BinaryOperatorKind.Or; 2222case SyntaxKind.ExclusiveOrExpression: return BinaryOperatorKind.Xor; 2223case SyntaxKind.LogicalAndExpression: return BinaryOperatorKind.LogicalAnd; 2224case SyntaxKind.LogicalOrExpression: return BinaryOperatorKind.LogicalOr; 3082private static bool IsDivisionByZero(BinaryOperatorKind kind, ConstantValue valueRight) 3088case BinaryOperatorKind.DecimalDivision: 3089case BinaryOperatorKind.DecimalRemainder: 3091case BinaryOperatorKind.IntDivision: 3092case BinaryOperatorKind.IntRemainder: 3093case BinaryOperatorKind.NIntDivision: 3094case BinaryOperatorKind.NIntRemainder: 3096case BinaryOperatorKind.LongDivision: 3097case BinaryOperatorKind.LongRemainder: 3099case BinaryOperatorKind.UIntDivision: 3100case BinaryOperatorKind.UIntRemainder: 3101case BinaryOperatorKind.NUIntDivision: 3102case BinaryOperatorKind.NUIntRemainder: 3104case BinaryOperatorKind.ULongDivision: 3105case BinaryOperatorKind.ULongRemainder: 4362private void CheckNativeIntegerFeatureAvailability(BinaryOperatorKind operatorKind, SyntaxNode syntax, BindingDiagnosticBag diagnostics) 4369switch (operatorKind & BinaryOperatorKind.TypeMask) 4371case BinaryOperatorKind.NInt: 4372case BinaryOperatorKind.NUInt:
Binder\Binder_Patterns.cs (32)
1625BinaryOperatorKind operation = tokenKindToBinaryOperatorKind(node.OperatorToken.Kind()); 1626if (operation == BinaryOperatorKind.Equal) 1632BinaryOperatorKind opType = RelationalOperatorType(value.Type.EnumUnderlyingTypeOrSelf()); 1635case BinaryOperatorKind.Float: 1636case BinaryOperatorKind.Double: 1643case BinaryOperatorKind.String: 1644case BinaryOperatorKind.Bool: 1645case BinaryOperatorKind.Error: 1669static BinaryOperatorKind tokenKindToBinaryOperatorKind(SyntaxKind kind) => kind switch 1671SyntaxKind.LessThanEqualsToken => BinaryOperatorKind.LessThanOrEqual, 1672SyntaxKind.LessThanToken => BinaryOperatorKind.LessThan, 1673SyntaxKind.GreaterThanToken => BinaryOperatorKind.GreaterThan, 1674SyntaxKind.GreaterThanEqualsToken => BinaryOperatorKind.GreaterThanOrEqual, 1676_ => BinaryOperatorKind.Equal, 1685internal static BinaryOperatorKind RelationalOperatorType(TypeSymbol type) => type.SpecialType switch 1687SpecialType.System_Single => BinaryOperatorKind.Float, 1688SpecialType.System_Double => BinaryOperatorKind.Double, 1689SpecialType.System_Char => BinaryOperatorKind.Char, 1690SpecialType.System_SByte => BinaryOperatorKind.Int, // operands are converted to int 1691SpecialType.System_Byte => BinaryOperatorKind.Int, // operands are converted to int 1692SpecialType.System_UInt16 => BinaryOperatorKind.Int, // operands are converted to int 1693SpecialType.System_Int16 => BinaryOperatorKind.Int, // operands are converted to int 1694SpecialType.System_Int32 => BinaryOperatorKind.Int, 1695SpecialType.System_UInt32 => BinaryOperatorKind.UInt, 1696SpecialType.System_Int64 => BinaryOperatorKind.Long, 1697SpecialType.System_UInt64 => BinaryOperatorKind.ULong, 1698SpecialType.System_Decimal => BinaryOperatorKind.Decimal, 1699SpecialType.System_String => BinaryOperatorKind.String, 1700SpecialType.System_Boolean => BinaryOperatorKind.Bool, 1701SpecialType.System_IntPtr when type.IsNativeIntegerType => BinaryOperatorKind.NInt, 1702SpecialType.System_UIntPtr when type.IsNativeIntegerType => BinaryOperatorKind.NUInt, 1703_ => BinaryOperatorKind.Error,
Binder\Binder_TupleOperators.cs (9)
25private BoundTupleBinaryOperator BindTupleBinaryOperator(BinaryExpressionSyntax node, BinaryOperatorKind kind, 82private TupleBinaryOperatorInfo BindTupleBinaryOperatorInfo(BinaryExpressionSyntax node, BinaryOperatorKind kind, 125private void PrepareBoolConversionAndTruthOperator(TypeSymbol type, BinaryExpressionSyntax node, BinaryOperatorKind binaryOperator, BindingDiagnosticBag diagnostics, 148case BinaryOperatorKind.Equal: 151case BinaryOperatorKind.NotEqual: 179private TupleBinaryOperatorInfo BindTupleDynamicBinaryOperatorSingleInfo(BinaryExpressionSyntax node, BinaryOperatorKind kind, 193BinaryOperatorKind elementOperatorKind = hasError ? kind : kind.WithType(BinaryOperatorKind.Dynamic); 202private TupleBinaryOperatorInfo.Multiple BindTupleBinaryOperatorNestedInfo(BinaryExpressionSyntax node, BinaryOperatorKind kind,
Binder\DecisionDagBuilder.cs (15)
499if (ValueSetFactory.ForInput(input)?.Related(BinaryOperatorKind.Equal, constant.ConstantValue).IsEmpty == true) 1092return resultForRelation(BinaryOperatorKind.Equal, t.Value); 1104resultForRelation(BinaryOperatorKind relation, ConstantValue value) 1304handleRelationWithValue(BinaryOperatorKind.Equal, v2.Value, 1309BinaryOperatorKind relation, 1444if (lengthValues.All(BinaryOperatorKind.Equal, lengthValue)) 1450if (!_forLowering && lengthValues.Any(BinaryOperatorKind.Equal, lengthValue)) 1720BinaryOperatorKind.LessThan => "<", 1721BinaryOperatorKind.LessThanOrEqual => "<=", 1722BinaryOperatorKind.GreaterThan => ">", 1723BinaryOperatorKind.GreaterThanOrEqual => ">=", 2071Debug.Assert(t.Relation == BinaryOperatorKind.GreaterThanOrEqual); 2086return knownResult(BinaryOperatorKind.Equal, t.Value, offset) ?? 2098static Tests? knownResult(BinaryOperatorKind relation, ConstantValue constant, int offset) 2101var possibleValues = fac.Related(BinaryOperatorKind.LessThanOrEqual, int.MaxValue - offset);
Binder\DecisionDagBuilder_ListPatterns.cs (1)
45? new BoundDagRelationalTest(syntax, BinaryOperatorKind.IntGreaterThanOrEqual, ConstantValue.Create(subpatterns.Length - 1), lengthTemp)
Binder\PatternExplainer.cs (7)
408if (lengthValues.All(BinaryOperatorKind.Equal, lengthValue)) 605addRelation(BinaryOperatorKind.Equal, v.Value); 612void addRelation(BinaryOperatorKind relation, ConstantValue value) 655remainingValues.Any(BinaryOperatorKind.Equal, constantValue)) 676if (remainingValues.Any(BinaryOperatorKind.GreaterThan, ConstantValue.Create(int.MaxValue))) 679if (remainingValues.Any(BinaryOperatorKind.LessThan, ConstantValue.Create(int.MinValue))) 684if (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 (142)
20public void BinaryOperatorOverloadResolution(BinaryOperatorKind kind, bool isChecked, BoundExpression left, BoundExpression right, BinaryOperatorOverloadResolutionResult result, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 32internal void BinaryOperatorOverloadResolution_EasyOut(BinaryOperatorKind kind, BoundExpression left, BoundExpression right, BinaryOperatorOverloadResolutionResult result) 43BinaryOperatorKind underlyingKind = kind & ~BinaryOperatorKind.Logical; 49BinaryOperatorKind kind, 209private bool GetUserDefinedBinaryOperatorsFromInterfaces(BinaryOperatorKind kind, bool isChecked, 305private void AddDelegateOperation(BinaryOperatorKind kind, TypeSymbol delegateType, 310case BinaryOperatorKind.Equal: 311case BinaryOperatorKind.NotEqual: 312operators.Add(new BinaryOperatorSignature(kind | BinaryOperatorKind.Delegate, delegateType, delegateType, Compilation.GetSpecialType(SpecialType.System_Boolean))); 315case BinaryOperatorKind.Addition: 316case BinaryOperatorKind.Subtraction: 318operators.Add(new BinaryOperatorSignature(kind | BinaryOperatorKind.Delegate, delegateType, delegateType, delegateType)); 323private void GetDelegateOperations(BinaryOperatorKind kind, BoundExpression left, BoundExpression right, 332case BinaryOperatorKind.Multiplication: 333case BinaryOperatorKind.Division: 334case BinaryOperatorKind.Remainder: 335case BinaryOperatorKind.RightShift: 336case BinaryOperatorKind.UnsignedRightShift: 337case BinaryOperatorKind.LeftShift: 338case BinaryOperatorKind.And: 339case BinaryOperatorKind.Or: 340case BinaryOperatorKind.Xor: 341case BinaryOperatorKind.GreaterThan: 342case BinaryOperatorKind.LessThan: 343case BinaryOperatorKind.GreaterThanOrEqual: 344case BinaryOperatorKind.LessThanOrEqual: 345case BinaryOperatorKind.LogicalAnd: 346case BinaryOperatorKind.LogicalOr: 349case BinaryOperatorKind.Addition: 350case BinaryOperatorKind.Subtraction: 351case BinaryOperatorKind.Equal: 352case BinaryOperatorKind.NotEqual: 378case BinaryOperatorKind.Equal: 379case BinaryOperatorKind.NotEqual: 441bool useIdentityConversion = kind == BinaryOperatorKind.Equal || kind == BinaryOperatorKind.NotEqual; 455if ((kind == BinaryOperatorKind.Equal || kind == BinaryOperatorKind.NotEqual) 464private void GetEnumOperation(BinaryOperatorKind kind, TypeSymbol enumType, BoundExpression right, ArrayBuilder<BinaryOperatorSignature> operators) 484case BinaryOperatorKind.Addition: 485operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.EnumAndUnderlyingAddition, enumType, underlying, enumType)); 486operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.UnderlyingAndEnumAddition, underlying, enumType, enumType)); 487operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.LiftedEnumAndUnderlyingAddition, nullableEnum, nullableUnderlying, nullableEnum)); 488operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.LiftedUnderlyingAndEnumAddition, nullableUnderlying, nullableEnum, nullableEnum)); 490case BinaryOperatorKind.Subtraction: 493operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.EnumSubtraction, enumType, enumType, underlying)); 494operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.EnumAndUnderlyingSubtraction, enumType, underlying, enumType)); 495operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.LiftedEnumSubtraction, nullableEnum, nullableEnum, nullableUnderlying)); 496operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.LiftedEnumAndUnderlyingSubtraction, nullableEnum, nullableUnderlying, nullableEnum)); 506operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.EnumSubtraction, enumType, enumType, underlying) 508operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.EnumAndUnderlyingSubtraction, enumType, underlying, enumType) 510operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.LiftedEnumSubtraction, nullableEnum, nullableEnum, nullableUnderlying) 512operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.LiftedEnumAndUnderlyingSubtraction, nullableEnum, nullableUnderlying, nullableEnum) 516operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.UnderlyingAndEnumSubtraction, underlying, enumType, enumType) 518operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.LiftedUnderlyingAndEnumSubtraction, nullableUnderlying, nullableEnum, nullableEnum) 522case BinaryOperatorKind.Equal: 523case BinaryOperatorKind.NotEqual: 524case BinaryOperatorKind.GreaterThan: 525case BinaryOperatorKind.LessThan: 526case BinaryOperatorKind.GreaterThanOrEqual: 527case BinaryOperatorKind.LessThanOrEqual: 529operators.Add(new BinaryOperatorSignature(kind | BinaryOperatorKind.Enum, enumType, enumType, boolean)); 530operators.Add(new BinaryOperatorSignature(kind | BinaryOperatorKind.Lifted | BinaryOperatorKind.Enum, nullableEnum, nullableEnum, boolean)); 532case BinaryOperatorKind.And: 533case BinaryOperatorKind.Or: 534case BinaryOperatorKind.Xor: 535operators.Add(new BinaryOperatorSignature(kind | BinaryOperatorKind.Enum, enumType, enumType, enumType)); 536operators.Add(new BinaryOperatorSignature(kind | BinaryOperatorKind.Lifted | BinaryOperatorKind.Enum, nullableEnum, nullableEnum, nullableEnum)); 542BinaryOperatorKind kind, 551case BinaryOperatorKind.Addition: 552operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.PointerAndIntAddition, pointerType, Compilation.GetSpecialType(SpecialType.System_Int32), pointerType)); 553operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.PointerAndUIntAddition, pointerType, Compilation.GetSpecialType(SpecialType.System_UInt32), pointerType)); 554operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.PointerAndLongAddition, pointerType, Compilation.GetSpecialType(SpecialType.System_Int64), pointerType)); 555operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.PointerAndULongAddition, pointerType, Compilation.GetSpecialType(SpecialType.System_UInt64), pointerType)); 556operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.IntAndPointerAddition, Compilation.GetSpecialType(SpecialType.System_Int32), pointerType, pointerType)); 557operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.UIntAndPointerAddition, Compilation.GetSpecialType(SpecialType.System_UInt32), pointerType, pointerType)); 558operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.LongAndPointerAddition, Compilation.GetSpecialType(SpecialType.System_Int64), pointerType, pointerType)); 559operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.ULongAndPointerAddition, Compilation.GetSpecialType(SpecialType.System_UInt64), pointerType, pointerType)); 561case BinaryOperatorKind.Subtraction: 562operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.PointerAndIntSubtraction, pointerType, Compilation.GetSpecialType(SpecialType.System_Int32), pointerType)); 563operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.PointerAndUIntSubtraction, pointerType, Compilation.GetSpecialType(SpecialType.System_UInt32), pointerType)); 564operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.PointerAndLongSubtraction, pointerType, Compilation.GetSpecialType(SpecialType.System_Int64), pointerType)); 565operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.PointerAndULongSubtraction, pointerType, Compilation.GetSpecialType(SpecialType.System_UInt64), pointerType)); 566operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.PointerSubtraction, pointerType, pointerType, Compilation.GetSpecialType(SpecialType.System_Int64))); 572BinaryOperatorKind kind, 577case BinaryOperatorKind.Equal: 578case BinaryOperatorKind.NotEqual: 579case BinaryOperatorKind.GreaterThan: 580case BinaryOperatorKind.LessThan: 581case BinaryOperatorKind.GreaterThanOrEqual: 582case BinaryOperatorKind.LessThanOrEqual: 584operators.Add(new BinaryOperatorSignature(kind | BinaryOperatorKind.Pointer, voidPointerType, voidPointerType, Compilation.GetSpecialType(SpecialType.System_Boolean))); 589private void GetEnumOperations(BinaryOperatorKind kind, BoundExpression left, BoundExpression right, ArrayBuilder<BinaryOperatorSignature> results) 598case BinaryOperatorKind.Multiplication: 599case BinaryOperatorKind.Division: 600case BinaryOperatorKind.Remainder: 601case BinaryOperatorKind.RightShift: 602case BinaryOperatorKind.UnsignedRightShift: 603case BinaryOperatorKind.LeftShift: 604case BinaryOperatorKind.LogicalAnd: 605case BinaryOperatorKind.LogicalOr: 624case BinaryOperatorKind.And: 625case BinaryOperatorKind.Or: 626case BinaryOperatorKind.Xor: 633case BinaryOperatorKind.Addition: 640case BinaryOperatorKind.Subtraction: 647case BinaryOperatorKind.Equal: 648case BinaryOperatorKind.NotEqual: 649case BinaryOperatorKind.GreaterThan: 650case BinaryOperatorKind.LessThan: 651case BinaryOperatorKind.GreaterThanOrEqual: 652case BinaryOperatorKind.LessThanOrEqual: 675BinaryOperatorKind kind, 707private void GetAllBuiltInOperators(BinaryOperatorKind kind, bool isChecked, BoundExpression left, BoundExpression right, ArrayBuilder<BinaryOperatorAnalysisResult> results, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 713bool isEquality = kind == BinaryOperatorKind.Equal || kind == BinaryOperatorKind.NotEqual; 734if (kind.Operator() is BinaryOperatorKind.Addition && 756return value is BoundUtf8String or BoundBinaryOperator { OperatorKind: BinaryOperatorKind.Utf8Addition }; 760private void GetReferenceEquality(BinaryOperatorKind kind, ArrayBuilder<BinaryOperatorSignature> operators) 763operators.Add(new BinaryOperatorSignature(kind | BinaryOperatorKind.Object, @object, @object, Compilation.GetSpecialType(SpecialType.System_Boolean))); 829BinaryOperatorKind kind, 896BinaryOperatorKind kind, 936void getDeclaredOperators(TypeSymbol constrainedToTypeOpt, NamedTypeSymbol type, BinaryOperatorKind kind, string name, ArrayBuilder<BinaryOperatorSignature> operators) 950operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.UserDefined | kind, leftOperandType, rightOperandType, resultType, op, constrainedToTypeOpt)); 954void addLiftedOperators(TypeSymbol constrainedToTypeOpt, BinaryOperatorKind kind, ArrayBuilder<BinaryOperatorSignature> operators) 968BinaryOperatorKind.Lifted | BinaryOperatorKind.UserDefined | kind, 974BinaryOperatorKind.Lifted | BinaryOperatorKind.UserDefined | kind, 988private static LiftingResult UserDefinedBinaryOperatorCanBeLifted(TypeSymbol left, TypeSymbol right, TypeSymbol result, BinaryOperatorKind kind) 1013case BinaryOperatorKind.Equal: 1014case BinaryOperatorKind.NotEqual: 1018goto case BinaryOperatorKind.GreaterThan; 1019case BinaryOperatorKind.GreaterThan: 1020case BinaryOperatorKind.GreaterThanOrEqual: 1021case BinaryOperatorKind.LessThan: 1022case BinaryOperatorKind.LessThanOrEqual: 1342private static void AssertNotChecked(BinaryOperatorKind kind) 1344Debug.Assert((kind & ~BinaryOperatorKind.Checked) == kind, "Did not expect operator to be checked. Consider using .Operator() to mask.");
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)
188public static string BinaryOperatorNameFromOperatorKind(BinaryOperatorKind kind, bool isChecked) 190switch (kind & BinaryOperatorKind.OpMask) 192case BinaryOperatorKind.Addition: return isChecked ? WellKnownMemberNames.CheckedAdditionOperatorName : WellKnownMemberNames.AdditionOperatorName; 193case BinaryOperatorKind.And: return WellKnownMemberNames.BitwiseAndOperatorName; 194case BinaryOperatorKind.Division: return isChecked ? WellKnownMemberNames.CheckedDivisionOperatorName : WellKnownMemberNames.DivisionOperatorName; 195case BinaryOperatorKind.Equal: return WellKnownMemberNames.EqualityOperatorName; 196case BinaryOperatorKind.GreaterThan: return WellKnownMemberNames.GreaterThanOperatorName; 197case BinaryOperatorKind.GreaterThanOrEqual: return WellKnownMemberNames.GreaterThanOrEqualOperatorName; 198case BinaryOperatorKind.LeftShift: return WellKnownMemberNames.LeftShiftOperatorName; 199case BinaryOperatorKind.LessThan: return WellKnownMemberNames.LessThanOperatorName; 200case BinaryOperatorKind.LessThanOrEqual: return WellKnownMemberNames.LessThanOrEqualOperatorName; 201case BinaryOperatorKind.Multiplication: return isChecked ? WellKnownMemberNames.CheckedMultiplyOperatorName : WellKnownMemberNames.MultiplyOperatorName; 202case BinaryOperatorKind.Or: return WellKnownMemberNames.BitwiseOrOperatorName; 203case BinaryOperatorKind.NotEqual: return WellKnownMemberNames.InequalityOperatorName; 204case BinaryOperatorKind.Remainder: return WellKnownMemberNames.ModulusOperatorName; 205case BinaryOperatorKind.RightShift: return WellKnownMemberNames.RightShiftOperatorName; 206case BinaryOperatorKind.UnsignedRightShift: return WellKnownMemberNames.UnsignedRightShiftOperatorName; 207case BinaryOperatorKind.Subtraction: return isChecked ? WellKnownMemberNames.CheckedSubtractionOperatorName : WellKnownMemberNames.SubtractionOperatorName; 208case BinaryOperatorKind.Xor: return WellKnownMemberNames.ExclusiveOrOperatorName; 210throw 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)
94BinaryOperatorKind.LessThan => "<", 95BinaryOperatorKind.LessThanOrEqual => "<=", 96BinaryOperatorKind.GreaterThan => ">", 97BinaryOperatorKind.GreaterThanOrEqual => ">=",
BoundTree\Constructors.cs (5)
372BinaryOperatorKind operatorKind, 395BinaryOperatorKind operatorKind, 408public BoundBinaryOperator Update(BinaryOperatorKind operatorKind, 431BinaryOperatorKind operatorKind, 459public BoundUserDefinedConditionalLogicalOperator Update(BinaryOperatorKind operatorKind,
BoundTree\TupleBinaryOperatorInfo.cs (4)
47internal readonly BinaryOperatorKind Kind; 59BinaryOperatorKind kind, 140internal readonly BinaryOperatorKind Kind; 142internal NullNull(BinaryOperatorKind kind)
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: 399case BinaryOperatorKind.LessThan: 403case BinaryOperatorKind.LessThanOrEqual: 408case BinaryOperatorKind.GreaterThan: 412case BinaryOperatorKind.GreaterThanOrEqual: 579case BinaryOperatorKind.EnumAndUnderlyingAddition: 580case BinaryOperatorKind.EnumSubtraction: 581case BinaryOperatorKind.EnumAndUnderlyingSubtraction: 584case BinaryOperatorKind.EnumAnd: 585case BinaryOperatorKind.EnumOr: 586case BinaryOperatorKind.EnumXor: 590case BinaryOperatorKind.UnderlyingAndEnumSubtraction: 591case BinaryOperatorKind.UnderlyingAndEnumAddition: 630case BinaryOperatorKind.Multiplication: 641case BinaryOperatorKind.Addition: 652case BinaryOperatorKind.Subtraction: 668private static bool OperatorHasSideEffects(BinaryOperatorKind kind) 672case BinaryOperatorKind.Division: 673case BinaryOperatorKind.Remainder: 706BinaryOperatorKind opKind = op.OperatorKind; 707Debug.Assert(opKind.Operator() != BinaryOperatorKind.UnsignedRightShift); 709BinaryOperatorKind type = opKind.OperandTypes(); 712case BinaryOperatorKind.Enum: 713case BinaryOperatorKind.EnumAndUnderlying: 716case BinaryOperatorKind.UnderlyingAndEnum: 719case BinaryOperatorKind.UInt: 720case BinaryOperatorKind.NUInt: 721case BinaryOperatorKind.ULong: 722case BinaryOperatorKind.ULongAndPointer: 723case BinaryOperatorKind.PointerAndInt: 724case BinaryOperatorKind.PointerAndUInt: 725case BinaryOperatorKind.PointerAndLong: 726case BinaryOperatorKind.PointerAndULong: 727case BinaryOperatorKind.Pointer: 731case BinaryOperatorKind.IntAndPointer: 732case BinaryOperatorKind.LongAndPointer: 734case BinaryOperatorKind.UIntAndPointer: 740private static bool IsConditional(BinaryOperatorKind opKind) 744case BinaryOperatorKind.LogicalAnd: 745case BinaryOperatorKind.LogicalOr: 746case BinaryOperatorKind.Equal: 747case BinaryOperatorKind.NotEqual: 748case BinaryOperatorKind.LessThan: 749case BinaryOperatorKind.LessThanOrEqual: 750case BinaryOperatorKind.GreaterThan: 751case BinaryOperatorKind.GreaterThanOrEqual: 754case BinaryOperatorKind.And: 755case BinaryOperatorKind.Or: 756case BinaryOperatorKind.Xor: 757return opKind.OperandTypes() == BinaryOperatorKind.Bool; 763private static bool IsFloat(BinaryOperatorKind opKind) 765var type = opKind.OperandTypes(); 768case BinaryOperatorKind.Float: 769case 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)
1443var isLogical = (binary.OperatorKind & BinaryOperatorKind.Logical) != 0; 1481var 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: 699new BinaryOperatorSignature(BinaryOperatorKind.Utf8Addition, readonlySpanOfByte, readonlySpanOfByte, readonlySpanOfByte)), null); 705internal BinaryOperatorSignature GetSignature(BinaryOperatorKind kind) 710case BinaryOperatorKind.Multiplication: 711case BinaryOperatorKind.Division: 712case BinaryOperatorKind.Subtraction: 713case BinaryOperatorKind.Remainder: 714case BinaryOperatorKind.And: 715case BinaryOperatorKind.Or: 716case BinaryOperatorKind.Xor: 718case BinaryOperatorKind.Addition: 720case BinaryOperatorKind.LeftShift: 721case BinaryOperatorKind.RightShift: 722case BinaryOperatorKind.UnsignedRightShift: 730case BinaryOperatorKind.Equal: 731case BinaryOperatorKind.NotEqual: 732case BinaryOperatorKind.GreaterThan: 733case BinaryOperatorKind.LessThan: 734case BinaryOperatorKind.GreaterThanOrEqual: 735case BinaryOperatorKind.LessThanOrEqual: 741private TypeSymbol LeftType(BinaryOperatorKind kind) 751case BinaryOperatorKind.Int: return _compilation.GetSpecialType(SpecialType.System_Int32); 752case BinaryOperatorKind.UInt: return _compilation.GetSpecialType(SpecialType.System_UInt32); 753case BinaryOperatorKind.Long: return _compilation.GetSpecialType(SpecialType.System_Int64); 754case BinaryOperatorKind.ULong: return _compilation.GetSpecialType(SpecialType.System_UInt64); 755case BinaryOperatorKind.NInt: return _compilation.CreateNativeIntegerTypeSymbol(signed: true); 756case BinaryOperatorKind.NUInt: return _compilation.CreateNativeIntegerTypeSymbol(signed: false); 757case BinaryOperatorKind.Float: return _compilation.GetSpecialType(SpecialType.System_Single); 758case BinaryOperatorKind.Double: return _compilation.GetSpecialType(SpecialType.System_Double); 759case BinaryOperatorKind.Decimal: return _compilation.GetSpecialType(SpecialType.System_Decimal); 760case BinaryOperatorKind.Bool: return _compilation.GetSpecialType(SpecialType.System_Boolean); 761case BinaryOperatorKind.ObjectAndString: 762case BinaryOperatorKind.Object: 764case BinaryOperatorKind.String: 765case BinaryOperatorKind.StringAndObject: 773private TypeSymbol RightType(BinaryOperatorKind kind) 783case BinaryOperatorKind.Int: return _compilation.GetSpecialType(SpecialType.System_Int32); 784case BinaryOperatorKind.UInt: return _compilation.GetSpecialType(SpecialType.System_UInt32); 785case BinaryOperatorKind.Long: return _compilation.GetSpecialType(SpecialType.System_Int64); 786case BinaryOperatorKind.ULong: return _compilation.GetSpecialType(SpecialType.System_UInt64); 787case BinaryOperatorKind.NInt: return _compilation.CreateNativeIntegerTypeSymbol(signed: true); 788case BinaryOperatorKind.NUInt: return _compilation.CreateNativeIntegerTypeSymbol(signed: false); 789case BinaryOperatorKind.Float: return _compilation.GetSpecialType(SpecialType.System_Single); 790case BinaryOperatorKind.Double: return _compilation.GetSpecialType(SpecialType.System_Double); 791case BinaryOperatorKind.Decimal: return _compilation.GetSpecialType(SpecialType.System_Decimal); 792case BinaryOperatorKind.Bool: return _compilation.GetSpecialType(SpecialType.System_Boolean); 793case BinaryOperatorKind.ObjectAndString: 794case BinaryOperatorKind.String: 796case BinaryOperatorKind.StringAndObject: 797case BinaryOperatorKind.Object: 805private TypeSymbol ReturnType(BinaryOperatorKind kind) 815case BinaryOperatorKind.Int: return _compilation.GetSpecialType(SpecialType.System_Int32); 816case BinaryOperatorKind.UInt: return _compilation.GetSpecialType(SpecialType.System_UInt32); 817case BinaryOperatorKind.Long: return _compilation.GetSpecialType(SpecialType.System_Int64); 818case BinaryOperatorKind.ULong: return _compilation.GetSpecialType(SpecialType.System_UInt64); 819case BinaryOperatorKind.NInt: return _compilation.CreateNativeIntegerTypeSymbol(signed: true); 820case BinaryOperatorKind.NUInt: return _compilation.CreateNativeIntegerTypeSymbol(signed: false); 821case BinaryOperatorKind.Float: return _compilation.GetSpecialType(SpecialType.System_Single); 822case BinaryOperatorKind.Double: return _compilation.GetSpecialType(SpecialType.System_Double); 823case BinaryOperatorKind.Decimal: return _compilation.GetSpecialType(SpecialType.System_Decimal); 824case BinaryOperatorKind.Bool: return _compilation.GetSpecialType(SpecialType.System_Boolean); 825case BinaryOperatorKind.Object: return _compilation.GetSpecialType(SpecialType.System_Object); 826case BinaryOperatorKind.ObjectAndString: 827case BinaryOperatorKind.StringAndObject: 828case BinaryOperatorKind.String: 836private TypeSymbol LiftedType(BinaryOperatorKind kind) 844case BinaryOperatorKind.Int: return nullable.Construct(_compilation.GetSpecialType(SpecialType.System_Int32)); 845case BinaryOperatorKind.UInt: return nullable.Construct(_compilation.GetSpecialType(SpecialType.System_UInt32)); 846case BinaryOperatorKind.Long: return nullable.Construct(_compilation.GetSpecialType(SpecialType.System_Int64)); 847case BinaryOperatorKind.ULong: return nullable.Construct(_compilation.GetSpecialType(SpecialType.System_UInt64)); 848case BinaryOperatorKind.NInt: return nullable.Construct(_compilation.CreateNativeIntegerTypeSymbol(signed: true)); 849case BinaryOperatorKind.NUInt: return nullable.Construct(_compilation.CreateNativeIntegerTypeSymbol(signed: false)); 850case BinaryOperatorKind.Float: return nullable.Construct(_compilation.GetSpecialType(SpecialType.System_Single)); 851case BinaryOperatorKind.Double: return nullable.Construct(_compilation.GetSpecialType(SpecialType.System_Double)); 852case BinaryOperatorKind.Decimal: return nullable.Construct(_compilation.GetSpecialType(SpecialType.System_Decimal)); 853case BinaryOperatorKind.Bool: return nullable.Construct(_compilation.GetSpecialType(SpecialType.System_Boolean));
Compilation\CSharpCompilation.cs (32)
3949var binaryKind = Binder.SyntaxKindToBinaryOperatorKind(SyntaxFacts.GetBinaryExpression(syntaxKind)); 3955var easyOutBinaryKind = OverloadResolution.BinopEasyOut.OpKind(binaryKind, csharpLeftType, csharpRightType); 3957if (easyOutBinaryKind != BinaryOperatorKind.Error) 3973if (binaryKind is BinaryOperatorKind.Equal or BinaryOperatorKind.NotEqual && 3990if (binaryKind is BinaryOperatorKind.Equal or BinaryOperatorKind.NotEqual && 3998if (binaryKind is BinaryOperatorKind.Addition or BinaryOperatorKind.Subtraction && 4013if (binaryKind is BinaryOperatorKind.Equal or 4014BinaryOperatorKind.NotEqual or 4015BinaryOperatorKind.GreaterThan or 4016BinaryOperatorKind.LessThan or 4017BinaryOperatorKind.GreaterThanOrEqual or 4018BinaryOperatorKind.LessThanOrEqual && 4028if (binaryKind is BinaryOperatorKind.And or 4029BinaryOperatorKind.Or or 4030BinaryOperatorKind.Xor && 4041if (binaryKind is BinaryOperatorKind.Addition or BinaryOperatorKind.Subtraction) 4059if (binaryKind is BinaryOperatorKind.Subtraction && 4068if (binaryKind is BinaryOperatorKind.Equal or 4069BinaryOperatorKind.NotEqual or 4070BinaryOperatorKind.GreaterThan or 4071BinaryOperatorKind.LessThan or 4072BinaryOperatorKind.GreaterThanOrEqual or 4073BinaryOperatorKind.LessThanOrEqual && 4082if (binaryKind is BinaryOperatorKind.Addition && 4091if (binaryKind is BinaryOperatorKind.Addition && 4100if (binaryKind is BinaryOperatorKind.Subtraction && 4109if (binaryKind is BinaryOperatorKind.Subtraction && 4118if (binaryKind is BinaryOperatorKind.Addition &&
Compilation\CSharpSemanticModel.cs (9)
3830BinaryOperatorKind operandType = binaryOperator.OperatorKind.OperandTypes(); 3831BinaryOperatorKind op = binaryOperator.OperatorKind.Operator(); 3834if (operandType == 0 || operandType == BinaryOperatorKind.UserDefined || binaryOperator.ResultKind != LookupResultKind.Viable || binaryOperator.OperatorKind.IsLogical()) 3846(op == BinaryOperatorKind.Equal || op == BinaryOperatorKind.NotEqual) && 3872private static Symbol GetIntrinsicOperatorSymbol(BinaryOperatorKind op, bool isDynamic, TypeSymbol leftType, TypeSymbol rightType, TypeSymbol returnType, bool isChecked) 3903BinaryOperatorKind operandType = compoundAssignment.Operator.Kind.OperandTypes(); 3904BinaryOperatorKind op = compoundAssignment.Operator.Kind.Operator(); 3907if (operandType == 0 || operandType == BinaryOperatorKind.UserDefined || compoundAssignment.ResultKind != LookupResultKind.Viable)
Compiler\AnonymousTypeMethodBodySynthesizer.cs (1)
125BoundExpression retExpression = F.Binary(BinaryOperatorKind.ObjectNotEqual,
Compiler\MethodBodySynthesizer.cs (1)
492operatorKind: 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)
2263BinaryOperatorKind kind; 2281var op = kind.Operator(); 2282var isAnd = op == BinaryOperatorKind.And; 2283var isBool = kind.OperandTypes() == BinaryOperatorKind.Bool; 2285Debug.Assert(isAnd || op == BinaryOperatorKind.Or); 2431var kind = binary.OperatorKind; 2432return kind.Operator() is BinaryOperatorKind.Equal or BinaryOperatorKind.NotEqual 2444=> binary.OperatorKind.Operator() == BinaryOperatorKind.Equal;
FlowAnalysis\NullableWalker.cs (22)
4408private TypeWithState InferResultNullability(BinaryOperatorKind operatorKind, MethodSymbol? methodOpt, TypeSymbol resultType, TypeWithState leftType, TypeWithState rightType) 4434case BinaryOperatorKind.DelegateCombination: 4437case BinaryOperatorKind.DelegateRemoval: 4465&& binary.OperatorKind.Operator() is BinaryOperatorKind.Equal or BinaryOperatorKind.NotEqual) 4536=> binary.OperatorKind.Operator() == BinaryOperatorKind.Equal; 4568if (binary.OperatorKind.Operator() is not (BinaryOperatorKind.Equal or BinaryOperatorKind.NotEqual)) 4729&& binary.OperatorKind.Operator() is BinaryOperatorKind.GreaterThan or BinaryOperatorKind.GreaterThanOrEqual or BinaryOperatorKind.LessThan or BinaryOperatorKind.LessThanOrEqual) 4774BinaryOperatorKind op = binary.OperatorKind.Operator(); 4776if (op == BinaryOperatorKind.Equal || op == BinaryOperatorKind.NotEqual) 4792bool nonNullCase = op != BinaryOperatorKind.Equal; // true represents WhenTrue 4816case BinaryOperatorKind.Equal: 4817case BinaryOperatorKind.GreaterThan: 4818case BinaryOperatorKind.LessThan: 4819case BinaryOperatorKind.GreaterThanOrEqual: 4820case BinaryOperatorKind.LessThanOrEqual: 4824case BinaryOperatorKind.NotEqual:
Generated\BoundNodes.xml.Generated.cs (15)
1648public BoundBinaryOperator(SyntaxNode syntax, BinaryOperatorKind operatorKind, BoundBinaryOperator.UncommonData? data, LookupResultKind resultKind, BoundExpression left, BoundExpression right, TypeSymbol type, bool hasErrors = false) 1661public BinaryOperatorKind OperatorKind { get; } 1668public BoundBinaryOperator Update(BinaryOperatorKind operatorKind, BoundBinaryOperator.UncommonData? data, LookupResultKind resultKind, BoundExpression left, BoundExpression right, TypeSymbol type) 1682public BoundTupleBinaryOperator(SyntaxNode syntax, BoundExpression left, BoundExpression right, BinaryOperatorKind operatorKind, TupleBinaryOperatorInfo.Multiple operators, TypeSymbol type, bool hasErrors = false) 1700public BinaryOperatorKind OperatorKind { get; } 1706public BoundTupleBinaryOperator Update(BoundExpression left, BoundExpression right, BinaryOperatorKind operatorKind, TupleBinaryOperatorInfo.Multiple operators, TypeSymbol type) 1720public BoundUserDefinedConditionalLogicalOperator(SyntaxNode syntax, BinaryOperatorKind operatorKind, MethodSymbol logicalOperator, MethodSymbol trueOperator, MethodSymbol falseOperator, TypeSymbol? constrainedToTypeOpt, LookupResultKind resultKind, ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt, BoundExpression left, BoundExpression right, TypeSymbol type, bool hasErrors = false) 1740public BinaryOperatorKind OperatorKind { get; } 1751public BoundUserDefinedConditionalLogicalOperator Update(BinaryOperatorKind operatorKind, MethodSymbol logicalOperator, MethodSymbol trueOperator, MethodSymbol falseOperator, TypeSymbol? constrainedToTypeOpt, LookupResultKind resultKind, ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt, BoundExpression left, BoundExpression right, TypeSymbol type) 5230public BoundDagRelationalTest(SyntaxNode syntax, BinaryOperatorKind operatorKind, ConstantValue value, BoundDagTemp input, bool hasErrors = false) 5241public BinaryOperatorKind OperatorKind { get; } 5247public BoundDagRelationalTest Update(BinaryOperatorKind operatorKind, ConstantValue value, BoundDagTemp input) 8174public BoundRelationalPattern(SyntaxNode syntax, BinaryOperatorKind relation, BoundExpression value, ConstantValue constantValue, TypeSymbol inputType, TypeSymbol narrowedType, bool hasErrors = false) 8188public BinaryOperatorKind Relation { get; } 8195public BoundRelationalPattern Update(BinaryOperatorKind relation, BoundExpression value, ConstantValue constantValue, TypeSymbol inputType, TypeSymbol narrowedType)
Lowering\ClosureConversion\ExpressionLambdaRewriter.cs (22)
387private static string GetBinaryOperatorName(BinaryOperatorKind opKind, MethodSymbol methodOpt, out bool isChecked, out bool isLifted, out bool requiresLifted) 395case BinaryOperatorKind.Addition: return useCheckedFactory(isChecked, methodOpt) ? "AddChecked" : "Add"; 396case BinaryOperatorKind.Multiplication: return useCheckedFactory(isChecked, methodOpt) ? "MultiplyChecked" : "Multiply"; 397case BinaryOperatorKind.Subtraction: return useCheckedFactory(isChecked, methodOpt) ? "SubtractChecked" : "Subtract"; 398case BinaryOperatorKind.Division: return "Divide"; 399case BinaryOperatorKind.Remainder: return "Modulo"; 400case BinaryOperatorKind.And: return opKind.IsLogical() ? "AndAlso" : "And"; 401case BinaryOperatorKind.Xor: return "ExclusiveOr"; 402case BinaryOperatorKind.Or: return opKind.IsLogical() ? "OrElse" : "Or"; 403case BinaryOperatorKind.LeftShift: return "LeftShift"; 404case BinaryOperatorKind.RightShift: return "RightShift"; 405case BinaryOperatorKind.Equal: return "Equal"; 406case BinaryOperatorKind.NotEqual: return "NotEqual"; 407case BinaryOperatorKind.LessThan: return "LessThan"; 408case BinaryOperatorKind.LessThanOrEqual: return "LessThanOrEqual"; 409case BinaryOperatorKind.GreaterThan: return "GreaterThan"; 410case BinaryOperatorKind.GreaterThanOrEqual: return "GreaterThanOrEqual"; 421private BoundExpression VisitBinaryOperator(BinaryOperatorKind opKind, MethodSymbol methodOpt, TypeSymbol type, BoundExpression left, BoundExpression right) 439case BinaryOperatorKind.EnumAndUnderlying: 440case BinaryOperatorKind.UnderlyingAndEnum: 441case BinaryOperatorKind.Enum: 443var enumOperand = (opKind.OperandTypes() == BinaryOperatorKind.UnderlyingAndEnum) ? right : left;
Lowering\DiagnosticsPass_ExpressionTrees.cs (1)
643var unary = node.OperatorKind.Operator() == BinaryOperatorKind.And ? node.FalseOperator : node.TrueOperator;
Lowering\DiagnosticsPass_Warnings.cs (27)
278if (_inExpressionLambda && node.OperatorKind.Operator() == BinaryOperatorKind.UnsignedRightShift) 327if (node.OperatorKind == BinaryOperatorKind.ObjectEqual || node.OperatorKind == BinaryOperatorKind.ObjectNotEqual) 350private static bool ConvertedHasEqual(BinaryOperatorKind oldOperatorKind, BoundNode node, out TypeSymbol type) 362string opName = (oldOperatorKind == BinaryOperatorKind.ObjectEqual) ? WellKnownMemberNames.EqualityOperatorName : WellKnownMemberNames.InequalityOperatorName; 460private void CheckForBitwiseOrSignExtend(BoundExpression node, BinaryOperatorKind operatorKind, BoundExpression leftOperand, BoundExpression rightOperand) 509case BinaryOperatorKind.LiftedUIntOr: 510case BinaryOperatorKind.LiftedIntOr: 511case BinaryOperatorKind.LiftedULongOr: 512case BinaryOperatorKind.LiftedLongOr: 513case BinaryOperatorKind.UIntOr: 514case BinaryOperatorKind.IntOr: 515case BinaryOperatorKind.ULongOr: 516case BinaryOperatorKind.LongOr: 751if (node.OperatorKind.OperandTypes() != BinaryOperatorKind.NullableNull) 758case BinaryOperatorKind.Equal: 759case BinaryOperatorKind.NotEqual: 765string always = node.OperatorKind.Operator() == BinaryOperatorKind.NotEqual ? "true" : "false"; 791case BinaryOperatorKind.LessThan: 792case BinaryOperatorKind.LessThanOrEqual: 793case BinaryOperatorKind.GreaterThan: 794case BinaryOperatorKind.GreaterThanOrEqual: 807case BinaryOperatorKind.Equal: 808case BinaryOperatorKind.NotEqual: 814string always = node.OperatorKind.Operator() == BinaryOperatorKind.NotEqual ? "true" : "false"; 825case BinaryOperatorKind.Or: 826case BinaryOperatorKind.And:
Lowering\Instrumentation\CodeCoverageInstrumenter.cs (1)
291BinaryOperatorKind.ObjectEqual,
Lowering\LocalRewriter\LocalRewriter.DecisionDagRewriter.cs (7)
645splitCases(ImmutableArray<(ConstantValue value, LabelSymbol label)> cases, BinaryOperatorKind op, ConstantValue value) 733_fac.Related(BinaryOperatorKind.LessThanOrEqual, x, y) ? 734(_fac.Related(BinaryOperatorKind.LessThanOrEqual, y, x) ? 0 : -1) : 813var lessThanOrEqualOperator = input.Type.SpecialType switch 815SpecialType.System_Single => BinaryOperatorKind.FloatLessThanOrEqual, 816SpecialType.System_Double => BinaryOperatorKind.DoubleLessThanOrEqual, 817SpecialType.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)
344return MakeNullCheck(d.Syntax, input, input.Type.IsNullableType() ? BinaryOperatorKind.NullableNullNotEqual : BinaryOperatorKind.NotEqual); 351return MakeNullCheck(d.Syntax, input, input.Type.IsNullableType() ? BinaryOperatorKind.NullableNullEqual : BinaryOperatorKind.Equal); 367private BoundExpression MakeNullCheck(SyntaxNode syntax, BoundExpression rewrittenExpr, BinaryOperatorKind operatorKind) 395var operatorType = Binder.RelationalOperatorType(comparisonType); 396Debug.Assert(operatorType != BinaryOperatorKind.Error); 397var operatorKind = BinaryOperatorKind.Equal | operatorType; 401protected BoundExpression MakeRelationalTest(SyntaxNode syntax, BoundExpression input, BinaryOperatorKind operatorKind, ConstantValue value) 406Debug.Assert(operatorKind.Operator() == BinaryOperatorKind.Equal); 412if (operatorKind.OperandTypes() == BinaryOperatorKind.Int && comparisonType.SpecialType != SpecialType.System_Int32)
Lowering\LocalRewriter\LocalRewriter_BinaryOperator.cs (221)
71var operatorKind = node.OperatorKind; 87operatorKind.Operator() == BinaryOperatorKind.And ? node.FalseOperator : node.TrueOperator, boundTemp); 90var andOperatorCall = LowerUserDefinedBinaryOperator(syntax, operatorKind & ~BinaryOperatorKind.Logical, boundTemp, loweredRight, type, node.LogicalOperator, node.ConstrainedToTypeOpt); 120if (node.OperatorKind is BinaryOperatorKind.Utf8Addition) 136if (current.InterpolatedStringHandlerData is not null || current.OperatorKind is BinaryOperatorKind.Utf8Addition) 160Debug.Assert(node.OperatorKind == BinaryOperatorKind.StringConcatenation); 174BinaryOperatorKind operatorKind, 190BinaryOperatorKind operatorKind, 206case BinaryOperatorKind.ObjectAndStringConcatenation: 207case BinaryOperatorKind.StringAndObjectConcatenation: 208case BinaryOperatorKind.StringConcatenation: 210case BinaryOperatorKind.DelegateCombination: 212case BinaryOperatorKind.DelegateRemoval: 214case BinaryOperatorKind.DelegateEqual: 216case BinaryOperatorKind.DelegateNotEqual: 250case BinaryOperatorKind.NullableNullEqual: 251case BinaryOperatorKind.NullableNullNotEqual: 254case BinaryOperatorKind.ObjectAndStringConcatenation: 255case BinaryOperatorKind.StringAndObjectConcatenation: 256case BinaryOperatorKind.StringConcatenation: 259case BinaryOperatorKind.StringEqual: 262case BinaryOperatorKind.StringNotEqual: 265case BinaryOperatorKind.DelegateCombination: 268case BinaryOperatorKind.DelegateRemoval: 271case BinaryOperatorKind.DelegateEqual: 274case BinaryOperatorKind.DelegateNotEqual: 277case BinaryOperatorKind.LogicalBoolAnd: 284operatorKind &= ~BinaryOperatorKind.Logical; 289case BinaryOperatorKind.LogicalBoolOr: 296operatorKind &= ~BinaryOperatorKind.Logical; 301case BinaryOperatorKind.BoolAnd: 322case BinaryOperatorKind.BoolOr: 327case BinaryOperatorKind.BoolEqual: 341case BinaryOperatorKind.BoolNotEqual: 355case BinaryOperatorKind.BoolXor: 369case BinaryOperatorKind.IntLeftShift: 370case BinaryOperatorKind.UIntLeftShift: 371case BinaryOperatorKind.IntRightShift: 372case BinaryOperatorKind.UIntRightShift: 373case BinaryOperatorKind.IntUnsignedRightShift: 374case BinaryOperatorKind.UIntUnsignedRightShift: 377case BinaryOperatorKind.LongLeftShift: 378case BinaryOperatorKind.ULongLeftShift: 379case BinaryOperatorKind.LongRightShift: 380case BinaryOperatorKind.ULongRightShift: 381case BinaryOperatorKind.LongUnsignedRightShift: 382case BinaryOperatorKind.ULongUnsignedRightShift: 385case BinaryOperatorKind.NIntRightShift: 386case BinaryOperatorKind.NUIntRightShift: 387case BinaryOperatorKind.NIntUnsignedRightShift: 388case BinaryOperatorKind.NUIntUnsignedRightShift: 389case BinaryOperatorKind.NIntLeftShift: 390case BinaryOperatorKind.NUIntLeftShift: 393case BinaryOperatorKind.DecimalAddition: 394case BinaryOperatorKind.DecimalSubtraction: 395case BinaryOperatorKind.DecimalMultiplication: 396case BinaryOperatorKind.DecimalDivision: 397case BinaryOperatorKind.DecimalRemainder: 398case BinaryOperatorKind.DecimalEqual: 399case BinaryOperatorKind.DecimalNotEqual: 400case BinaryOperatorKind.DecimalLessThan: 401case BinaryOperatorKind.DecimalLessThanOrEqual: 402case BinaryOperatorKind.DecimalGreaterThan: 403case BinaryOperatorKind.DecimalGreaterThanOrEqual: 406case BinaryOperatorKind.PointerAndIntAddition: 407case BinaryOperatorKind.PointerAndUIntAddition: 408case BinaryOperatorKind.PointerAndLongAddition: 409case BinaryOperatorKind.PointerAndULongAddition: 410case BinaryOperatorKind.PointerAndIntSubtraction: 411case BinaryOperatorKind.PointerAndUIntSubtraction: 412case BinaryOperatorKind.PointerAndLongSubtraction: 413case BinaryOperatorKind.PointerAndULongSubtraction: 420case BinaryOperatorKind.IntAndPointerAddition: 421case BinaryOperatorKind.UIntAndPointerAddition: 422case BinaryOperatorKind.LongAndPointerAddition: 423case BinaryOperatorKind.ULongAndPointerAddition: 430case BinaryOperatorKind.PointerSubtraction: 433case BinaryOperatorKind.IntAddition: 434case BinaryOperatorKind.UIntAddition: 435case BinaryOperatorKind.LongAddition: 436case BinaryOperatorKind.ULongAddition: 447case BinaryOperatorKind.IntSubtraction: 448case BinaryOperatorKind.LongSubtraction: 449case BinaryOperatorKind.UIntSubtraction: 450case BinaryOperatorKind.ULongSubtraction: 457case BinaryOperatorKind.IntMultiplication: 458case BinaryOperatorKind.LongMultiplication: 459case BinaryOperatorKind.UIntMultiplication: 460case BinaryOperatorKind.ULongMultiplication: 479case BinaryOperatorKind.IntGreaterThan: 480case BinaryOperatorKind.IntLessThanOrEqual: 484var newOp = operatorKind == BinaryOperatorKind.IntGreaterThan ? 485BinaryOperatorKind.NotEqual : 486BinaryOperatorKind.Equal; 488operatorKind &= ~BinaryOperatorKind.OpMask; 494case BinaryOperatorKind.IntLessThan: 495case BinaryOperatorKind.IntGreaterThanOrEqual: 499var newOp = operatorKind == BinaryOperatorKind.IntLessThan ? 500BinaryOperatorKind.NotEqual : 501BinaryOperatorKind.Equal; 503operatorKind &= ~BinaryOperatorKind.OpMask; 509case BinaryOperatorKind.IntEqual: 510case BinaryOperatorKind.IntNotEqual: 522case BinaryOperatorKind.Utf8Addition: 535private BoundExpression RewriteLiftedBinaryOperator(SyntaxNode syntax, BinaryOperatorKind operatorKind, BoundExpression loweredLeft, BoundExpression loweredRight, TypeSymbol type, MethodSymbol? method, TypeSymbol? constrainedToTypeOpt) 543operatorKind != BinaryOperatorKind.LiftedBoolOr && operatorKind != BinaryOperatorKind.LiftedBoolAnd && 564if (operatorKind.Operator() == BinaryOperatorKind.NotEqual || 565operatorKind.Operator() == BinaryOperatorKind.Equal) 595BinaryOperatorKind operatorKind, 604Debug.Assert(operatorKind.Operator() == BinaryOperatorKind.And || operatorKind.Operator() == BinaryOperatorKind.Or); 615bool isAnd = operatorKind.Operator() == BinaryOperatorKind.And; 679result = _factory.Binary(BinaryOperatorKind.LogicalOr, boolean, leftTest, result); 762BinaryOperatorKind operatorKind, 784BinaryOperatorKind kind, 803return MakeLiteral(syntax, ConstantValue.Create(kind.Operator() == BinaryOperatorKind.Equal), boolType); 826BinaryOperatorKind operatorKind = kind.Operator(); 830BoundExpression result = MakeLiteral(syntax, ConstantValue.Create(operatorKind == BinaryOperatorKind.NotEqual), boolType); 857if (operatorKind == BinaryOperatorKind.Equal || operatorKind == BinaryOperatorKind.NotEqual) 860BoundExpression result = operatorKind == BinaryOperatorKind.Equal ? 867BoundExpression falseExpr = MakeBooleanConstant(syntax, operatorKind == BinaryOperatorKind.NotEqual); 916BinaryOperatorKind kind, 984BinaryOperatorKind leftOperator; 985BinaryOperatorKind rightOperator; 987BinaryOperatorKind operatorKind = kind.Operator(); 990case BinaryOperatorKind.Equal: 991case BinaryOperatorKind.NotEqual: 992leftOperator = BinaryOperatorKind.Equal; 993rightOperator = BinaryOperatorKind.BoolEqual; 997rightOperator = BinaryOperatorKind.BoolAnd; 1027operatorKind: BinaryOperatorKind.BoolAnd, 1036if (operatorKind == BinaryOperatorKind.NotEqual) 1055BinaryOperatorKind kind, 1139BinaryOperatorKind conditionOperator; 1140BinaryOperatorKind operatorKind = kind.Operator(); 1143case BinaryOperatorKind.Equal: 1144case BinaryOperatorKind.NotEqual: 1145conditionOperator = BinaryOperatorKind.BoolEqual; 1148conditionOperator = BinaryOperatorKind.BoolAnd; 1174if (operatorKind == BinaryOperatorKind.Equal || operatorKind == BinaryOperatorKind.NotEqual) 1181rewrittenAlternative: MakeLiteral(syntax, ConstantValue.Create(operatorKind == BinaryOperatorKind.Equal), boolType), 1193BoundExpression alternative = MakeBooleanConstant(syntax, operatorKind == BinaryOperatorKind.NotEqual); 1214BinaryOperatorKind kind, 1254BinaryOperatorKind kind, 1323BinaryOperatorKind kind, 1377BoundExpression condition = MakeBinaryOperator(syntax, BinaryOperatorKind.BoolAnd, callX_HasValue, callY_HasValue, boolType, method: null, constrainedToTypeOpt: null); 1425BinaryOperatorKind kind, 1439if (kind == BinaryOperatorKind.LiftedBoolAnd || kind == BinaryOperatorKind.LiftedBoolOr) 1577BinaryOperatorKind kind, 1614BoundExpression newNullBool = MakeNewNullableBoolean(syntax, kind == BinaryOperatorKind.LiftedBoolOr); 1619rewrittenConsequence: kind == BinaryOperatorKind.LiftedBoolAnd ? nullBool : newNullBool, 1620rewrittenAlternative: kind == BinaryOperatorKind.LiftedBoolAnd ? newNullBool : nullBool, 1641BoundExpression consequence = kind == BinaryOperatorKind.LiftedBoolAnd ? nullBool : boundTemp; 1642BoundExpression alternative = kind == BinaryOperatorKind.LiftedBoolAnd ? boundTemp : nullBool; 1662BinaryOperatorKind kind, 1702BoundExpression newNullBool = MakeNewNullableBoolean(syntax, kind == BinaryOperatorKind.LiftedBoolOr); 1703BoundExpression consequence = kind == BinaryOperatorKind.LiftedBoolOr ? newNullBool : maybeNullTemp; 1704BoundExpression alternative = kind == BinaryOperatorKind.LiftedBoolOr ? maybeNullTemp : newNullBool; 1723BinaryOperatorKind kind, 1769operatorKind: BinaryOperatorKind.LogicalBoolOr, 1782operatorKind: BinaryOperatorKind.LogicalBoolOr, 1789BoundExpression consequence = kind == BinaryOperatorKind.LiftedBoolAnd ? boundTempY : boundTempX; 1790BoundExpression alternative = kind == BinaryOperatorKind.LiftedBoolAnd ? boundTempX : boundTempY; 1845BinaryOperatorKind kind, 1871return MakeLiteral(syntax, ConstantValue.Create(kind == BinaryOperatorKind.NullableNullEqual), returnType); 1886value: MakeBooleanConstant(syntax, kind == BinaryOperatorKind.NullableNullNotEqual), 1902var whenNull = kind == BinaryOperatorKind.NullableNullEqual ? MakeBooleanConstant(syntax, true) : null; 1908BoundExpression result = kind == BinaryOperatorKind.NullableNullNotEqual ? 1915private BoundExpression RewriteStringEquality(BoundBinaryOperator? oldNode, SyntaxNode syntax, BinaryOperatorKind operatorKind, BoundExpression loweredLeft, BoundExpression loweredRight, TypeSymbol type, SpecialMember member) 1928private BoundExpression RewriteDelegateOperation(SyntaxNode syntax, BinaryOperatorKind operatorKind, BoundExpression loweredLeft, BoundExpression loweredRight, TypeSymbol type, SpecialMember member) 1931if (operatorKind == BinaryOperatorKind.DelegateEqual || operatorKind == BinaryOperatorKind.DelegateNotEqual) 1939operatorKind = (operatorKind & (~BinaryOperatorKind.Delegate)) | BinaryOperatorKind.Object; 1958private BoundExpression RewriteDecimalBinaryOperation(SyntaxNode syntax, BoundExpression loweredLeft, BoundExpression loweredRight, BinaryOperatorKind operatorKind) 1967case BinaryOperatorKind.DecimalAddition: member = SpecialMember.System_Decimal__op_Addition; break; 1968case BinaryOperatorKind.DecimalSubtraction: member = SpecialMember.System_Decimal__op_Subtraction; break; 1969case BinaryOperatorKind.DecimalMultiplication: member = SpecialMember.System_Decimal__op_Multiply; break; 1970case BinaryOperatorKind.DecimalDivision: member = SpecialMember.System_Decimal__op_Division; break; 1971case BinaryOperatorKind.DecimalRemainder: member = SpecialMember.System_Decimal__op_Modulus; break; 1972case BinaryOperatorKind.DecimalEqual: member = SpecialMember.System_Decimal__op_Equality; break; 1973case BinaryOperatorKind.DecimalNotEqual: member = SpecialMember.System_Decimal__op_Inequality; break; 1974case BinaryOperatorKind.DecimalLessThan: member = SpecialMember.System_Decimal__op_LessThan; break; 1975case BinaryOperatorKind.DecimalLessThanOrEqual: member = SpecialMember.System_Decimal__op_LessThanOrEqual; break; 1976case BinaryOperatorKind.DecimalGreaterThan: member = SpecialMember.System_Decimal__op_GreaterThan; break; 1977case BinaryOperatorKind.DecimalGreaterThanOrEqual: member = SpecialMember.System_Decimal__op_GreaterThanOrEqual; break; 1989private BoundExpression MakeNullCheck(SyntaxNode syntax, BoundExpression rewrittenExpr, BinaryOperatorKind operatorKind) 1991Debug.Assert((operatorKind == BinaryOperatorKind.Equal) || (operatorKind == BinaryOperatorKind.NotEqual) || 1992(operatorKind == BinaryOperatorKind.NullableNullEqual) || (operatorKind == BinaryOperatorKind.NullableNullNotEqual)); 2010case BinaryOperatorKind.Equal: 2012case BinaryOperatorKind.NotEqual: 2028operatorKind |= BinaryOperatorKind.NullableNull; 2049BinaryOperatorKind operatorKind, 2073BinaryOperatorKind andOperatorKind = (operatorKind & ~BinaryOperatorKind.OpMask) | BinaryOperatorKind.And; 2111BinaryOperatorKind operatorKind, 2151BinaryOperatorKind andOperatorKind = (operatorKind & ~BinaryOperatorKind.OpMask) | BinaryOperatorKind.And; 2171BinaryOperatorKind kind, 2191Debug.Assert(kind.Operator() == BinaryOperatorKind.Addition); 2196kind = kind & ~BinaryOperatorKind.Checked; 2293BinaryOperatorKind multiplicationKind = BinaryOperatorKind.Multiplication; 2308multiplicationKind |= BinaryOperatorKind.Int; //i.e. signed 2321multiplicationKind |= BinaryOperatorKind.Long; 2333multiplicationKind |= BinaryOperatorKind.Long; 2345multiplicationKind |= BinaryOperatorKind.ULong; 2358multiplicationKind |= BinaryOperatorKind.Checked; 2367BinaryOperatorKind kind, 2385BinaryOperatorKind.Division, 2388kind & ~BinaryOperatorKind.Checked, // For some reason, dev10 never checks for subtraction overflow.
Lowering\LocalRewriter\LocalRewriter_Call.cs (1)
231BinaryOperatorKind.ObjectEqual,
Lowering\LocalRewriter\LocalRewriter_CompoundAssignmentOperator.cs (5)
30var kind = node.Operator.Kind; 33var binaryOperator = kind.Operator(); 42(binaryOperator == BinaryOperatorKind.Addition || binaryOperator == BinaryOperatorKind.Subtraction)) 86(binaryOperator == BinaryOperatorKind.Addition ? "add_" : "remove_") + memberAccess.Name,
Lowering\LocalRewriter\LocalRewriter_Conversion.cs (2)
161Debug.Assert(node.OperatorKind is BinaryOperatorKind.Utf8Addition); 189Debug.Assert(utf8Addition.OperatorKind is BinaryOperatorKind.Utf8Addition);
Lowering\LocalRewriter\LocalRewriter_FixedStatement.cs (5)
440BoundExpression notNullCheck = _factory.MakeNullCheck(factory.Syntax, factory.Local(localSymbol), BinaryOperatorKind.NotEqual); 453BoundExpression addition = factory.Binary(BinaryOperatorKind.PointerAndIntAddition, localType, factory.Local(localSymbol), helperCall); 494BoundExpression notNullCheck = _factory.MakeNullCheck(factory.Syntax, arrayTempInit, BinaryOperatorKind.NotEqual); 517BoundExpression lengthCheck = factory.Binary(BinaryOperatorKind.IntNotEqual, factory.SpecialType(SpecialType.System_Boolean), lengthCall, factory.Literal(0)); 520BoundExpression condition = factory.Binary(BinaryOperatorKind.LogicalBoolAnd, factory.SpecialType(SpecialType.System_Boolean), notNullCheck, lengthCheck);
Lowering\LocalRewriter\LocalRewriter_ForEachStatement.cs (5)
388operatorKind: BinaryOperatorKind.NotEqual, // reference equality 585operatorKind: BinaryOperatorKind.IntLessThan, 764operatorKind: BinaryOperatorKind.IntLessThan, 943operatorKind: BinaryOperatorKind.IntLessThanOrEqual, 1037operatorKind: 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)
154BoundExpression 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)
36private BoundExpression RewriteStringConcatenation(SyntaxNode syntax, BinaryOperatorKind operatorKind, BoundExpression loweredLeft, BoundExpression loweredRight, TypeSymbol type) 39operatorKind == BinaryOperatorKind.StringConcatenation || 40operatorKind == BinaryOperatorKind.StringAndObjectConcatenation || 41operatorKind == BinaryOperatorKind.ObjectAndStringConcatenation); 353private BoundExpression RewriteStringConcatInExpressionLambda(SyntaxNode syntax, BinaryOperatorKind operatorKind, BoundExpression loweredLeft, BoundExpression loweredRight, TypeSymbol type) 355SpecialMember member = (operatorKind == BinaryOperatorKind.StringConcatenation) ?
Lowering\LocalRewriter\LocalRewriter_StringInterpolation.cs (1)
319_factory.Binary(BinaryOperatorKind.StringConcatenation, node.Type, result, part);
Lowering\LocalRewriter\LocalRewriter_TupleBinaryOperator.cs (14)
247ArrayBuilder<LocalSymbol> temps, BinaryOperatorKind operatorKind) 259return new BoundLiteral(left.Syntax, ConstantValue.Create(nullnull.Kind == BinaryOperatorKind.Equal), boolType); 267TypeSymbol boolType, ArrayBuilder<LocalSymbol> temps, BinaryOperatorKind operatorKind) 316bool boolValue = operatorKind == BinaryOperatorKind.Equal; // true/false 341_factory.Binary(BinaryOperatorKind.Equal, boolType, leftHasValue, rightHasValue), 486ArrayBuilder<LocalSymbol> temps, BinaryOperatorKind operatorKind) 502var logicalOperator = operatorKind == BinaryOperatorKind.Equal ? BinaryOperatorKind.LogicalBoolAnd : BinaryOperatorKind.LogicalBoolOr; 542BoundExpression left, BoundExpression right, TypeSymbol boolType, BinaryOperatorKind operatorKind) 556if (operatorKind == BinaryOperatorKind.Equal) 569return new BoundLiteral(left.Syntax, ConstantValue.Create(operatorKind == BinaryOperatorKind.Equal), boolType); 586if (operatorKind == BinaryOperatorKind.Equal)
Lowering\LocalRewriter\LocalRewriter_UnaryOperator.cs (47)
51if (node.OperatorKind == UnaryOperatorKind.DynamicTrue && binaryOperator.OperatorKind == BinaryOperatorKind.DynamicLogicalOr || 52node.OperatorKind == UnaryOperatorKind.DynamicFalse && binaryOperator.OperatorKind == BinaryOperatorKind.DynamicLogicalAnd) 717BinaryOperatorKind binaryOperatorKind = GetCorrespondingBinaryOperator(node); 718binaryOperatorKind |= IsIncrement(node) ? BinaryOperatorKind.Addition : BinaryOperatorKind.Subtraction; 754Debug.Assert(binaryOperatorKind.OperandTypes() == BinaryOperatorKind.PointerAndInt); 790private MethodSymbol GetDecimalIncDecOperator(BinaryOperatorKind oper) 795case BinaryOperatorKind.Addition: member = SpecialMember.System_Decimal__op_Increment; break; 796case BinaryOperatorKind.Subtraction: member = SpecialMember.System_Decimal__op_Decrement; break; 807private BoundExpression MakeDecimalIncDecOperator(SyntaxNode syntax, BinaryOperatorKind oper, BoundExpression operand) 814private BoundExpression MakeLiftedDecimalIncDecOperator(SyntaxNode syntax, BinaryOperatorKind oper, BoundExpression operand) 955private static BinaryOperatorKind GetCorrespondingBinaryOperator(BoundIncrementOperator node) 963BinaryOperatorKind result; 970result = BinaryOperatorKind.Int; 976result = BinaryOperatorKind.UInt; 979result = BinaryOperatorKind.Long; 982result = BinaryOperatorKind.ULong; 985result = BinaryOperatorKind.NInt; 988result = BinaryOperatorKind.NUInt; 991result = BinaryOperatorKind.Float; 994result = BinaryOperatorKind.Double; 997result = BinaryOperatorKind.Decimal; 1019result = BinaryOperatorKind.Int; 1024result = BinaryOperatorKind.UInt; 1027result = BinaryOperatorKind.Long; 1030result = BinaryOperatorKind.ULong; 1038result = BinaryOperatorKind.PointerAndInt; 1048case BinaryOperatorKind.UInt: 1049case BinaryOperatorKind.Int: 1050case BinaryOperatorKind.ULong: 1051case BinaryOperatorKind.Long: 1052case BinaryOperatorKind.NUInt: 1053case BinaryOperatorKind.NInt: 1054case BinaryOperatorKind.PointerAndInt: 1055result |= (BinaryOperatorKind)unaryOperatorKind.OverflowChecks(); 1061result |= BinaryOperatorKind.Lifted; 1069BinaryOperatorKind binaryOperatorKind) 1074case BinaryOperatorKind.PointerAndInt: 1075case BinaryOperatorKind.Int: 1078case BinaryOperatorKind.UInt: 1081case BinaryOperatorKind.Long: 1084case BinaryOperatorKind.ULong: 1087case BinaryOperatorKind.NInt: 1090case BinaryOperatorKind.NUInt: 1093case BinaryOperatorKind.Float: 1096case BinaryOperatorKind.Double: 1099case BinaryOperatorKind.Decimal:
Lowering\LocalRewriter\LocalRewriter_UsingStatement.cs (1)
391ifCondition = _factory.MakeNullCheck(resourceSyntax, local, BinaryOperatorKind.NotEqual);
Lowering\LocalRewriter\LoweredDynamicOperationFactory.cs (1)
151BinaryOperatorKind operatorKind,
Lowering\SpillSequenceSpiller.cs (3)
923if (node.OperatorKind == BinaryOperatorKind.LogicalBoolOr || node.OperatorKind == BinaryOperatorKind.LogicalBoolAnd) 929node.OperatorKind == BinaryOperatorKind.LogicalBoolAnd ? _F.Local(tmp) : _F.Not(_F.Local(tmp)),
Lowering\StateMachineRewriter\ResumableStateMachineStateAllocator.cs (2)
85_increasing ? BinaryOperatorKind.IntGreaterThanOrEqual : BinaryOperatorKind.IntLessThanOrEqual,
Lowering\SyntheticBoundNodeFactory.cs (26)
597public BoundBinaryOperator Binary(BinaryOperatorKind kind, TypeSymbol type, BoundExpression left, BoundExpression right) 620return Binary(BinaryOperatorKind.LogicalBoolAnd, SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Boolean), left, right); 627return Binary(BinaryOperatorKind.LogicalBoolOr, SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Boolean), left, right); 632return Binary(BinaryOperatorKind.IntEqual, SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Boolean), left, right); 637return Binary(BinaryOperatorKind.ObjectEqual, SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Boolean), left, right); 642return Binary(BinaryOperatorKind.ObjectNotEqual, SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Boolean), left, right); 647return Binary(BinaryOperatorKind.IntNotEqual, SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Boolean), left, right); 652return Binary(BinaryOperatorKind.IntLessThan, SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Boolean), left, right); 657return Binary(BinaryOperatorKind.IntGreaterThanOrEqual, SpecialType(CodeAnalysis.SpecialType.System_Boolean), left, right); 662return Binary(BinaryOperatorKind.IntSubtraction, SpecialType(CodeAnalysis.SpecialType.System_Int32), left, right); 667return Binary(BinaryOperatorKind.IntMultiplication, SpecialType(CodeAnalysis.SpecialType.System_Int32), left, right); 1617internal BoundExpression MakeNullCheck(SyntaxNode syntax, BoundExpression rewrittenExpr, BinaryOperatorKind operatorKind) 1619Debug.Assert((operatorKind == BinaryOperatorKind.Equal) || (operatorKind == BinaryOperatorKind.NotEqual) || 1620(operatorKind == BinaryOperatorKind.NullableNullEqual) || (operatorKind == BinaryOperatorKind.NullableNullNotEqual)); 1638case BinaryOperatorKind.Equal: 1640case BinaryOperatorKind.NotEqual: 1656operatorKind |= BinaryOperatorKind.NullableNull; 1659if (operatorKind == BinaryOperatorKind.NullableNullEqual || operatorKind == BinaryOperatorKind.NullableNullNotEqual) 1677BinaryOperatorKind kind, 1703return Literal(kind == BinaryOperatorKind.NullableNullEqual); 1718value: Literal(kind == BinaryOperatorKind.NullableNullNotEqual), 1734var whenNull = kind == BinaryOperatorKind.NullableNullEqual ? Literal(true) : null; 1740BoundExpression result = kind == BinaryOperatorKind.NullableNullNotEqual ?
Operations\CSharpOperationFactory.cs (2)
1420IMethodSymbol unaryOperatorMethod = boundBinaryOperator.OperatorKind.Operator() == CSharp.BinaryOperatorKind.And ? 1431GetConstrainedToTypeForOperator(boundBinaryOperator.OperatorKind.Operator() == CSharp.BinaryOperatorKind.And ?
Operations\CSharpOperationFactory_Methods.cs (20)
467internal static BinaryOperatorKind DeriveBinaryOperatorKind(CSharp.BinaryOperatorKind operatorKind) 471case CSharp.BinaryOperatorKind.Addition: 474case CSharp.BinaryOperatorKind.Subtraction: 477case CSharp.BinaryOperatorKind.Multiplication: 480case CSharp.BinaryOperatorKind.Division: 483case CSharp.BinaryOperatorKind.Remainder: 486case CSharp.BinaryOperatorKind.LeftShift: 489case CSharp.BinaryOperatorKind.RightShift: 492case CSharp.BinaryOperatorKind.UnsignedRightShift: 495case CSharp.BinaryOperatorKind.And: 498case CSharp.BinaryOperatorKind.Or: 501case CSharp.BinaryOperatorKind.Xor: 504case CSharp.BinaryOperatorKind.LessThan: 507case CSharp.BinaryOperatorKind.LessThanOrEqual: 510case CSharp.BinaryOperatorKind.Equal: 513case CSharp.BinaryOperatorKind.NotEqual: 516case CSharp.BinaryOperatorKind.GreaterThanOrEqual: 519case CSharp.BinaryOperatorKind.GreaterThan: 522case CSharp.BinaryOperatorKind.LogicalAnd: 525case CSharp.BinaryOperatorKind.LogicalOr:
Symbols\Synthesized\SynthesizedThrowIfNullMethod.cs (1)
44F.Binary(BinaryOperatorKind.ObjectEqual, F.SpecialType(SpecialType.System_Boolean),
Utilities\IValueSet.cs (13)
35/// are <see cref="BinaryOperatorKind.Equal"/> for all supported types, and for numeric types we also support 36/// <see cref="BinaryOperatorKind.LessThan"/>, <see cref="BinaryOperatorKind.LessThanOrEqual"/>, <see cref="BinaryOperatorKind.GreaterThan"/>, and 37/// <see cref="BinaryOperatorKind.GreaterThanOrEqual"/>. 39bool Any(BinaryOperatorKind relation, ConstantValue value); 43/// Because of that all four combinations of results from <see cref="Any(BinaryOperatorKind, ConstantValue)"/> and <see cref="All(BinaryOperatorKind, ConstantValue)"/> 48bool All(BinaryOperatorKind relation, ConstantValue value); 85bool Any(BinaryOperatorKind relation, T value); 89/// Because of that all four combinations of results from <see cref="Any(BinaryOperatorKind, T)"/> and <see cref="All(BinaryOperatorKind, T)"/> 94bool All(BinaryOperatorKind relation, T value);
Utilities\IValueSetFactory.cs (3)
18IValueSet Related(BinaryOperatorKind relation, ConstantValue value); 23bool Related(BinaryOperatorKind relation, ConstantValue left, ConstantValue right); 55IValueSet<T> Related(BinaryOperatorKind relation, T value);
Utilities\ValueSetFactory.BoolValueSet.cs (5)
9using static BinaryOperatorKind; 43public bool Any(BinaryOperatorKind relation, bool value) 56bool IValueSet.Any(BinaryOperatorKind relation, ConstantValue value) => value.IsBad || Any(relation, value.BooleanValue); 58public bool All(BinaryOperatorKind relation, bool value) 71bool IValueSet.All(BinaryOperatorKind relation, ConstantValue value) => !value.IsBad && All(relation, value.BooleanValue);
Utilities\ValueSetFactory.BoolValueSetFactory.cs (5)
11using static BinaryOperatorKind; 28public IValueSet<bool> Related(BinaryOperatorKind relation, bool value) 53IValueSet IValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue value) 58bool IValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue left, ConstantValue right) 60Debug.Assert(relation == BinaryOperatorKind.Equal);
Utilities\ValueSetFactory.ByteTC.cs (2)
10using static BinaryOperatorKind; 22bool INumericTC<byte>.Related(BinaryOperatorKind relation, byte left, byte right)
Utilities\ValueSetFactory.CharTC.cs (2)
11using static BinaryOperatorKind; 23bool INumericTC<char>.Related(BinaryOperatorKind relation, char left, char right)
Utilities\ValueSetFactory.DecimalTC.cs (2)
11using static BinaryOperatorKind; 87bool INumericTC<decimal>.Related(BinaryOperatorKind relation, decimal left, decimal right)
Utilities\ValueSetFactory.DecimalValueSetFactory.cs (3)
21public IValueSet<decimal> Related(BinaryOperatorKind relation, decimal value) => _underlying.Related(relation, DecimalTC.Normalize(value)); 27IValueSet IValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue value) => 30bool IValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue left, ConstantValue right) => _underlying.Related(relation, left, right);
Utilities\ValueSetFactory.DoubleTC.cs (2)
10using static BinaryOperatorKind; 62bool INumericTC<double>.Related(BinaryOperatorKind relation, double left, double right)
Utilities\ValueSetFactory.EnumeratedValueSet.cs (9)
52if (this.Any(BinaryOperatorKind.Equal, (T)(object)"")) 55if (this.Any(BinaryOperatorKind.Equal, (T)(object)c.ToString())) 63if (this.Any(BinaryOperatorKind.Equal, value)) 71public bool Any(BinaryOperatorKind relation, T value) 75case BinaryOperatorKind.Equal: 82bool IValueSet.Any(BinaryOperatorKind relation, ConstantValue value) => value.IsBad || Any(relation, default(TTC).FromConstantValue(value)); 84public bool All(BinaryOperatorKind relation, T value) 88case BinaryOperatorKind.Equal: 105bool IValueSet.All(BinaryOperatorKind relation, ConstantValue value) => !value.IsBad && All(relation, default(TTC).FromConstantValue(value));
Utilities\ValueSetFactory.EnumeratedValueSetFactory.cs (5)
11using static BinaryOperatorKind; 28public IValueSet<T> Related(BinaryOperatorKind relation, T value) 39IValueSet IValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue value) => 42bool IValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue left, ConstantValue right) 44Debug.Assert(relation == BinaryOperatorKind.Equal);
Utilities\ValueSetFactory.FloatingValueSet.cs (11)
12using static BinaryOperatorKind; 71public static IValueSet<TFloating> Related(BinaryOperatorKind relation, TFloating value) 78case BinaryOperatorKind.Equal: 79case BinaryOperatorKind.LessThanOrEqual: 80case BinaryOperatorKind.GreaterThanOrEqual: 85case BinaryOperatorKind.LessThan: 86case BinaryOperatorKind.GreaterThan: 131bool IValueSet.Any(BinaryOperatorKind relation, ConstantValue value) => 134public bool Any(BinaryOperatorKind relation, TFloating value) 142bool IValueSet.All(BinaryOperatorKind relation, ConstantValue value) => !value.IsBad && All(relation, default(TFloatingTC).FromConstantValue(value)); 144public bool All(BinaryOperatorKind relation, TFloating value)
Utilities\ValueSetFactory.FloatingValueSetFactory.cs (3)
21public IValueSet<TFloating> Related(BinaryOperatorKind relation, TFloating value) => 33IValueSet IValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue value) => 36bool IValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue left, ConstantValue right)
Utilities\ValueSetFactory.IntTC.cs (2)
10using static BinaryOperatorKind; 22public 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; 22bool 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 IValueSet.All(BinaryOperatorKind relation, ConstantValue value) => value.IsBad || All(relation, value.Int32Value); 76public bool Any(BinaryOperatorKind relation, int value) 85bool IValueSet.Any(BinaryOperatorKind relation, ConstantValue value) => value.IsBad || Any(relation, value.Int32Value);
Utilities\ValueSetFactory.NintValueSetFactory.cs (4)
9using static BinaryOperatorKind; 23public IValueSet<int> Related(BinaryOperatorKind relation, int value) 43IValueSet IValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue value) 48bool IValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue left, ConstantValue right)
Utilities\ValueSetFactory.NonNegativeIntTC.cs (2)
10using static BinaryOperatorKind; 22public bool Related(BinaryOperatorKind relation, int left, int right)
Utilities\ValueSetFactory.NonNegativeIntValueSetFactory.cs (4)
10using static BinaryOperatorKind; 26public IValueSet<int> Related(BinaryOperatorKind relation, int value) 57IValueSet IValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue value) => 60bool IValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue left, ConstantValue right) => _underlying.Related(relation, left, right);
Utilities\ValueSetFactory.NuintValueSet.cs (5)
11using static BinaryOperatorKind; 56public bool All(BinaryOperatorKind relation, uint value) 63bool IValueSet.All(BinaryOperatorKind relation, ConstantValue value) => value.IsBad || All(relation, value.UInt32Value); 65public bool Any(BinaryOperatorKind relation, uint value) 72bool IValueSet.Any(BinaryOperatorKind relation, ConstantValue value) => value.IsBad || Any(relation, value.UInt32Value);
Utilities\ValueSetFactory.NuintValueSetFactory.cs (4)
9using static BinaryOperatorKind; 23public IValueSet<uint> Related(BinaryOperatorKind relation, uint value) 41IValueSet IValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue value) 46bool IValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue left, ConstantValue right)
Utilities\ValueSetFactory.NumericValueSet.cs (6)
15using static BinaryOperatorKind; 64var gz = NumericValueSetFactory<T, TTC>.Instance.Related(BinaryOperatorKind.GreaterThanOrEqual, tc.Zero); 72public bool Any(BinaryOperatorKind relation, T value) 108bool IValueSet.Any(BinaryOperatorKind relation, ConstantValue value) => value.IsBad || Any(relation, default(TTC).FromConstantValue(value)); 110public bool All(BinaryOperatorKind relation, T value) 131bool IValueSet.All(BinaryOperatorKind relation, ConstantValue value) => !value.IsBad && All(relation, default(TTC).FromConstantValue(value));
Utilities\ValueSetFactory.NumericValueSetFactory.cs (4)
10using static BinaryOperatorKind; 29public IValueSet<T> Related(BinaryOperatorKind relation, T value) 53IValueSet IValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue value) => 65bool IValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue left, ConstantValue right)
Utilities\ValueSetFactory.SByteTC.cs (2)
10using static BinaryOperatorKind; 22bool INumericTC<sbyte>.Related(BinaryOperatorKind relation, sbyte left, sbyte right)
Utilities\ValueSetFactory.ShortTC.cs (2)
10using static BinaryOperatorKind; 22bool INumericTC<short>.Related(BinaryOperatorKind relation, short left, short right)
Utilities\ValueSetFactory.SingleTC.cs (2)
10using static BinaryOperatorKind; 66bool INumericTC<float>.Related(BinaryOperatorKind relation, float left, float right)
Utilities\ValueSetFactory.UIntTC.cs (2)
10using static BinaryOperatorKind; 22public bool Related(BinaryOperatorKind relation, uint left, uint right)
Utilities\ValueSetFactory.ULongTC.cs (2)
10using static BinaryOperatorKind; 22bool INumericTC<ulong>.Related(BinaryOperatorKind relation, ulong left, ulong right)
Utilities\ValueSetFactory.UShortTC.cs (2)
10using static BinaryOperatorKind; 22bool INumericTC<ushort>.Related(BinaryOperatorKind relation, ushort left, ushort right)
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (19)
Emit\NumericIntPtrTests.cs (19)
1506BinaryOperatorKind.Addition, 1507BinaryOperatorKind.Subtraction, 1508BinaryOperatorKind.Multiplication, 1509BinaryOperatorKind.Division, 1510BinaryOperatorKind.Remainder, 1511BinaryOperatorKind.LessThan, 1512BinaryOperatorKind.LessThanOrEqual, 1513BinaryOperatorKind.GreaterThan, 1514BinaryOperatorKind.GreaterThanOrEqual, 1515BinaryOperatorKind.LeftShift, 1516BinaryOperatorKind.RightShift, 1517BinaryOperatorKind.Equal, 1518BinaryOperatorKind.NotEqual, 1519BinaryOperatorKind.Or, 1520BinaryOperatorKind.And, 1521BinaryOperatorKind.Xor, 1522BinaryOperatorKind.UnsignedRightShift, 1531foreach (var operatorKind in binaryOperators) 1548static void verifyBinaryOperators(CSharpCompilation comp, BinaryOperatorKind operatorKind, bool skipNativeIntegerOperators)
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (149)
Semantics\NativeIntegerTests.cs (19)
4755BinaryOperatorKind.Addition, 4756BinaryOperatorKind.Subtraction, 4757BinaryOperatorKind.Multiplication, 4758BinaryOperatorKind.Division, 4759BinaryOperatorKind.Remainder, 4760BinaryOperatorKind.LessThan, 4761BinaryOperatorKind.LessThanOrEqual, 4762BinaryOperatorKind.GreaterThan, 4763BinaryOperatorKind.GreaterThanOrEqual, 4764BinaryOperatorKind.LeftShift, 4765BinaryOperatorKind.RightShift, 4766BinaryOperatorKind.Equal, 4767BinaryOperatorKind.NotEqual, 4768BinaryOperatorKind.Or, 4769BinaryOperatorKind.And, 4770BinaryOperatorKind.Xor, 4771BinaryOperatorKind.UnsignedRightShift, 4780foreach (var operatorKind in binaryOperators) 4797static void verifyBinaryOperators(CSharpCompilation comp, BinaryOperatorKind operatorKind, bool skipNativeIntegerOperators)
Semantics\OperatorTests.cs (120)
7340BinaryOperatorKind.Addition, 7341BinaryOperatorKind.Subtraction, 7342BinaryOperatorKind.Multiplication, 7343BinaryOperatorKind.Division, 7344BinaryOperatorKind.Remainder, 7345BinaryOperatorKind.LessThan, 7346BinaryOperatorKind.LessThanOrEqual, 7347BinaryOperatorKind.GreaterThan, 7348BinaryOperatorKind.GreaterThanOrEqual, 7349BinaryOperatorKind.LeftShift, 7350BinaryOperatorKind.RightShift, 7351BinaryOperatorKind.Equal, 7352BinaryOperatorKind.NotEqual, 7353BinaryOperatorKind.Or, 7354BinaryOperatorKind.And, 7355BinaryOperatorKind.Xor, 7356BinaryOperatorKind.UnsignedRightShift, 7359foreach (var op in operators) 7365var signature1 = getBinaryOperator(binder, op, isChecked: false, left, right, useEasyOut: true); 7366var signature2 = getBinaryOperator(binder, op, isChecked: false, left, right, useEasyOut: false); 7367var signature3 = getBinaryOperator(binder, op, isChecked: true, left, right, useEasyOut: false); 7374static BinaryOperatorKind getBinaryOperator(Binder binder, BinaryOperatorKind kind, bool isChecked, BoundExpression left, BoundExpression right, bool useEasyOut) 7387var signature = result.Best.Signature.Kind; 7733BinaryOperatorKind[] operators = 7735BinaryOperatorKind.Addition, 7736BinaryOperatorKind.Subtraction, 7737BinaryOperatorKind.Multiplication, 7738BinaryOperatorKind.Division, 7739BinaryOperatorKind.Remainder, 7740BinaryOperatorKind.Equal, 7741BinaryOperatorKind.NotEqual, 7742BinaryOperatorKind.LessThanOrEqual, 7743BinaryOperatorKind.GreaterThanOrEqual, 7744BinaryOperatorKind.LessThan, 7745BinaryOperatorKind.GreaterThan, 7746BinaryOperatorKind.LeftShift, 7747BinaryOperatorKind.RightShift, 7748BinaryOperatorKind.Xor, 7749BinaryOperatorKind.Or, 7750BinaryOperatorKind.And, 7751BinaryOperatorKind.LogicalOr, 7752BinaryOperatorKind.LogicalAnd, 7753BinaryOperatorKind.UnsignedRightShift, 7881foreach (var op in operators) 7909BinaryOperatorKind[] operators = 7911BinaryOperatorKind.Addition, 7912BinaryOperatorKind.Subtraction, 7913BinaryOperatorKind.Multiplication, 7914BinaryOperatorKind.Division, 7915BinaryOperatorKind.Remainder, 7916BinaryOperatorKind.LeftShift, 7917BinaryOperatorKind.RightShift, 7918BinaryOperatorKind.Xor, 7919BinaryOperatorKind.Or, 7920BinaryOperatorKind.And, 7921BinaryOperatorKind.UnsignedRightShift 8041foreach (var op in operators) 8066BinaryOperatorKind op, 8144case BinaryOperatorKind.LogicalAnd: 8145case BinaryOperatorKind.LogicalOr: 8146case BinaryOperatorKind.UnsignedRightShift when isDynamic: 8154BinaryOperatorKind result = OverloadResolution.BinopEasyOut.OpKind(op, leftType, rightType); 8157if (result == BinaryOperatorKind.Error) 8161signature = new BinaryOperatorSignature(op | BinaryOperatorKind.Dynamic, leftType, rightType, leftType); 8165signature = new BinaryOperatorSignature(op | BinaryOperatorKind.Dynamic, leftType, rightType, rightType); 8167else if ((op == BinaryOperatorKind.Equal || op == BinaryOperatorKind.NotEqual) && 8174signature = new BinaryOperatorSignature(op | BinaryOperatorKind.Delegate, 8181signature = new BinaryOperatorSignature(op | BinaryOperatorKind.Delegate, 8187signature = new BinaryOperatorSignature(op | BinaryOperatorKind.Object, compilation.ObjectType, compilation.ObjectType, 8191else if (op == BinaryOperatorKind.Addition && 8198signature = new BinaryOperatorSignature(op | BinaryOperatorKind.String, leftType, compilation.ObjectType, leftType); 8203signature = new BinaryOperatorSignature(op | BinaryOperatorKind.String, compilation.ObjectType, rightType, rightType); 8206else if (op == BinaryOperatorKind.Addition && 8212signature = new BinaryOperatorSignature(op | BinaryOperatorKind.Pointer, leftType, symbol1.Parameters[1].Type.GetSymbol(), leftType); 8217signature = new BinaryOperatorSignature(op | BinaryOperatorKind.Pointer, symbol1.Parameters[0].Type.GetSymbol(), rightType, rightType); 8221else if (op == BinaryOperatorKind.Subtraction && 8224signature = new BinaryOperatorSignature(op | BinaryOperatorKind.String, leftType, symbol1.Parameters[1].Type.GetSymbol(), leftType); 8227else if (op == BinaryOperatorKind.Subtraction && leftType.IsPointerType() && TypeSymbol.Equals(leftType, rightType, TypeCompareKind.ConsiderEverything2)) 8229signature = new BinaryOperatorSignature(op | BinaryOperatorKind.Pointer, leftType, rightType, compilation.GetSpecialType(SpecialType.System_Int64)); 8231else if ((op == BinaryOperatorKind.Addition || op == BinaryOperatorKind.Subtraction) && 8233(result = OverloadResolution.BinopEasyOut.OpKind(op, leftType.EnumUnderlyingTypeOrSelf(), rightType)) != BinaryOperatorKind.Error && 8236signature = new BinaryOperatorSignature(signature.Kind | BinaryOperatorKind.EnumAndUnderlying, leftType, signature.RightType, leftType); 8238else if ((op == BinaryOperatorKind.Addition || op == BinaryOperatorKind.Subtraction) && 8240(result = OverloadResolution.BinopEasyOut.OpKind(op, leftType, rightType.EnumUnderlyingTypeOrSelf())) != BinaryOperatorKind.Error && 8243signature = new BinaryOperatorSignature(signature.Kind | BinaryOperatorKind.EnumAndUnderlying, signature.LeftType, rightType, rightType); 8245else if (op == BinaryOperatorKind.Subtraction && 8248signature = new BinaryOperatorSignature(op | BinaryOperatorKind.Enum, leftType, rightType, leftType.EnumUnderlyingTypeOrSelf()); 8250else if ((op == BinaryOperatorKind.Equal || 8251op == BinaryOperatorKind.NotEqual || 8252op == BinaryOperatorKind.LessThan || 8253op == BinaryOperatorKind.LessThanOrEqual || 8254op == BinaryOperatorKind.GreaterThan || 8255op == BinaryOperatorKind.GreaterThanOrEqual) && 8258signature = new BinaryOperatorSignature(op | BinaryOperatorKind.Enum, leftType, rightType, compilation.GetSpecialType(SpecialType.System_Boolean)); 8260else if ((op == BinaryOperatorKind.Xor || 8261op == BinaryOperatorKind.And || 8262op == BinaryOperatorKind.Or) && 8265signature = new BinaryOperatorSignature(op | BinaryOperatorKind.Enum, leftType, rightType, leftType); 8267else if ((op == BinaryOperatorKind.Addition || op == BinaryOperatorKind.Subtraction) && 8270signature = new BinaryOperatorSignature(op | BinaryOperatorKind.Delegate, leftType, leftType, leftType); 8272else if ((op == BinaryOperatorKind.Equal || 8273op == BinaryOperatorKind.NotEqual || 8274op == BinaryOperatorKind.LessThan || 8275op == BinaryOperatorKind.LessThanOrEqual || 8276op == BinaryOperatorKind.GreaterThan || 8277op == BinaryOperatorKind.GreaterThanOrEqual) && 8280signature = new BinaryOperatorSignature(op | BinaryOperatorKind.Pointer, 8340else if ((op == BinaryOperatorKind.Equal || op == BinaryOperatorKind.NotEqual) && 8371else if (op == BinaryOperatorKind.Addition || op == BinaryOperatorKind.Subtraction) 8403case BinaryOperatorKind.Multiplication: 8404case BinaryOperatorKind.Addition: 8405case BinaryOperatorKind.Subtraction: 8406case 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 })