1898 references to BinaryOperatorKind
Microsoft.CodeAnalysis.CSharp (1895)
Binder\Binder.ValueChecks.cs (1)
5319if (binary.OperatorKind == BinaryOperatorKind.Utf8Addition)
Binder\Binder_InterpolatedString.cs (3)
151: FoldStringConcatenation(BinaryOperatorKind.StringConcatenation, resultConstant, value.ConstantValueOpt); 173: FoldStringConcatenation(BinaryOperatorKind.StringConcatenation, resultConstant, constantValue); 543BinaryOperatorKind.StringConcatenation,
Binder\Binder_Operators.cs (302)
31BinaryOperatorKind kind = SyntaxKindToBinaryOperatorKind(node.Kind()); 38BinaryOperatorKind kindOperator = kind.Operator(); 41case BinaryOperatorKind.Addition: 42case BinaryOperatorKind.Subtraction: 62if (IsLegalDynamicOperand(right) && IsLegalDynamicOperand(left) && kind != BinaryOperatorKind.UnsignedRightShift) 79kind.WithType(BinaryOperatorKind.Dynamic).WithOverflowChecksIfApplicable(CheckOverflowAtRuntime), 192isUnsignedRightShift: bestSignature.Kind.Operator() == BinaryOperatorKind.UnsignedRightShift, bestSignature.ConstrainedToTypeOpt, diagnostics); 262BoundCompoundAssignmentOperator? tryApplyUserDefinedInstanceOperator(ExpressionSyntax node, SyntaxToken operatorToken, BinaryOperatorKind kind, BoundExpression left, BoundExpression right, BindingDiagnosticBag diagnostics) 403private BoundExpression BindEventAssignment(AssignmentExpressionSyntax node, BoundEventAccess left, BoundExpression right, BinaryOperatorKind opKind, BindingDiagnosticBag diagnostics) 405Debug.Assert(opKind == BinaryOperatorKind.Addition || opKind == BinaryOperatorKind.Subtraction); 428bool isAddition = opKind == BinaryOperatorKind.Addition; 513BinaryOperatorKind kind, 526if (!leftValidOperand || !rightValidOperand || kind == BinaryOperatorKind.UnsignedRightShift) 540if (!IsValidDynamicCondition(left, isNegative: kind == BinaryOperatorKind.LogicalAnd, diagnostics, userDefinedOperator: out userDefinedOperator)) 544Error(diagnostics, ErrorCode.ERR_InvalidDynamicCondition, node.Left, left.Type, kind == BinaryOperatorKind.LogicalAnd ? "false" : "true"); 557operatorKind: (hasError ? kind : kind.WithType(BinaryOperatorKind.Dynamic)).WithOverflowChecksIfApplicable(CheckOverflowAtRuntime), 653BinaryOperatorKind kind = SyntaxKindToBinaryOperatorKind(node.Kind()); 684bool isEquality = kind == BinaryOperatorKind.Equal || kind == BinaryOperatorKind.NotEqual; 687return new BoundLiteral(node, ConstantValue.Create(kind == BinaryOperatorKind.Equal), GetSpecialType(SpecialType.System_Boolean, diagnostics, node)); 691(kind == BinaryOperatorKind.Equal || kind == BinaryOperatorKind.NotEqual)) 698&& kind == BinaryOperatorKind.Addition 703var stringConstant = FoldBinaryOperator(node, BinaryOperatorKind.StringConcatenation, left, right, right.Type, diagnostics); 704return new BoundBinaryOperator(node, BinaryOperatorKind.StringConcatenation, BoundBinaryOperator.UncommonData.UnconvertedInterpolatedStringAddition(stringConstant), LookupResultKind.Empty, left, right, right.Type); 729BinaryOperatorKind resultOperatorKind = signature.Kind; 734resultOperatorKind &= ~BinaryOperatorKind.TypeMask; 750if ((resultOperatorKind & BinaryOperatorKind.Pointer) == BinaryOperatorKind.Pointer && 772isUnsignedRightShift: resultOperatorKind.Operator() == BinaryOperatorKind.UnsignedRightShift, signature.ConstrainedToTypeOpt, diagnostics); 780if (foundOperator && (resultOperatorKind.OperandTypes() != BinaryOperatorKind.NullableNull)) 787resultOperatorKind is BinaryOperatorKind.ObjectEqual or BinaryOperatorKind.ObjectNotEqual && 843private bool BindSimpleBinaryOperatorParts(BinaryExpressionSyntax node, BindingDiagnosticBag diagnostics, BoundExpression left, BoundExpression right, BinaryOperatorKind kind, 866bool isObjectEquality = signature.Kind == BinaryOperatorKind.ObjectEqual || signature.Kind == BinaryOperatorKind.ObjectNotEqual; 875(signature.Kind.Operator() == BinaryOperatorKind.Equal || signature.Kind.Operator() == BinaryOperatorKind.NotEqual) && 881resultSignature = new BinaryOperatorSignature(kind | BinaryOperatorKind.NullableNull, leftType: null, rightType: null, 957private void ReportAssignmentOperatorError(AssignmentExpressionSyntax node, BinaryOperatorKind kind, BindingDiagnosticBag diagnostics, BoundExpression left, BoundExpression right, LookupResultKind resultKind) 1073BinaryOperatorKind kind = SyntaxKindToBinaryOperatorKind(node.Kind()); 1075Debug.Assert(kind == BinaryOperatorKind.LogicalAnd || kind == BinaryOperatorKind.LogicalOr); 1084var constantValue = FoldBinaryOperator(node, kind | BinaryOperatorKind.Bool, left, right, left.Type, diagnostics); 1087return new BoundBinaryOperator(node, kind | BinaryOperatorKind.Bool, constantValue, methodOpt: null, constrainedToTypeOpt: null, 1145var resultKind = kind | signature.Kind.OperandTypes(); 1148resultKind |= BinaryOperatorKind.Lifted; 1156CheckConstraintLanguageVersionAndRuntimeSupportForOperator(node, kind == BinaryOperatorKind.LogicalAnd ? falseOperator : trueOperator, 1251Debug.Assert(signature.Kind.OperandTypes() == BinaryOperatorKind.UserDefined); 1440private TypeSymbol GetBinaryOperatorErrorType(BinaryOperatorKind kind, BindingDiagnosticBag diagnostics, CSharpSyntaxNode node) 1444case BinaryOperatorKind.Equal: 1445case BinaryOperatorKind.NotEqual: 1446case BinaryOperatorKind.GreaterThan: 1447case BinaryOperatorKind.LessThan: 1448case BinaryOperatorKind.GreaterThanOrEqual: 1449case BinaryOperatorKind.LessThanOrEqual: 1457BinaryOperatorKind kind, 1536private bool IsTypelessExpressionAllowedInBinaryOperator(BinaryOperatorKind kind, BoundExpression left, BoundExpression right) 1547bool isEquality = kind == BinaryOperatorKind.Equal || kind == BinaryOperatorKind.NotEqual; 1637private static object FoldDecimalBinaryOperators(BinaryOperatorKind kind, ConstantValue valueLeft, ConstantValue valueRight) 1653case BinaryOperatorKind.DecimalAddition: 1655case BinaryOperatorKind.DecimalSubtraction: 1657case BinaryOperatorKind.DecimalMultiplication: 1659case BinaryOperatorKind.DecimalDivision: 1661case BinaryOperatorKind.DecimalRemainder: 1668private static object FoldNativeIntegerOverflowingBinaryOperator(BinaryOperatorKind kind, ConstantValue valueLeft, ConstantValue valueRight) 1677case BinaryOperatorKind.NIntAddition: 1679case BinaryOperatorKind.NUIntAddition: 1681case BinaryOperatorKind.NIntSubtraction: 1683case BinaryOperatorKind.NUIntSubtraction: 1685case BinaryOperatorKind.NIntMultiplication: 1687case BinaryOperatorKind.NUIntMultiplication: 1689case BinaryOperatorKind.NIntDivision: 1691case BinaryOperatorKind.NIntRemainder: 1693case BinaryOperatorKind.NIntLeftShift: 1699case BinaryOperatorKind.NUIntLeftShift: 1711private static object FoldUncheckedIntegralBinaryOperator(BinaryOperatorKind kind, ConstantValue valueLeft, ConstantValue valueRight) 1720case BinaryOperatorKind.IntAddition: 1722case BinaryOperatorKind.LongAddition: 1724case BinaryOperatorKind.UIntAddition: 1726case BinaryOperatorKind.ULongAddition: 1728case BinaryOperatorKind.IntSubtraction: 1730case BinaryOperatorKind.LongSubtraction: 1732case BinaryOperatorKind.UIntSubtraction: 1734case BinaryOperatorKind.ULongSubtraction: 1736case BinaryOperatorKind.IntMultiplication: 1738case BinaryOperatorKind.LongMultiplication: 1740case BinaryOperatorKind.UIntMultiplication: 1742case BinaryOperatorKind.ULongMultiplication: 1746case BinaryOperatorKind.IntDivision: 1754case BinaryOperatorKind.LongDivision: 1767private static object FoldCheckedIntegralBinaryOperator(BinaryOperatorKind kind, ConstantValue valueLeft, ConstantValue valueRight) 1776case BinaryOperatorKind.IntAddition: 1778case BinaryOperatorKind.LongAddition: 1780case BinaryOperatorKind.UIntAddition: 1782case BinaryOperatorKind.ULongAddition: 1784case BinaryOperatorKind.IntSubtraction: 1786case BinaryOperatorKind.LongSubtraction: 1788case BinaryOperatorKind.UIntSubtraction: 1790case BinaryOperatorKind.ULongSubtraction: 1792case BinaryOperatorKind.IntMultiplication: 1794case BinaryOperatorKind.LongMultiplication: 1796case BinaryOperatorKind.UIntMultiplication: 1798case BinaryOperatorKind.ULongMultiplication: 1800case BinaryOperatorKind.IntDivision: 1802case BinaryOperatorKind.LongDivision: 1810internal static TypeSymbol GetEnumType(BinaryOperatorKind kind, BoundExpression left, BoundExpression right) 1814case BinaryOperatorKind.EnumAndUnderlyingAddition: 1815case BinaryOperatorKind.EnumAndUnderlyingSubtraction: 1816case BinaryOperatorKind.EnumAnd: 1817case BinaryOperatorKind.EnumOr: 1818case BinaryOperatorKind.EnumXor: 1819case BinaryOperatorKind.EnumEqual: 1820case BinaryOperatorKind.EnumGreaterThan: 1821case BinaryOperatorKind.EnumGreaterThanOrEqual: 1822case BinaryOperatorKind.EnumLessThan: 1823case BinaryOperatorKind.EnumLessThanOrEqual: 1824case BinaryOperatorKind.EnumNotEqual: 1825case BinaryOperatorKind.EnumSubtraction: 1827case BinaryOperatorKind.UnderlyingAndEnumAddition: 1828case BinaryOperatorKind.UnderlyingAndEnumSubtraction: 1859BinaryOperatorKind kind, 1893BinaryOperatorKind newKind = kind.Operator().WithType(newLeftOperand.Type!.SpecialType); 1897case BinaryOperatorKind.Addition: 1898case BinaryOperatorKind.Subtraction: 1899case BinaryOperatorKind.And: 1900case BinaryOperatorKind.Or: 1901case BinaryOperatorKind.Xor: 1905case BinaryOperatorKind.LessThan: 1906case BinaryOperatorKind.LessThanOrEqual: 1907case BinaryOperatorKind.GreaterThan: 1908case BinaryOperatorKind.GreaterThanOrEqual: 1909case BinaryOperatorKind.Equal: 1910case BinaryOperatorKind.NotEqual: 1922TypeSymbol resultType = kind == BinaryOperatorKind.EnumSubtraction ? underlyingType : enumType; 1934BinaryOperatorKind kind, 2089private static ConstantValue? TryFoldingNullableEquality(BinaryOperatorKind kind, BoundExpression left, BoundExpression right) 2093BinaryOperatorKind op = kind.Operator(); 2094if (op == BinaryOperatorKind.Equal || op == BinaryOperatorKind.NotEqual) 2111return (leftIsNull == rightIsNull) == (op == BinaryOperatorKind.Equal) ? ConstantValue.True : ConstantValue.False; 2122private static object? FoldNeverOverflowBinaryOperators(BinaryOperatorKind kind, ConstantValue valueLeft, ConstantValue valueRight) 2131case BinaryOperatorKind.ObjectEqual: 2135case BinaryOperatorKind.ObjectNotEqual: 2139case BinaryOperatorKind.DoubleAddition: 2141case BinaryOperatorKind.FloatAddition: 2143case BinaryOperatorKind.DoubleSubtraction: 2145case BinaryOperatorKind.FloatSubtraction: 2147case BinaryOperatorKind.DoubleMultiplication: 2149case BinaryOperatorKind.FloatMultiplication: 2151case BinaryOperatorKind.DoubleDivision: 2153case BinaryOperatorKind.FloatDivision: 2155case BinaryOperatorKind.DoubleRemainder: 2157case BinaryOperatorKind.FloatRemainder: 2159case BinaryOperatorKind.IntLeftShift: 2161case BinaryOperatorKind.LongLeftShift: 2163case BinaryOperatorKind.UIntLeftShift: 2165case BinaryOperatorKind.ULongLeftShift: 2167case BinaryOperatorKind.IntRightShift: 2168case BinaryOperatorKind.NIntRightShift: 2170case BinaryOperatorKind.IntUnsignedRightShift: 2172case BinaryOperatorKind.NIntUnsignedRightShift: 2174case BinaryOperatorKind.LongRightShift: 2176case BinaryOperatorKind.LongUnsignedRightShift: 2178case BinaryOperatorKind.UIntRightShift: 2179case BinaryOperatorKind.NUIntRightShift: 2180case BinaryOperatorKind.UIntUnsignedRightShift: 2181case BinaryOperatorKind.NUIntUnsignedRightShift: 2183case BinaryOperatorKind.ULongRightShift: 2184case BinaryOperatorKind.ULongUnsignedRightShift: 2186case BinaryOperatorKind.BoolAnd: 2188case BinaryOperatorKind.IntAnd: 2189case BinaryOperatorKind.NIntAnd: 2191case BinaryOperatorKind.LongAnd: 2193case BinaryOperatorKind.UIntAnd: 2194case BinaryOperatorKind.NUIntAnd: 2196case BinaryOperatorKind.ULongAnd: 2198case BinaryOperatorKind.BoolOr: 2200case BinaryOperatorKind.IntOr: 2201case BinaryOperatorKind.NIntOr: 2203case BinaryOperatorKind.LongOr: 2205case BinaryOperatorKind.UIntOr: 2206case BinaryOperatorKind.NUIntOr: 2208case BinaryOperatorKind.ULongOr: 2210case BinaryOperatorKind.BoolXor: 2212case BinaryOperatorKind.IntXor: 2213case BinaryOperatorKind.NIntXor: 2215case BinaryOperatorKind.LongXor: 2217case BinaryOperatorKind.UIntXor: 2218case BinaryOperatorKind.NUIntXor: 2220case BinaryOperatorKind.ULongXor: 2222case BinaryOperatorKind.LogicalBoolAnd: 2224case BinaryOperatorKind.LogicalBoolOr: 2226case BinaryOperatorKind.BoolEqual: 2228case BinaryOperatorKind.StringEqual: 2230case BinaryOperatorKind.DecimalEqual: 2232case BinaryOperatorKind.FloatEqual: 2234case BinaryOperatorKind.DoubleEqual: 2236case BinaryOperatorKind.IntEqual: 2237case BinaryOperatorKind.NIntEqual: 2239case BinaryOperatorKind.LongEqual: 2241case BinaryOperatorKind.UIntEqual: 2242case BinaryOperatorKind.NUIntEqual: 2244case BinaryOperatorKind.ULongEqual: 2246case BinaryOperatorKind.BoolNotEqual: 2248case BinaryOperatorKind.StringNotEqual: 2250case BinaryOperatorKind.DecimalNotEqual: 2252case BinaryOperatorKind.FloatNotEqual: 2254case BinaryOperatorKind.DoubleNotEqual: 2256case BinaryOperatorKind.IntNotEqual: 2257case BinaryOperatorKind.NIntNotEqual: 2259case BinaryOperatorKind.LongNotEqual: 2261case BinaryOperatorKind.UIntNotEqual: 2262case BinaryOperatorKind.NUIntNotEqual: 2264case BinaryOperatorKind.ULongNotEqual: 2266case BinaryOperatorKind.DecimalLessThan: 2268case BinaryOperatorKind.FloatLessThan: 2270case BinaryOperatorKind.DoubleLessThan: 2272case BinaryOperatorKind.IntLessThan: 2273case BinaryOperatorKind.NIntLessThan: 2275case BinaryOperatorKind.LongLessThan: 2277case BinaryOperatorKind.UIntLessThan: 2278case BinaryOperatorKind.NUIntLessThan: 2280case BinaryOperatorKind.ULongLessThan: 2282case BinaryOperatorKind.DecimalGreaterThan: 2284case BinaryOperatorKind.FloatGreaterThan: 2286case BinaryOperatorKind.DoubleGreaterThan: 2288case BinaryOperatorKind.IntGreaterThan: 2289case BinaryOperatorKind.NIntGreaterThan: 2291case BinaryOperatorKind.LongGreaterThan: 2293case BinaryOperatorKind.UIntGreaterThan: 2294case BinaryOperatorKind.NUIntGreaterThan: 2296case BinaryOperatorKind.ULongGreaterThan: 2298case BinaryOperatorKind.DecimalLessThanOrEqual: 2300case BinaryOperatorKind.FloatLessThanOrEqual: 2302case BinaryOperatorKind.DoubleLessThanOrEqual: 2304case BinaryOperatorKind.IntLessThanOrEqual: 2305case BinaryOperatorKind.NIntLessThanOrEqual: 2307case BinaryOperatorKind.LongLessThanOrEqual: 2309case BinaryOperatorKind.UIntLessThanOrEqual: 2310case BinaryOperatorKind.NUIntLessThanOrEqual: 2312case BinaryOperatorKind.ULongLessThanOrEqual: 2314case BinaryOperatorKind.DecimalGreaterThanOrEqual: 2316case BinaryOperatorKind.FloatGreaterThanOrEqual: 2318case BinaryOperatorKind.DoubleGreaterThanOrEqual: 2320case BinaryOperatorKind.IntGreaterThanOrEqual: 2321case BinaryOperatorKind.NIntGreaterThanOrEqual: 2323case BinaryOperatorKind.LongGreaterThanOrEqual: 2325case BinaryOperatorKind.UIntGreaterThanOrEqual: 2326case BinaryOperatorKind.NUIntGreaterThanOrEqual: 2328case BinaryOperatorKind.ULongGreaterThanOrEqual: 2330case BinaryOperatorKind.UIntDivision: 2331case BinaryOperatorKind.NUIntDivision: 2333case BinaryOperatorKind.ULongDivision: 2337case BinaryOperatorKind.IntRemainder: 2339case BinaryOperatorKind.LongRemainder: 2341case BinaryOperatorKind.UIntRemainder: 2342case BinaryOperatorKind.NUIntRemainder: 2344case BinaryOperatorKind.ULongRemainder: 2354private static ConstantValue? FoldStringConcatenation(BinaryOperatorKind kind, ConstantValue valueLeft, ConstantValue valueRight) 2359if (kind == BinaryOperatorKind.StringConcatenation) 2372public static BinaryOperatorKind SyntaxKindToBinaryOperatorKind(SyntaxKind kind) 2377case SyntaxKind.MultiplyExpression: return BinaryOperatorKind.Multiplication; 2379case SyntaxKind.DivideExpression: return BinaryOperatorKind.Division; 2381case SyntaxKind.ModuloExpression: return BinaryOperatorKind.Remainder; 2383case SyntaxKind.AddExpression: return BinaryOperatorKind.Addition; 2385case SyntaxKind.SubtractExpression: return BinaryOperatorKind.Subtraction; 2387case SyntaxKind.RightShiftExpression: return BinaryOperatorKind.RightShift; 2389case SyntaxKind.UnsignedRightShiftExpression: return BinaryOperatorKind.UnsignedRightShift; 2391case SyntaxKind.LeftShiftExpression: return BinaryOperatorKind.LeftShift; 2392case SyntaxKind.EqualsExpression: return BinaryOperatorKind.Equal; 2393case SyntaxKind.NotEqualsExpression: return BinaryOperatorKind.NotEqual; 2394case SyntaxKind.GreaterThanExpression: return BinaryOperatorKind.GreaterThan; 2395case SyntaxKind.LessThanExpression: return BinaryOperatorKind.LessThan; 2396case SyntaxKind.GreaterThanOrEqualExpression: return BinaryOperatorKind.GreaterThanOrEqual; 2397case SyntaxKind.LessThanOrEqualExpression: return BinaryOperatorKind.LessThanOrEqual; 2399case SyntaxKind.BitwiseAndExpression: return BinaryOperatorKind.And; 2401case SyntaxKind.BitwiseOrExpression: return BinaryOperatorKind.Or; 2403case SyntaxKind.ExclusiveOrExpression: return BinaryOperatorKind.Xor; 2404case SyntaxKind.LogicalAndExpression: return BinaryOperatorKind.LogicalAnd; 2405case SyntaxKind.LogicalOrExpression: return BinaryOperatorKind.LogicalOr; 3520private static bool IsDivisionByZero(BinaryOperatorKind kind, ConstantValue valueRight) 3526case BinaryOperatorKind.DecimalDivision: 3527case BinaryOperatorKind.DecimalRemainder: 3529case BinaryOperatorKind.IntDivision: 3530case BinaryOperatorKind.IntRemainder: 3531case BinaryOperatorKind.NIntDivision: 3532case BinaryOperatorKind.NIntRemainder: 3534case BinaryOperatorKind.LongDivision: 3535case BinaryOperatorKind.LongRemainder: 3537case BinaryOperatorKind.UIntDivision: 3538case BinaryOperatorKind.UIntRemainder: 3539case BinaryOperatorKind.NUIntDivision: 3540case BinaryOperatorKind.NUIntRemainder: 3542case BinaryOperatorKind.ULongDivision: 3543case BinaryOperatorKind.ULongRemainder: 4829private void CheckNativeIntegerFeatureAvailability(BinaryOperatorKind operatorKind, SyntaxNode syntax, BindingDiagnosticBag diagnostics) 4836switch (operatorKind & BinaryOperatorKind.TypeMask) 4838case BinaryOperatorKind.NInt: 4839case BinaryOperatorKind.NUInt:
Binder\Binder_Patterns.cs (32)
1635BinaryOperatorKind operation = tokenKindToBinaryOperatorKind(node.OperatorToken.Kind()); 1636if (operation == BinaryOperatorKind.Equal) 1642BinaryOperatorKind opType = RelationalOperatorType(type.EnumUnderlyingTypeOrSelf()); 1645case BinaryOperatorKind.Float: 1646case BinaryOperatorKind.Double: 1653case BinaryOperatorKind.String: 1654case BinaryOperatorKind.Bool: 1655case BinaryOperatorKind.Error: 1679static BinaryOperatorKind tokenKindToBinaryOperatorKind(SyntaxKind kind) => kind switch 1681SyntaxKind.LessThanEqualsToken => BinaryOperatorKind.LessThanOrEqual, 1682SyntaxKind.LessThanToken => BinaryOperatorKind.LessThan, 1683SyntaxKind.GreaterThanToken => BinaryOperatorKind.GreaterThan, 1684SyntaxKind.GreaterThanEqualsToken => BinaryOperatorKind.GreaterThanOrEqual, 1686_ => BinaryOperatorKind.Equal, 1695internal static BinaryOperatorKind RelationalOperatorType(TypeSymbol type) => type.SpecialType switch 1697SpecialType.System_Single => BinaryOperatorKind.Float, 1698SpecialType.System_Double => BinaryOperatorKind.Double, 1699SpecialType.System_Char => BinaryOperatorKind.Char, 1700SpecialType.System_SByte => BinaryOperatorKind.Int, // operands are converted to int 1701SpecialType.System_Byte => BinaryOperatorKind.Int, // operands are converted to int 1702SpecialType.System_UInt16 => BinaryOperatorKind.Int, // operands are converted to int 1703SpecialType.System_Int16 => BinaryOperatorKind.Int, // operands are converted to int 1704SpecialType.System_Int32 => BinaryOperatorKind.Int, 1705SpecialType.System_UInt32 => BinaryOperatorKind.UInt, 1706SpecialType.System_Int64 => BinaryOperatorKind.Long, 1707SpecialType.System_UInt64 => BinaryOperatorKind.ULong, 1708SpecialType.System_Decimal => BinaryOperatorKind.Decimal, 1709SpecialType.System_String => BinaryOperatorKind.String, 1710SpecialType.System_Boolean => BinaryOperatorKind.Bool, 1711SpecialType.System_IntPtr when type.IsNativeIntegerType => BinaryOperatorKind.NInt, 1712SpecialType.System_UIntPtr when type.IsNativeIntegerType => BinaryOperatorKind.NUInt, 1713_ => 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)
502if (ValueSetFactory.ForInput(input)?.Related(BinaryOperatorKind.Equal, constant.ConstantValue).IsEmpty == true) 1141return resultForRelation(BinaryOperatorKind.Equal, t.Value); 1153resultForRelation(BinaryOperatorKind relation, ConstantValue value) 1353handleRelationWithValue(BinaryOperatorKind.Equal, v2.Value, 1358BinaryOperatorKind relation, 1493if (lengthValues.All(BinaryOperatorKind.Equal, lengthValue)) 1499if (!_forLowering && lengthValues.Any(BinaryOperatorKind.Equal, lengthValue)) 1755BinaryOperatorKind.LessThan => "<", 1756BinaryOperatorKind.LessThanOrEqual => "<=", 1757BinaryOperatorKind.GreaterThan => ">", 1758BinaryOperatorKind.GreaterThanOrEqual => ">=", 2225Debug.Assert(t.Relation == BinaryOperatorKind.GreaterThanOrEqual); 2240return knownResult(BinaryOperatorKind.Equal, t.Value, offset) ?? 2252static Tests? knownResult(BinaryOperatorKind relation, ConstantValue constant, int offset) 2255var 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) 483case BinaryOperatorKind.Addition: 484operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.EnumAndUnderlyingAddition, enumType, underlying, enumType)); 485operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.UnderlyingAndEnumAddition, underlying, enumType, enumType)); 486operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.LiftedEnumAndUnderlyingAddition, nullableEnum, nullableUnderlying, nullableEnum)); 487operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.LiftedUnderlyingAndEnumAddition, nullableUnderlying, nullableEnum, nullableEnum)); 489case BinaryOperatorKind.Subtraction: 492operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.EnumSubtraction, enumType, enumType, underlying)); 493operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.EnumAndUnderlyingSubtraction, enumType, underlying, enumType)); 494operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.LiftedEnumSubtraction, nullableEnum, nullableEnum, nullableUnderlying)); 495operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.LiftedEnumAndUnderlyingSubtraction, nullableEnum, nullableUnderlying, nullableEnum)); 505operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.EnumSubtraction, enumType, enumType, underlying) 507operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.EnumAndUnderlyingSubtraction, enumType, underlying, enumType) 509operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.LiftedEnumSubtraction, nullableEnum, nullableEnum, nullableUnderlying) 511operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.LiftedEnumAndUnderlyingSubtraction, nullableEnum, nullableUnderlying, nullableEnum) 515operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.UnderlyingAndEnumSubtraction, underlying, enumType, enumType) 517operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.LiftedUnderlyingAndEnumSubtraction, nullableUnderlying, nullableEnum, nullableEnum) 521case BinaryOperatorKind.Equal: 522case BinaryOperatorKind.NotEqual: 523case BinaryOperatorKind.GreaterThan: 524case BinaryOperatorKind.LessThan: 525case BinaryOperatorKind.GreaterThanOrEqual: 526case BinaryOperatorKind.LessThanOrEqual: 528operators.Add(new BinaryOperatorSignature(kind | BinaryOperatorKind.Enum, enumType, enumType, boolean)); 529operators.Add(new BinaryOperatorSignature(kind | BinaryOperatorKind.Lifted | BinaryOperatorKind.Enum, nullableEnum, nullableEnum, boolean)); 531case BinaryOperatorKind.And: 532case BinaryOperatorKind.Or: 533case BinaryOperatorKind.Xor: 534operators.Add(new BinaryOperatorSignature(kind | BinaryOperatorKind.Enum, enumType, enumType, enumType)); 535operators.Add(new BinaryOperatorSignature(kind | BinaryOperatorKind.Lifted | BinaryOperatorKind.Enum, nullableEnum, nullableEnum, nullableEnum)); 541BinaryOperatorKind kind, 550case BinaryOperatorKind.Addition: 551operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.PointerAndIntAddition, pointerType, Compilation.GetSpecialType(SpecialType.System_Int32), pointerType)); 552operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.PointerAndUIntAddition, pointerType, Compilation.GetSpecialType(SpecialType.System_UInt32), pointerType)); 553operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.PointerAndLongAddition, pointerType, Compilation.GetSpecialType(SpecialType.System_Int64), pointerType)); 554operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.PointerAndULongAddition, pointerType, Compilation.GetSpecialType(SpecialType.System_UInt64), pointerType)); 555operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.IntAndPointerAddition, Compilation.GetSpecialType(SpecialType.System_Int32), pointerType, pointerType)); 556operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.UIntAndPointerAddition, Compilation.GetSpecialType(SpecialType.System_UInt32), pointerType, pointerType)); 557operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.LongAndPointerAddition, Compilation.GetSpecialType(SpecialType.System_Int64), pointerType, pointerType)); 558operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.ULongAndPointerAddition, Compilation.GetSpecialType(SpecialType.System_UInt64), pointerType, pointerType)); 560case BinaryOperatorKind.Subtraction: 561operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.PointerAndIntSubtraction, pointerType, Compilation.GetSpecialType(SpecialType.System_Int32), pointerType)); 562operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.PointerAndUIntSubtraction, pointerType, Compilation.GetSpecialType(SpecialType.System_UInt32), pointerType)); 563operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.PointerAndLongSubtraction, pointerType, Compilation.GetSpecialType(SpecialType.System_Int64), pointerType)); 564operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.PointerAndULongSubtraction, pointerType, Compilation.GetSpecialType(SpecialType.System_UInt64), pointerType)); 565operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.PointerSubtraction, pointerType, pointerType, Compilation.GetSpecialType(SpecialType.System_Int64))); 571BinaryOperatorKind kind, 576case BinaryOperatorKind.Equal: 577case BinaryOperatorKind.NotEqual: 578case BinaryOperatorKind.GreaterThan: 579case BinaryOperatorKind.LessThan: 580case BinaryOperatorKind.GreaterThanOrEqual: 581case BinaryOperatorKind.LessThanOrEqual: 583operators.Add(new BinaryOperatorSignature(kind | BinaryOperatorKind.Pointer, voidPointerType, voidPointerType, Compilation.GetSpecialType(SpecialType.System_Boolean))); 588private void GetEnumOperations(BinaryOperatorKind kind, BoundExpression left, BoundExpression right, ArrayBuilder<BinaryOperatorSignature> results) 597case BinaryOperatorKind.Multiplication: 598case BinaryOperatorKind.Division: 599case BinaryOperatorKind.Remainder: 600case BinaryOperatorKind.RightShift: 601case BinaryOperatorKind.UnsignedRightShift: 602case BinaryOperatorKind.LeftShift: 603case BinaryOperatorKind.LogicalAnd: 604case BinaryOperatorKind.LogicalOr: 623case BinaryOperatorKind.And: 624case BinaryOperatorKind.Or: 625case BinaryOperatorKind.Xor: 632case BinaryOperatorKind.Addition: 639case BinaryOperatorKind.Subtraction: 646case BinaryOperatorKind.Equal: 647case BinaryOperatorKind.NotEqual: 648case BinaryOperatorKind.GreaterThan: 649case BinaryOperatorKind.LessThan: 650case BinaryOperatorKind.GreaterThanOrEqual: 651case BinaryOperatorKind.LessThanOrEqual: 674BinaryOperatorKind kind, 706private void GetAllBuiltInOperators(BinaryOperatorKind kind, bool isChecked, BoundExpression left, BoundExpression right, ArrayBuilder<BinaryOperatorAnalysisResult> results, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 712bool isEquality = kind == BinaryOperatorKind.Equal || kind == BinaryOperatorKind.NotEqual; 752if (kind.Operator() is BinaryOperatorKind.Addition && 774return value is BoundUtf8String or BoundBinaryOperator { OperatorKind: BinaryOperatorKind.Utf8Addition }; 783private void GetReferenceEquality(BinaryOperatorKind kind, ArrayBuilder<BinaryOperatorSignature> operators) 786operators.Add(new BinaryOperatorSignature(kind | BinaryOperatorKind.Object, @object, @object, Compilation.GetSpecialType(SpecialType.System_Boolean))); 852BinaryOperatorKind kind, 919BinaryOperatorKind kind, 959void getDeclaredOperators(TypeSymbol constrainedToTypeOpt, NamedTypeSymbol type, BinaryOperatorKind kind, string name, ArrayBuilder<BinaryOperatorSignature> operators) 976operators.Add(new BinaryOperatorSignature(BinaryOperatorKind.UserDefined | kind, leftOperandType, rightOperandType, resultType, op, constrainedToTypeOpt)); 982void addLiftedOperators(TypeSymbol constrainedToTypeOpt, BinaryOperatorKind kind, ArrayBuilder<BinaryOperatorSignature> operators) 996BinaryOperatorKind.Lifted | BinaryOperatorKind.UserDefined | kind, 1002BinaryOperatorKind.Lifted | BinaryOperatorKind.UserDefined | kind, 1016private static LiftingResult UserDefinedBinaryOperatorCanBeLifted(TypeSymbol left, TypeSymbol right, TypeSymbol result, BinaryOperatorKind kind) 1041case BinaryOperatorKind.Equal: 1042case BinaryOperatorKind.NotEqual: 1046goto case BinaryOperatorKind.GreaterThan; 1047case BinaryOperatorKind.GreaterThan: 1048case BinaryOperatorKind.GreaterThanOrEqual: 1049case BinaryOperatorKind.LessThan: 1050case BinaryOperatorKind.LessThanOrEqual: 1372private static void AssertNotChecked(BinaryOperatorKind kind) 1374Debug.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)
250public static string BinaryOperatorNameFromOperatorKind(BinaryOperatorKind kind, bool isChecked) 252switch (kind & BinaryOperatorKind.OpMask) 254case BinaryOperatorKind.Addition: return isChecked ? WellKnownMemberNames.CheckedAdditionOperatorName : WellKnownMemberNames.AdditionOperatorName; 255case BinaryOperatorKind.And: return WellKnownMemberNames.BitwiseAndOperatorName; 256case BinaryOperatorKind.Division: return isChecked ? WellKnownMemberNames.CheckedDivisionOperatorName : WellKnownMemberNames.DivisionOperatorName; 257case BinaryOperatorKind.Equal: return WellKnownMemberNames.EqualityOperatorName; 258case BinaryOperatorKind.GreaterThan: return WellKnownMemberNames.GreaterThanOperatorName; 259case BinaryOperatorKind.GreaterThanOrEqual: return WellKnownMemberNames.GreaterThanOrEqualOperatorName; 260case BinaryOperatorKind.LeftShift: return WellKnownMemberNames.LeftShiftOperatorName; 261case BinaryOperatorKind.LessThan: return WellKnownMemberNames.LessThanOperatorName; 262case BinaryOperatorKind.LessThanOrEqual: return WellKnownMemberNames.LessThanOrEqualOperatorName; 263case BinaryOperatorKind.Multiplication: return isChecked ? WellKnownMemberNames.CheckedMultiplyOperatorName : WellKnownMemberNames.MultiplyOperatorName; 264case BinaryOperatorKind.Or: return WellKnownMemberNames.BitwiseOrOperatorName; 265case BinaryOperatorKind.NotEqual: return WellKnownMemberNames.InequalityOperatorName; 266case BinaryOperatorKind.Remainder: return WellKnownMemberNames.ModulusOperatorName; 267case BinaryOperatorKind.RightShift: return WellKnownMemberNames.RightShiftOperatorName; 268case BinaryOperatorKind.UnsignedRightShift: return WellKnownMemberNames.UnsignedRightShiftOperatorName; 269case BinaryOperatorKind.Subtraction: return isChecked ? WellKnownMemberNames.CheckedSubtractionOperatorName : WellKnownMemberNames.SubtractionOperatorName; 270case BinaryOperatorKind.Xor: return WellKnownMemberNames.ExclusiveOrOperatorName; 272throw ExceptionUtilities.UnexpectedValue(kind & BinaryOperatorKind.OpMask);
Binder\Semantics\Operators\OperatorKindExtensions.cs (121)
127public static int OperatorIndex(this BinaryOperatorKind kind) 132public static BinaryOperatorKind Operator(this BinaryOperatorKind kind) 134return kind & BinaryOperatorKind.OpMask; 137public static BinaryOperatorKind Unlifted(this BinaryOperatorKind kind) 139return kind & ~BinaryOperatorKind.Lifted; 142public static BinaryOperatorKind OperatorWithLogical(this BinaryOperatorKind kind) 144return kind & (BinaryOperatorKind.OpMask | BinaryOperatorKind.Logical); 147public static BinaryOperatorKind WithType(this BinaryOperatorKind kind, SpecialType type) 149Debug.Assert(kind == (kind & ~BinaryOperatorKind.TypeMask)); 153return kind | BinaryOperatorKind.Int; 155return kind | BinaryOperatorKind.UInt; 157return kind | BinaryOperatorKind.Long; 159return kind | BinaryOperatorKind.ULong; 183public static BinaryOperatorKind WithType(this BinaryOperatorKind kind, BinaryOperatorKind type) 185Debug.Assert(kind == (kind & ~BinaryOperatorKind.TypeMask)); 186Debug.Assert(type == (type & BinaryOperatorKind.TypeMask)); 190public static bool IsLifted(this BinaryOperatorKind kind) 192return 0 != (kind & BinaryOperatorKind.Lifted); 195public static bool IsDynamic(this BinaryOperatorKind kind) 197return kind.OperandTypes() == BinaryOperatorKind.Dynamic; 200public static bool IsComparison(this BinaryOperatorKind kind) 204case BinaryOperatorKind.Equal: 205case BinaryOperatorKind.NotEqual: 206case BinaryOperatorKind.GreaterThan: 207case BinaryOperatorKind.GreaterThanOrEqual: 208case BinaryOperatorKind.LessThan: 209case BinaryOperatorKind.LessThanOrEqual: 215public static bool IsChecked(this BinaryOperatorKind kind) 217return 0 != (kind & BinaryOperatorKind.Checked); 220public static bool EmitsAsCheckedInstruction(this BinaryOperatorKind kind) 229case BinaryOperatorKind.Addition: 230case BinaryOperatorKind.Subtraction: 231case BinaryOperatorKind.Multiplication: 238public static BinaryOperatorKind WithOverflowChecksIfApplicable(this BinaryOperatorKind kind, bool enabled) 246return kind | BinaryOperatorKind.Checked; 253case BinaryOperatorKind.Addition: 254case BinaryOperatorKind.Subtraction: 255case BinaryOperatorKind.Multiplication: 256case BinaryOperatorKind.Division: 257return kind | BinaryOperatorKind.Checked; 264return kind & ~BinaryOperatorKind.Checked; 268public static bool IsEnum(this BinaryOperatorKind kind) 272case BinaryOperatorKind.Enum: 273case BinaryOperatorKind.EnumAndUnderlying: 274case BinaryOperatorKind.UnderlyingAndEnum: 286public static bool IsIntegral(this BinaryOperatorKind kind) 290case BinaryOperatorKind.Int: 291case BinaryOperatorKind.UInt: 292case BinaryOperatorKind.Long: 293case BinaryOperatorKind.ULong: 294case BinaryOperatorKind.NInt: 295case BinaryOperatorKind.NUInt: 296case BinaryOperatorKind.Char: 297case BinaryOperatorKind.Enum: 298case BinaryOperatorKind.EnumAndUnderlying: 299case BinaryOperatorKind.UnderlyingAndEnum: 300case BinaryOperatorKind.Pointer: 301case BinaryOperatorKind.PointerAndInt: 302case BinaryOperatorKind.PointerAndUInt: 303case BinaryOperatorKind.PointerAndLong: 304case BinaryOperatorKind.PointerAndULong: 305case BinaryOperatorKind.IntAndPointer: 306case BinaryOperatorKind.UIntAndPointer: 307case BinaryOperatorKind.LongAndPointer: 308case BinaryOperatorKind.ULongAndPointer: 315public static bool IsLogical(this BinaryOperatorKind kind) 317return 0 != (kind & BinaryOperatorKind.Logical); 320public static BinaryOperatorKind OperandTypes(this BinaryOperatorKind kind) 322return kind & BinaryOperatorKind.TypeMask; 325public static bool IsUserDefined(this BinaryOperatorKind kind) 327return (kind & BinaryOperatorKind.TypeMask) == BinaryOperatorKind.UserDefined; 330public static bool IsShift(this BinaryOperatorKind kind) 332BinaryOperatorKind type = kind.Operator(); 333return type == BinaryOperatorKind.LeftShift || type == BinaryOperatorKind.RightShift || type == BinaryOperatorKind.UnsignedRightShift; 336public static ExpressionType ToExpressionType(this BinaryOperatorKind kind, bool isCompoundAssignment) 342case BinaryOperatorKind.Multiplication: return ExpressionType.MultiplyAssign; 343case BinaryOperatorKind.Addition: return ExpressionType.AddAssign; 344case BinaryOperatorKind.Subtraction: return ExpressionType.SubtractAssign; 345case BinaryOperatorKind.Division: return ExpressionType.DivideAssign; 346case BinaryOperatorKind.Remainder: return ExpressionType.ModuloAssign; 347case BinaryOperatorKind.LeftShift: return ExpressionType.LeftShiftAssign; 348case BinaryOperatorKind.RightShift: return ExpressionType.RightShiftAssign; 349case BinaryOperatorKind.And: return ExpressionType.AndAssign; 350case BinaryOperatorKind.Xor: return ExpressionType.ExclusiveOrAssign; 351case BinaryOperatorKind.Or: return ExpressionType.OrAssign; 358case BinaryOperatorKind.Multiplication: return ExpressionType.Multiply; 359case BinaryOperatorKind.Addition: return ExpressionType.Add; 360case BinaryOperatorKind.Subtraction: return ExpressionType.Subtract; 361case BinaryOperatorKind.Division: return ExpressionType.Divide; 362case BinaryOperatorKind.Remainder: return ExpressionType.Modulo; 363case BinaryOperatorKind.LeftShift: return ExpressionType.LeftShift; 364case BinaryOperatorKind.RightShift: return ExpressionType.RightShift; 365case BinaryOperatorKind.Equal: return ExpressionType.Equal; 366case BinaryOperatorKind.NotEqual: return ExpressionType.NotEqual; 367case BinaryOperatorKind.GreaterThan: return ExpressionType.GreaterThan; 368case BinaryOperatorKind.LessThan: return ExpressionType.LessThan; 369case BinaryOperatorKind.GreaterThanOrEqual: return ExpressionType.GreaterThanOrEqual; 370case BinaryOperatorKind.LessThanOrEqual: return ExpressionType.LessThanOrEqual; 371case BinaryOperatorKind.And: return ExpressionType.And; 372case BinaryOperatorKind.Xor: return ExpressionType.ExclusiveOr; 373case BinaryOperatorKind.Or: return ExpressionType.Or; 404public static string Dump(this BinaryOperatorKind kind) 407if ((kind & BinaryOperatorKind.Lifted) != 0) b.Append("Lifted"); 408if ((kind & BinaryOperatorKind.Logical) != 0) b.Append("Logical"); 409if ((kind & BinaryOperatorKind.Checked) != 0) b.Append("Checked"); 410var type = kind & BinaryOperatorKind.TypeMask; 412var op = kind & BinaryOperatorKind.OpMask;
BoundTree\BoundDagRelationalTest.cs (1)
9public BinaryOperatorKind Relation => OperatorKind.Operator();
BoundTree\BoundDagTest.cs (4)
94BinaryOperatorKind.LessThan => "<", 95BinaryOperatorKind.LessThanOrEqual => "<=", 96BinaryOperatorKind.GreaterThan => ">", 97BinaryOperatorKind.GreaterThanOrEqual => ">=",
BoundTree\Constructors.cs (4)
402BinaryOperatorKind operatorKind, 425BinaryOperatorKind operatorKind, 438public BoundBinaryOperator Update(BinaryOperatorKind operatorKind, 461BinaryOperatorKind operatorKind,
BoundTree\TupleBinaryOperatorInfo.cs (4)
47internal readonly BinaryOperatorKind Kind; 59BinaryOperatorKind kind, 140internal readonly BinaryOperatorKind Kind; 142internal NullNull(BinaryOperatorKind kind)
CodeGen\EmitConversion.cs (1)
160(fromPredefTypeKind == Cci.PrimitiveTypeCode.IntPtr && conversion.Operand is BoundBinaryOperator { OperatorKind: BinaryOperatorKind.Division })); // pointer subtraction: see LocalRewriter.RewritePointerSubtraction()
CodeGen\EmitOperators.cs (75)
60var operatorKind = expression.OperatorKind; 101var operatorKind = binary.OperatorKind; 179case BinaryOperatorKind.Multiplication: 183case BinaryOperatorKind.Addition: 187case BinaryOperatorKind.Subtraction: 191case BinaryOperatorKind.Division: 202case BinaryOperatorKind.Remainder: 213case BinaryOperatorKind.LeftShift: 217case BinaryOperatorKind.RightShift: 228case BinaryOperatorKind.UnsignedRightShift: 232case BinaryOperatorKind.And: 236case BinaryOperatorKind.Xor: 240case BinaryOperatorKind.Or: 304case BinaryOperatorKind.LogicalOr: 311goto case BinaryOperatorKind.LogicalAnd; 313case BinaryOperatorKind.LogicalAnd: 330case BinaryOperatorKind.And: 336case BinaryOperatorKind.Or: 342case BinaryOperatorKind.Xor: 353case BinaryOperatorKind.NotEqual: 356goto case BinaryOperatorKind.Equal; 358case BinaryOperatorKind.Equal: 419case BinaryOperatorKind.LessThan: 423case BinaryOperatorKind.LessThanOrEqual: 428case BinaryOperatorKind.GreaterThan: 432case BinaryOperatorKind.GreaterThanOrEqual: 651case BinaryOperatorKind.EnumAndUnderlyingAddition: 652case BinaryOperatorKind.EnumSubtraction: 653case BinaryOperatorKind.EnumAndUnderlyingSubtraction: 656case BinaryOperatorKind.EnumAnd: 657case BinaryOperatorKind.EnumOr: 658case BinaryOperatorKind.EnumXor: 662case BinaryOperatorKind.UnderlyingAndEnumSubtraction: 663case BinaryOperatorKind.UnderlyingAndEnumAddition: 702case BinaryOperatorKind.Multiplication: 713case BinaryOperatorKind.Addition: 724case BinaryOperatorKind.Subtraction: 740private static bool OperatorHasSideEffects(BinaryOperatorKind kind) 744case BinaryOperatorKind.Division: 745case BinaryOperatorKind.Remainder: 778BinaryOperatorKind opKind = op.OperatorKind; 779Debug.Assert(opKind.Operator() != BinaryOperatorKind.UnsignedRightShift); 781BinaryOperatorKind type = opKind.OperandTypes(); 784case BinaryOperatorKind.Enum: 785case BinaryOperatorKind.EnumAndUnderlying: 788case BinaryOperatorKind.UnderlyingAndEnum: 791case BinaryOperatorKind.UInt: 792case BinaryOperatorKind.NUInt: 793case BinaryOperatorKind.ULong: 794case BinaryOperatorKind.ULongAndPointer: 795case BinaryOperatorKind.PointerAndInt: 796case BinaryOperatorKind.PointerAndUInt: 797case BinaryOperatorKind.PointerAndLong: 798case BinaryOperatorKind.PointerAndULong: 799case BinaryOperatorKind.Pointer: 803case BinaryOperatorKind.IntAndPointer: 804case BinaryOperatorKind.LongAndPointer: 806case BinaryOperatorKind.UIntAndPointer: 812private static bool IsConditional(BinaryOperatorKind opKind) 816case BinaryOperatorKind.LogicalAnd: 817case BinaryOperatorKind.LogicalOr: 818case BinaryOperatorKind.Equal: 819case BinaryOperatorKind.NotEqual: 820case BinaryOperatorKind.LessThan: 821case BinaryOperatorKind.LessThanOrEqual: 822case BinaryOperatorKind.GreaterThan: 823case BinaryOperatorKind.GreaterThanOrEqual: 826case BinaryOperatorKind.And: 827case BinaryOperatorKind.Or: 828case BinaryOperatorKind.Xor: 829return opKind.OperandTypes() == BinaryOperatorKind.Bool; 835private static bool IsFloat(BinaryOperatorKind opKind) 837var type = opKind.OperandTypes(); 840case BinaryOperatorKind.Float: 841case BinaryOperatorKind.Double:
CodeGen\EmitStatement.cs (24)
230var opKind = condition.OperatorKind.Operator(); 232Debug.Assert(opKind == BinaryOperatorKind.Equal || 233opKind == BinaryOperatorKind.NotEqual); 274if (opKind == BinaryOperatorKind.NotEqual) 305case BinaryOperatorKind.Equal: 309case BinaryOperatorKind.NotEqual: 313case BinaryOperatorKind.LessThan: 317case BinaryOperatorKind.LessThanOrEqual: 321case BinaryOperatorKind.GreaterThan: 325case BinaryOperatorKind.GreaterThanOrEqual: 424if (binOp.OperatorKind.OperatorWithLogical() is BinaryOperatorKind.LogicalOr or BinaryOperatorKind.LogicalAnd) 445binary.OperatorKind.OperatorWithLogical() is BinaryOperatorKind.LogicalOr or BinaryOperatorKind.LogicalAnd) 447if (binary.OperatorKind.OperatorWithLogical() is BinaryOperatorKind.LogicalOr ? !top.sense : top.sense) 494case BinaryOperatorKind.LogicalOr: 495case BinaryOperatorKind.LogicalAnd: 498case BinaryOperatorKind.Equal: 499case BinaryOperatorKind.NotEqual: 507goto case BinaryOperatorKind.LessThan; 509case BinaryOperatorKind.LessThan: 510case BinaryOperatorKind.LessThanOrEqual: 511case BinaryOperatorKind.GreaterThan: 512case BinaryOperatorKind.GreaterThanOrEqual:
CodeGen\Optimizer.cs (2)
1509var isLogical = (binary.OperatorKind & BinaryOperatorKind.Logical) != 0; 1547var isLogical = (node.OperatorKind & BinaryOperatorKind.Logical) != 0;
Compilation\BuiltInOperators.cs (368)
297builder.Add(GetSignature((BinaryOperatorKind)kind)); 303internal void GetSimpleBuiltInOperators(BinaryOperatorKind kind, ArrayBuilder<BinaryOperatorSignature> operators, bool skipNativeIntegerOperators) 322ImmutableArray.Create<BinaryOperatorSignature>(GetSignature(BinaryOperatorKind.LogicalBoolAnd)), //and 324ImmutableArray.Create<BinaryOperatorSignature>(GetSignature(BinaryOperatorKind.LogicalBoolOr)), //or 332(int)BinaryOperatorKind.IntMultiplication, 333(int)BinaryOperatorKind.UIntMultiplication, 334(int)BinaryOperatorKind.LongMultiplication, 335(int)BinaryOperatorKind.ULongMultiplication, 336(int)BinaryOperatorKind.NIntMultiplication, 337(int)BinaryOperatorKind.NUIntMultiplication, 338(int)BinaryOperatorKind.FloatMultiplication, 339(int)BinaryOperatorKind.DoubleMultiplication, 340(int)BinaryOperatorKind.DecimalMultiplication, 341(int)BinaryOperatorKind.LiftedIntMultiplication, 342(int)BinaryOperatorKind.LiftedUIntMultiplication, 343(int)BinaryOperatorKind.LiftedLongMultiplication, 344(int)BinaryOperatorKind.LiftedULongMultiplication, 345(int)BinaryOperatorKind.LiftedNIntMultiplication, 346(int)BinaryOperatorKind.LiftedNUIntMultiplication, 347(int)BinaryOperatorKind.LiftedFloatMultiplication, 348(int)BinaryOperatorKind.LiftedDoubleMultiplication, 349(int)BinaryOperatorKind.LiftedDecimalMultiplication, 353(int)BinaryOperatorKind.IntAddition, 354(int)BinaryOperatorKind.UIntAddition, 355(int)BinaryOperatorKind.LongAddition, 356(int)BinaryOperatorKind.ULongAddition, 357(int)BinaryOperatorKind.NIntAddition, 358(int)BinaryOperatorKind.NUIntAddition, 359(int)BinaryOperatorKind.FloatAddition, 360(int)BinaryOperatorKind.DoubleAddition, 361(int)BinaryOperatorKind.DecimalAddition, 362(int)BinaryOperatorKind.LiftedIntAddition, 363(int)BinaryOperatorKind.LiftedUIntAddition, 364(int)BinaryOperatorKind.LiftedLongAddition, 365(int)BinaryOperatorKind.LiftedULongAddition, 366(int)BinaryOperatorKind.LiftedNIntAddition, 367(int)BinaryOperatorKind.LiftedNUIntAddition, 368(int)BinaryOperatorKind.LiftedFloatAddition, 369(int)BinaryOperatorKind.LiftedDoubleAddition, 370(int)BinaryOperatorKind.LiftedDecimalAddition, 371(int)BinaryOperatorKind.StringConcatenation, 372(int)BinaryOperatorKind.StringAndObjectConcatenation, 373(int)BinaryOperatorKind.ObjectAndStringConcatenation, 377(int)BinaryOperatorKind.IntSubtraction, 378(int)BinaryOperatorKind.UIntSubtraction, 379(int)BinaryOperatorKind.LongSubtraction, 380(int)BinaryOperatorKind.ULongSubtraction, 381(int)BinaryOperatorKind.NIntSubtraction, 382(int)BinaryOperatorKind.NUIntSubtraction, 383(int)BinaryOperatorKind.FloatSubtraction, 384(int)BinaryOperatorKind.DoubleSubtraction, 385(int)BinaryOperatorKind.DecimalSubtraction, 386(int)BinaryOperatorKind.LiftedIntSubtraction, 387(int)BinaryOperatorKind.LiftedUIntSubtraction, 388(int)BinaryOperatorKind.LiftedLongSubtraction, 389(int)BinaryOperatorKind.LiftedULongSubtraction, 390(int)BinaryOperatorKind.LiftedNIntSubtraction, 391(int)BinaryOperatorKind.LiftedNUIntSubtraction, 392(int)BinaryOperatorKind.LiftedFloatSubtraction, 393(int)BinaryOperatorKind.LiftedDoubleSubtraction, 394(int)BinaryOperatorKind.LiftedDecimalSubtraction, 398(int)BinaryOperatorKind.IntDivision, 399(int)BinaryOperatorKind.UIntDivision, 400(int)BinaryOperatorKind.LongDivision, 401(int)BinaryOperatorKind.ULongDivision, 402(int)BinaryOperatorKind.NIntDivision, 403(int)BinaryOperatorKind.NUIntDivision, 404(int)BinaryOperatorKind.FloatDivision, 405(int)BinaryOperatorKind.DoubleDivision, 406(int)BinaryOperatorKind.DecimalDivision, 407(int)BinaryOperatorKind.LiftedIntDivision, 408(int)BinaryOperatorKind.LiftedUIntDivision, 409(int)BinaryOperatorKind.LiftedLongDivision, 410(int)BinaryOperatorKind.LiftedULongDivision, 411(int)BinaryOperatorKind.LiftedNIntDivision, 412(int)BinaryOperatorKind.LiftedNUIntDivision, 413(int)BinaryOperatorKind.LiftedFloatDivision, 414(int)BinaryOperatorKind.LiftedDoubleDivision, 415(int)BinaryOperatorKind.LiftedDecimalDivision, 419(int)BinaryOperatorKind.IntRemainder, 420(int)BinaryOperatorKind.UIntRemainder, 421(int)BinaryOperatorKind.LongRemainder, 422(int)BinaryOperatorKind.ULongRemainder, 423(int)BinaryOperatorKind.NIntRemainder, 424(int)BinaryOperatorKind.NUIntRemainder, 425(int)BinaryOperatorKind.FloatRemainder, 426(int)BinaryOperatorKind.DoubleRemainder, 427(int)BinaryOperatorKind.DecimalRemainder, 428(int)BinaryOperatorKind.LiftedIntRemainder, 429(int)BinaryOperatorKind.LiftedUIntRemainder, 430(int)BinaryOperatorKind.LiftedLongRemainder, 431(int)BinaryOperatorKind.LiftedULongRemainder, 432(int)BinaryOperatorKind.LiftedNIntRemainder, 433(int)BinaryOperatorKind.LiftedNUIntRemainder, 434(int)BinaryOperatorKind.LiftedFloatRemainder, 435(int)BinaryOperatorKind.LiftedDoubleRemainder, 436(int)BinaryOperatorKind.LiftedDecimalRemainder, 440(int)BinaryOperatorKind.IntLeftShift, 441(int)BinaryOperatorKind.UIntLeftShift, 442(int)BinaryOperatorKind.LongLeftShift, 443(int)BinaryOperatorKind.ULongLeftShift, 444(int)BinaryOperatorKind.NIntLeftShift, 445(int)BinaryOperatorKind.NUIntLeftShift, 446(int)BinaryOperatorKind.LiftedIntLeftShift, 447(int)BinaryOperatorKind.LiftedUIntLeftShift, 448(int)BinaryOperatorKind.LiftedLongLeftShift, 449(int)BinaryOperatorKind.LiftedULongLeftShift, 450(int)BinaryOperatorKind.LiftedNIntLeftShift, 451(int)BinaryOperatorKind.LiftedNUIntLeftShift, 455(int)BinaryOperatorKind.IntRightShift, 456(int)BinaryOperatorKind.UIntRightShift, 457(int)BinaryOperatorKind.LongRightShift, 458(int)BinaryOperatorKind.ULongRightShift, 459(int)BinaryOperatorKind.NIntRightShift, 460(int)BinaryOperatorKind.NUIntRightShift, 461(int)BinaryOperatorKind.LiftedIntRightShift, 462(int)BinaryOperatorKind.LiftedUIntRightShift, 463(int)BinaryOperatorKind.LiftedLongRightShift, 464(int)BinaryOperatorKind.LiftedULongRightShift, 465(int)BinaryOperatorKind.LiftedNIntRightShift, 466(int)BinaryOperatorKind.LiftedNUIntRightShift, 470(int)BinaryOperatorKind.IntEqual, 471(int)BinaryOperatorKind.UIntEqual, 472(int)BinaryOperatorKind.LongEqual, 473(int)BinaryOperatorKind.ULongEqual, 474(int)BinaryOperatorKind.NIntEqual, 475(int)BinaryOperatorKind.NUIntEqual, 476(int)BinaryOperatorKind.FloatEqual, 477(int)BinaryOperatorKind.DoubleEqual, 478(int)BinaryOperatorKind.DecimalEqual, 479(int)BinaryOperatorKind.BoolEqual, 480(int)BinaryOperatorKind.LiftedIntEqual, 481(int)BinaryOperatorKind.LiftedUIntEqual, 482(int)BinaryOperatorKind.LiftedLongEqual, 483(int)BinaryOperatorKind.LiftedULongEqual, 484(int)BinaryOperatorKind.LiftedNIntEqual, 485(int)BinaryOperatorKind.LiftedNUIntEqual, 486(int)BinaryOperatorKind.LiftedFloatEqual, 487(int)BinaryOperatorKind.LiftedDoubleEqual, 488(int)BinaryOperatorKind.LiftedDecimalEqual, 489(int)BinaryOperatorKind.LiftedBoolEqual, 490(int)BinaryOperatorKind.ObjectEqual, 491(int)BinaryOperatorKind.StringEqual, 495(int)BinaryOperatorKind.IntNotEqual, 496(int)BinaryOperatorKind.UIntNotEqual, 497(int)BinaryOperatorKind.LongNotEqual, 498(int)BinaryOperatorKind.ULongNotEqual, 499(int)BinaryOperatorKind.NIntNotEqual, 500(int)BinaryOperatorKind.NUIntNotEqual, 501(int)BinaryOperatorKind.FloatNotEqual, 502(int)BinaryOperatorKind.DoubleNotEqual, 503(int)BinaryOperatorKind.DecimalNotEqual, 504(int)BinaryOperatorKind.BoolNotEqual, 505(int)BinaryOperatorKind.LiftedIntNotEqual, 506(int)BinaryOperatorKind.LiftedUIntNotEqual, 507(int)BinaryOperatorKind.LiftedLongNotEqual, 508(int)BinaryOperatorKind.LiftedULongNotEqual, 509(int)BinaryOperatorKind.LiftedNIntNotEqual, 510(int)BinaryOperatorKind.LiftedNUIntNotEqual, 511(int)BinaryOperatorKind.LiftedFloatNotEqual, 512(int)BinaryOperatorKind.LiftedDoubleNotEqual, 513(int)BinaryOperatorKind.LiftedDecimalNotEqual, 514(int)BinaryOperatorKind.LiftedBoolNotEqual, 515(int)BinaryOperatorKind.ObjectNotEqual, 516(int)BinaryOperatorKind.StringNotEqual, 520(int)BinaryOperatorKind.IntGreaterThan, 521(int)BinaryOperatorKind.UIntGreaterThan, 522(int)BinaryOperatorKind.LongGreaterThan, 523(int)BinaryOperatorKind.ULongGreaterThan, 524(int)BinaryOperatorKind.NIntGreaterThan, 525(int)BinaryOperatorKind.NUIntGreaterThan, 526(int)BinaryOperatorKind.FloatGreaterThan, 527(int)BinaryOperatorKind.DoubleGreaterThan, 528(int)BinaryOperatorKind.DecimalGreaterThan, 529(int)BinaryOperatorKind.LiftedIntGreaterThan, 530(int)BinaryOperatorKind.LiftedUIntGreaterThan, 531(int)BinaryOperatorKind.LiftedLongGreaterThan, 532(int)BinaryOperatorKind.LiftedULongGreaterThan, 533(int)BinaryOperatorKind.LiftedNIntGreaterThan, 534(int)BinaryOperatorKind.LiftedNUIntGreaterThan, 535(int)BinaryOperatorKind.LiftedFloatGreaterThan, 536(int)BinaryOperatorKind.LiftedDoubleGreaterThan, 537(int)BinaryOperatorKind.LiftedDecimalGreaterThan, 541(int)BinaryOperatorKind.IntLessThan, 542(int)BinaryOperatorKind.UIntLessThan, 543(int)BinaryOperatorKind.LongLessThan, 544(int)BinaryOperatorKind.ULongLessThan, 545(int)BinaryOperatorKind.NIntLessThan, 546(int)BinaryOperatorKind.NUIntLessThan, 547(int)BinaryOperatorKind.FloatLessThan, 548(int)BinaryOperatorKind.DoubleLessThan, 549(int)BinaryOperatorKind.DecimalLessThan, 550(int)BinaryOperatorKind.LiftedIntLessThan, 551(int)BinaryOperatorKind.LiftedUIntLessThan, 552(int)BinaryOperatorKind.LiftedLongLessThan, 553(int)BinaryOperatorKind.LiftedULongLessThan, 554(int)BinaryOperatorKind.LiftedNIntLessThan, 555(int)BinaryOperatorKind.LiftedNUIntLessThan, 556(int)BinaryOperatorKind.LiftedFloatLessThan, 557(int)BinaryOperatorKind.LiftedDoubleLessThan, 558(int)BinaryOperatorKind.LiftedDecimalLessThan, 562(int)BinaryOperatorKind.IntGreaterThanOrEqual, 563(int)BinaryOperatorKind.UIntGreaterThanOrEqual, 564(int)BinaryOperatorKind.LongGreaterThanOrEqual, 565(int)BinaryOperatorKind.ULongGreaterThanOrEqual, 566(int)BinaryOperatorKind.NIntGreaterThanOrEqual, 567(int)BinaryOperatorKind.NUIntGreaterThanOrEqual, 568(int)BinaryOperatorKind.FloatGreaterThanOrEqual, 569(int)BinaryOperatorKind.DoubleGreaterThanOrEqual, 570(int)BinaryOperatorKind.DecimalGreaterThanOrEqual, 571(int)BinaryOperatorKind.LiftedIntGreaterThanOrEqual, 572(int)BinaryOperatorKind.LiftedUIntGreaterThanOrEqual, 573(int)BinaryOperatorKind.LiftedLongGreaterThanOrEqual, 574(int)BinaryOperatorKind.LiftedULongGreaterThanOrEqual, 575(int)BinaryOperatorKind.LiftedNIntGreaterThanOrEqual, 576(int)BinaryOperatorKind.LiftedNUIntGreaterThanOrEqual, 577(int)BinaryOperatorKind.LiftedFloatGreaterThanOrEqual, 578(int)BinaryOperatorKind.LiftedDoubleGreaterThanOrEqual, 579(int)BinaryOperatorKind.LiftedDecimalGreaterThanOrEqual, 583(int)BinaryOperatorKind.IntLessThanOrEqual, 584(int)BinaryOperatorKind.UIntLessThanOrEqual, 585(int)BinaryOperatorKind.LongLessThanOrEqual, 586(int)BinaryOperatorKind.ULongLessThanOrEqual, 587(int)BinaryOperatorKind.NIntLessThanOrEqual, 588(int)BinaryOperatorKind.NUIntLessThanOrEqual, 589(int)BinaryOperatorKind.FloatLessThanOrEqual, 590(int)BinaryOperatorKind.DoubleLessThanOrEqual, 591(int)BinaryOperatorKind.DecimalLessThanOrEqual, 592(int)BinaryOperatorKind.LiftedIntLessThanOrEqual, 593(int)BinaryOperatorKind.LiftedUIntLessThanOrEqual, 594(int)BinaryOperatorKind.LiftedLongLessThanOrEqual, 595(int)BinaryOperatorKind.LiftedULongLessThanOrEqual, 596(int)BinaryOperatorKind.LiftedNIntLessThanOrEqual, 597(int)BinaryOperatorKind.LiftedNUIntLessThanOrEqual, 598(int)BinaryOperatorKind.LiftedFloatLessThanOrEqual, 599(int)BinaryOperatorKind.LiftedDoubleLessThanOrEqual, 600(int)BinaryOperatorKind.LiftedDecimalLessThanOrEqual, 604(int)BinaryOperatorKind.IntAnd, 605(int)BinaryOperatorKind.UIntAnd, 606(int)BinaryOperatorKind.LongAnd, 607(int)BinaryOperatorKind.ULongAnd, 608(int)BinaryOperatorKind.NIntAnd, 609(int)BinaryOperatorKind.NUIntAnd, 610(int)BinaryOperatorKind.BoolAnd, 611(int)BinaryOperatorKind.LiftedIntAnd, 612(int)BinaryOperatorKind.LiftedUIntAnd, 613(int)BinaryOperatorKind.LiftedLongAnd, 614(int)BinaryOperatorKind.LiftedULongAnd, 615(int)BinaryOperatorKind.LiftedNIntAnd, 616(int)BinaryOperatorKind.LiftedNUIntAnd, 617(int)BinaryOperatorKind.LiftedBoolAnd, 621(int)BinaryOperatorKind.IntXor, 622(int)BinaryOperatorKind.UIntXor, 623(int)BinaryOperatorKind.LongXor, 624(int)BinaryOperatorKind.ULongXor, 625(int)BinaryOperatorKind.NIntXor, 626(int)BinaryOperatorKind.NUIntXor, 627(int)BinaryOperatorKind.BoolXor, 628(int)BinaryOperatorKind.LiftedIntXor, 629(int)BinaryOperatorKind.LiftedUIntXor, 630(int)BinaryOperatorKind.LiftedLongXor, 631(int)BinaryOperatorKind.LiftedULongXor, 632(int)BinaryOperatorKind.LiftedNIntXor, 633(int)BinaryOperatorKind.LiftedNUIntXor, 634(int)BinaryOperatorKind.LiftedBoolXor, 638(int)BinaryOperatorKind.IntOr, 639(int)BinaryOperatorKind.UIntOr, 640(int)BinaryOperatorKind.LongOr, 641(int)BinaryOperatorKind.ULongOr, 642(int)BinaryOperatorKind.NIntOr, 643(int)BinaryOperatorKind.NUIntOr, 644(int)BinaryOperatorKind.BoolOr, 645(int)BinaryOperatorKind.LiftedIntOr, 646(int)BinaryOperatorKind.LiftedUIntOr, 647(int)BinaryOperatorKind.LiftedLongOr, 648(int)BinaryOperatorKind.LiftedULongOr, 649(int)BinaryOperatorKind.LiftedNIntOr, 650(int)BinaryOperatorKind.LiftedNUIntOr, 651(int)BinaryOperatorKind.LiftedBoolOr, 655(int)BinaryOperatorKind.IntUnsignedRightShift, 656(int)BinaryOperatorKind.UIntUnsignedRightShift, 657(int)BinaryOperatorKind.LongUnsignedRightShift, 658(int)BinaryOperatorKind.ULongUnsignedRightShift, 659(int)BinaryOperatorKind.NIntUnsignedRightShift, 660(int)BinaryOperatorKind.NUIntUnsignedRightShift, 661(int)BinaryOperatorKind.LiftedIntUnsignedRightShift, 662(int)BinaryOperatorKind.LiftedUIntUnsignedRightShift, 663(int)BinaryOperatorKind.LiftedLongUnsignedRightShift, 664(int)BinaryOperatorKind.LiftedULongUnsignedRightShift, 665(int)BinaryOperatorKind.LiftedNIntUnsignedRightShift, 666(int)BinaryOperatorKind.LiftedNUIntUnsignedRightShift, 681case BinaryOperatorKind.NInt: 682case BinaryOperatorKind.NUInt: 696static readonlySpanOfByte => new BinaryOperatorSignature(BinaryOperatorKind.Utf8Addition, readonlySpanOfByte, readonlySpanOfByte, readonlySpanOfByte), 702internal BinaryOperatorSignature GetSignature(BinaryOperatorKind kind) 707case BinaryOperatorKind.Multiplication: 708case BinaryOperatorKind.Division: 709case BinaryOperatorKind.Subtraction: 710case BinaryOperatorKind.Remainder: 711case BinaryOperatorKind.And: 712case BinaryOperatorKind.Or: 713case BinaryOperatorKind.Xor: 715case BinaryOperatorKind.Addition: 717case BinaryOperatorKind.LeftShift: 718case BinaryOperatorKind.RightShift: 719case BinaryOperatorKind.UnsignedRightShift: 727case BinaryOperatorKind.Equal: 728case BinaryOperatorKind.NotEqual: 729case BinaryOperatorKind.GreaterThan: 730case BinaryOperatorKind.LessThan: 731case BinaryOperatorKind.GreaterThanOrEqual: 732case BinaryOperatorKind.LessThanOrEqual: 738private TypeSymbol LeftType(BinaryOperatorKind kind) 748case BinaryOperatorKind.Int: return _compilation.GetSpecialType(SpecialType.System_Int32); 749case BinaryOperatorKind.UInt: return _compilation.GetSpecialType(SpecialType.System_UInt32); 750case BinaryOperatorKind.Long: return _compilation.GetSpecialType(SpecialType.System_Int64); 751case BinaryOperatorKind.ULong: return _compilation.GetSpecialType(SpecialType.System_UInt64); 752case BinaryOperatorKind.NInt: return _compilation.CreateNativeIntegerTypeSymbol(signed: true); 753case BinaryOperatorKind.NUInt: return _compilation.CreateNativeIntegerTypeSymbol(signed: false); 754case BinaryOperatorKind.Float: return _compilation.GetSpecialType(SpecialType.System_Single); 755case BinaryOperatorKind.Double: return _compilation.GetSpecialType(SpecialType.System_Double); 756case BinaryOperatorKind.Decimal: return _compilation.GetSpecialType(SpecialType.System_Decimal); 757case BinaryOperatorKind.Bool: return _compilation.GetSpecialType(SpecialType.System_Boolean); 758case BinaryOperatorKind.ObjectAndString: 759case BinaryOperatorKind.Object: 761case BinaryOperatorKind.String: 762case BinaryOperatorKind.StringAndObject: 770private TypeSymbol RightType(BinaryOperatorKind kind) 780case BinaryOperatorKind.Int: return _compilation.GetSpecialType(SpecialType.System_Int32); 781case BinaryOperatorKind.UInt: return _compilation.GetSpecialType(SpecialType.System_UInt32); 782case BinaryOperatorKind.Long: return _compilation.GetSpecialType(SpecialType.System_Int64); 783case BinaryOperatorKind.ULong: return _compilation.GetSpecialType(SpecialType.System_UInt64); 784case BinaryOperatorKind.NInt: return _compilation.CreateNativeIntegerTypeSymbol(signed: true); 785case BinaryOperatorKind.NUInt: return _compilation.CreateNativeIntegerTypeSymbol(signed: false); 786case BinaryOperatorKind.Float: return _compilation.GetSpecialType(SpecialType.System_Single); 787case BinaryOperatorKind.Double: return _compilation.GetSpecialType(SpecialType.System_Double); 788case BinaryOperatorKind.Decimal: return _compilation.GetSpecialType(SpecialType.System_Decimal); 789case BinaryOperatorKind.Bool: return _compilation.GetSpecialType(SpecialType.System_Boolean); 790case BinaryOperatorKind.ObjectAndString: 791case BinaryOperatorKind.String: 793case BinaryOperatorKind.StringAndObject: 794case BinaryOperatorKind.Object: 802private TypeSymbol ReturnType(BinaryOperatorKind kind) 812case BinaryOperatorKind.Int: return _compilation.GetSpecialType(SpecialType.System_Int32); 813case BinaryOperatorKind.UInt: return _compilation.GetSpecialType(SpecialType.System_UInt32); 814case BinaryOperatorKind.Long: return _compilation.GetSpecialType(SpecialType.System_Int64); 815case BinaryOperatorKind.ULong: return _compilation.GetSpecialType(SpecialType.System_UInt64); 816case BinaryOperatorKind.NInt: return _compilation.CreateNativeIntegerTypeSymbol(signed: true); 817case BinaryOperatorKind.NUInt: return _compilation.CreateNativeIntegerTypeSymbol(signed: false); 818case BinaryOperatorKind.Float: return _compilation.GetSpecialType(SpecialType.System_Single); 819case BinaryOperatorKind.Double: return _compilation.GetSpecialType(SpecialType.System_Double); 820case BinaryOperatorKind.Decimal: return _compilation.GetSpecialType(SpecialType.System_Decimal); 821case BinaryOperatorKind.Bool: return _compilation.GetSpecialType(SpecialType.System_Boolean); 822case BinaryOperatorKind.Object: return _compilation.GetSpecialType(SpecialType.System_Object); 823case BinaryOperatorKind.ObjectAndString: 824case BinaryOperatorKind.StringAndObject: 825case BinaryOperatorKind.String: 833private TypeSymbol LiftedType(BinaryOperatorKind kind) 839BinaryOperatorKind.Int => _compilation.GetSpecialType(SpecialType.System_Int32), 840BinaryOperatorKind.UInt => _compilation.GetSpecialType(SpecialType.System_UInt32), 841BinaryOperatorKind.Long => _compilation.GetSpecialType(SpecialType.System_Int64), 842BinaryOperatorKind.ULong => _compilation.GetSpecialType(SpecialType.System_UInt64), 843BinaryOperatorKind.NInt => _compilation.CreateNativeIntegerTypeSymbol(signed: true), 844BinaryOperatorKind.NUInt => _compilation.CreateNativeIntegerTypeSymbol(signed: false), 845BinaryOperatorKind.Float => _compilation.GetSpecialType(SpecialType.System_Single), 846BinaryOperatorKind.Double => _compilation.GetSpecialType(SpecialType.System_Double), 847BinaryOperatorKind.Decimal => _compilation.GetSpecialType(SpecialType.System_Decimal), 848BinaryOperatorKind.Bool => _compilation.GetSpecialType(SpecialType.System_Boolean),
Compilation\CSharpCompilation.cs (32)
4286var binaryKind = Binder.SyntaxKindToBinaryOperatorKind(SyntaxFacts.GetBinaryExpression(syntaxKind)); 4292var easyOutBinaryKind = OverloadResolution.BinopEasyOut.OpKind(binaryKind, csharpLeftType, csharpRightType); 4294if (easyOutBinaryKind != BinaryOperatorKind.Error) 4310if (binaryKind is BinaryOperatorKind.Equal or BinaryOperatorKind.NotEqual && 4327if (binaryKind is BinaryOperatorKind.Equal or BinaryOperatorKind.NotEqual && 4335if (binaryKind is BinaryOperatorKind.Addition or BinaryOperatorKind.Subtraction && 4350if (binaryKind is BinaryOperatorKind.Equal or 4351BinaryOperatorKind.NotEqual or 4352BinaryOperatorKind.GreaterThan or 4353BinaryOperatorKind.LessThan or 4354BinaryOperatorKind.GreaterThanOrEqual or 4355BinaryOperatorKind.LessThanOrEqual && 4365if (binaryKind is BinaryOperatorKind.And or 4366BinaryOperatorKind.Or or 4367BinaryOperatorKind.Xor && 4378if (binaryKind is BinaryOperatorKind.Addition or BinaryOperatorKind.Subtraction) 4396if (binaryKind is BinaryOperatorKind.Subtraction && 4405if (binaryKind is BinaryOperatorKind.Equal or 4406BinaryOperatorKind.NotEqual or 4407BinaryOperatorKind.GreaterThan or 4408BinaryOperatorKind.LessThan or 4409BinaryOperatorKind.GreaterThanOrEqual or 4410BinaryOperatorKind.LessThanOrEqual && 4419if (binaryKind is BinaryOperatorKind.Addition && 4428if (binaryKind is BinaryOperatorKind.Addition && 4437if (binaryKind is BinaryOperatorKind.Subtraction && 4446if (binaryKind is BinaryOperatorKind.Subtraction && 4455if (binaryKind is BinaryOperatorKind.Addition &&
Compilation\CSharpSemanticModel.cs (9)
3851BinaryOperatorKind operandType = binaryOperator.OperatorKind.OperandTypes(); 3852BinaryOperatorKind op = binaryOperator.OperatorKind.Operator(); 3855if (operandType == 0 || operandType == BinaryOperatorKind.UserDefined || binaryOperator.ResultKind != LookupResultKind.Viable || binaryOperator.OperatorKind.IsLogical()) 3867(op == BinaryOperatorKind.Equal || op == BinaryOperatorKind.NotEqual) && 3893private static Symbol GetIntrinsicOperatorSymbol(BinaryOperatorKind op, bool isDynamic, TypeSymbol leftType, TypeSymbol rightType, TypeSymbol returnType, bool isChecked) 3924BinaryOperatorKind operandType = compoundAssignment.Operator.Kind.OperandTypes(); 3925BinaryOperatorKind op = compoundAssignment.Operator.Kind.Operator(); 3928if (operandType == 0 || operandType == BinaryOperatorKind.UserDefined || compoundAssignment.ResultKind != LookupResultKind.Viable)
Compiler\AnonymousTypeMethodBodySynthesizer.cs (1)
125BoundExpression retExpression = F.Binary(BinaryOperatorKind.ObjectNotEqual,
Compiler\MethodBodySynthesizer.cs (1)
498operatorKind: 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)
2461BinaryOperatorKind kind; 2479var op = kind.Operator(); 2480var isAnd = op == BinaryOperatorKind.And; 2481var isBool = kind.OperandTypes() == BinaryOperatorKind.Bool; 2483Debug.Assert(isAnd || op == BinaryOperatorKind.Or); 2633var kind = binary.OperatorKind; 2634return kind.Operator() is BinaryOperatorKind.Equal or BinaryOperatorKind.NotEqual 2646=> binary.OperatorKind.Operator() == BinaryOperatorKind.Equal;
FlowAnalysis\NullableWalker.cs (23)
4998private TypeWithState InferResultNullability(BinaryOperatorKind operatorKind, MethodSymbol? methodOpt, TypeSymbol resultType, TypeWithState leftType, TypeWithState rightType) 5024case BinaryOperatorKind.DelegateCombination: 5027case BinaryOperatorKind.DelegateRemoval: 5055&& binary.OperatorKind.Operator() is BinaryOperatorKind.Equal or BinaryOperatorKind.NotEqual) 5126=> binary.OperatorKind.Operator() == BinaryOperatorKind.Equal; 5158if (binary.OperatorKind.Operator() is not (BinaryOperatorKind.Equal or BinaryOperatorKind.NotEqual)) 5236BinaryOperatorKind operatorKind, 5304&& operatorKind.Operator() is BinaryOperatorKind.GreaterThan or BinaryOperatorKind.GreaterThanOrEqual or BinaryOperatorKind.LessThan or BinaryOperatorKind.LessThanOrEqual) 5378BinaryOperatorKind op = binary.OperatorKind.Operator(); 5380if (op == BinaryOperatorKind.Equal || op == BinaryOperatorKind.NotEqual) 5396bool nonNullCase = op != BinaryOperatorKind.Equal; // true represents WhenTrue 5420case BinaryOperatorKind.Equal: 5421case BinaryOperatorKind.GreaterThan: 5422case BinaryOperatorKind.LessThan: 5423case BinaryOperatorKind.GreaterThanOrEqual: 5424case BinaryOperatorKind.LessThanOrEqual: 5428case BinaryOperatorKind.NotEqual:
Generated\BoundNodes.xml.Generated.cs (15)
1661public BoundBinaryOperator(SyntaxNode syntax, BinaryOperatorKind operatorKind, BoundBinaryOperator.UncommonData? data, LookupResultKind resultKind, BoundExpression left, BoundExpression right, TypeSymbol type, bool hasErrors = false) 1674public BinaryOperatorKind OperatorKind { get; } 1681public BoundBinaryOperator Update(BinaryOperatorKind operatorKind, BoundBinaryOperator.UncommonData? data, LookupResultKind resultKind, BoundExpression left, BoundExpression right, TypeSymbol type) 1695public BoundTupleBinaryOperator(SyntaxNode syntax, BoundExpression left, BoundExpression right, BinaryOperatorKind operatorKind, TupleBinaryOperatorInfo.Multiple operators, TypeSymbol type, bool hasErrors = false) 1713public BinaryOperatorKind OperatorKind { get; } 1719public BoundTupleBinaryOperator Update(BoundExpression left, BoundExpression right, BinaryOperatorKind operatorKind, TupleBinaryOperatorInfo.Multiple operators, TypeSymbol type) 1733public 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) 1753public BinaryOperatorKind OperatorKind { get; } 1764public BoundUserDefinedConditionalLogicalOperator Update(BinaryOperatorKind operatorKind, MethodSymbol logicalOperator, MethodSymbol trueOperator, MethodSymbol falseOperator, TypeSymbol? constrainedToTypeOpt, LookupResultKind resultKind, ImmutableArray<MethodSymbol> originalUserDefinedOperatorsOpt, BoundExpression left, BoundExpression right, TypeSymbol type) 5340public BoundDagRelationalTest(SyntaxNode syntax, BinaryOperatorKind operatorKind, ConstantValue value, BoundDagTemp input, bool hasErrors = false) 5351public BinaryOperatorKind OperatorKind { get; } 5357public BoundDagRelationalTest Update(BinaryOperatorKind operatorKind, ConstantValue value, BoundDagTemp input) 8523public BoundRelationalPattern(SyntaxNode syntax, BinaryOperatorKind relation, BoundExpression value, ConstantValue constantValue, TypeSymbol inputType, TypeSymbol narrowedType, bool hasErrors = false) 8541public BinaryOperatorKind Relation { get; } 8548public BoundRelationalPattern Update(BinaryOperatorKind relation, BoundExpression value, ConstantValue constantValue, TypeSymbol inputType, TypeSymbol narrowedType)
Lowering\ClosureConversion\ExpressionLambdaRewriter.cs (22)
385private static WellKnownMember GetBinaryOperatorFactory(BinaryOperatorKind opKind, MethodSymbol methodOpt, out bool isChecked, out bool isLifted, out bool requiresLifted) 393case BinaryOperatorKind.Addition: 401case BinaryOperatorKind.Multiplication: 409case BinaryOperatorKind.Subtraction: 417case BinaryOperatorKind.Division: 421case BinaryOperatorKind.Remainder: 425case BinaryOperatorKind.And: 433case BinaryOperatorKind.Xor: 437case BinaryOperatorKind.Or: 445case BinaryOperatorKind.LeftShift: 449case BinaryOperatorKind.RightShift: 453case BinaryOperatorKind.Equal: 457case BinaryOperatorKind.NotEqual: 461case BinaryOperatorKind.LessThan: 465case BinaryOperatorKind.LessThanOrEqual: 469case BinaryOperatorKind.GreaterThan: 473case BinaryOperatorKind.GreaterThanOrEqual: 487private BoundExpression VisitBinaryOperator(BinaryOperatorKind opKind, MethodSymbol methodOpt, TypeSymbol type, BoundExpression left, BoundExpression right) 505case BinaryOperatorKind.EnumAndUnderlying: 506case BinaryOperatorKind.UnderlyingAndEnum: 507case BinaryOperatorKind.Enum: 509var enumOperand = (opKind.OperandTypes() == BinaryOperatorKind.UnderlyingAndEnum) ? right : left;
Lowering\DiagnosticsPass_ExpressionTrees.cs (1)
752var 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 (6)
644splitCases(ImmutableArray<(ConstantValue value, LabelSymbol label)> cases, BinaryOperatorKind op, ConstantValue value) 732_fac.Related(BinaryOperatorKind.LessThanOrEqual, x, y) ? 733(_fac.Related(BinaryOperatorKind.LessThanOrEqual, y, x) ? 0 : -1) : 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 (223)
72var operatorKind = node.OperatorKind; 89operatorKind.Operator() == BinaryOperatorKind.And ? node.FalseOperator : node.TrueOperator, boundTemp); 92var andOperatorCall = LowerUserDefinedBinaryOperator(syntax, operatorKind & ~BinaryOperatorKind.Logical, boundTemp, loweredRight, type, node.LogicalOperator, node.ConstrainedToTypeOpt); 122if (node.OperatorKind is BinaryOperatorKind.Utf8Addition) 144if (current.InterpolatedStringHandlerData is not null || current.OperatorKind is BinaryOperatorKind.Utf8Addition || IsBinaryStringConcatenation(current)) 168Debug.Assert(node.OperatorKind == BinaryOperatorKind.StringConcatenation); 182BinaryOperatorKind operatorKind, 198BinaryOperatorKind operatorKind, 214case BinaryOperatorKind.ObjectAndStringConcatenation: 215case BinaryOperatorKind.StringAndObjectConcatenation: 216case BinaryOperatorKind.StringConcatenation: 218case BinaryOperatorKind.DelegateCombination: 220case BinaryOperatorKind.DelegateRemoval: 222case BinaryOperatorKind.DelegateEqual: 224case BinaryOperatorKind.DelegateNotEqual: 258case BinaryOperatorKind.NullableNullEqual: 259case BinaryOperatorKind.NullableNullNotEqual: 262case BinaryOperatorKind.ObjectAndStringConcatenation: 263case BinaryOperatorKind.StringAndObjectConcatenation: 264case BinaryOperatorKind.StringConcatenation: 267case BinaryOperatorKind.StringEqual: 270case BinaryOperatorKind.StringNotEqual: 273case BinaryOperatorKind.DelegateCombination: 276case BinaryOperatorKind.DelegateRemoval: 279case BinaryOperatorKind.DelegateEqual: 282case BinaryOperatorKind.DelegateNotEqual: 285case BinaryOperatorKind.LogicalBoolAnd: 292operatorKind &= ~BinaryOperatorKind.Logical; 297case BinaryOperatorKind.LogicalBoolOr: 304operatorKind &= ~BinaryOperatorKind.Logical; 309case BinaryOperatorKind.BoolAnd: 330case BinaryOperatorKind.BoolOr: 335case BinaryOperatorKind.BoolEqual: 349case BinaryOperatorKind.BoolNotEqual: 363case BinaryOperatorKind.BoolXor: 377case BinaryOperatorKind.IntLeftShift: 378case BinaryOperatorKind.UIntLeftShift: 379case BinaryOperatorKind.IntRightShift: 380case BinaryOperatorKind.UIntRightShift: 381case BinaryOperatorKind.IntUnsignedRightShift: 382case BinaryOperatorKind.UIntUnsignedRightShift: 385case BinaryOperatorKind.LongLeftShift: 386case BinaryOperatorKind.ULongLeftShift: 387case BinaryOperatorKind.LongRightShift: 388case BinaryOperatorKind.ULongRightShift: 389case BinaryOperatorKind.LongUnsignedRightShift: 390case BinaryOperatorKind.ULongUnsignedRightShift: 393case BinaryOperatorKind.NIntRightShift: 394case BinaryOperatorKind.NUIntRightShift: 395case BinaryOperatorKind.NIntUnsignedRightShift: 396case BinaryOperatorKind.NUIntUnsignedRightShift: 397case BinaryOperatorKind.NIntLeftShift: 398case BinaryOperatorKind.NUIntLeftShift: 401case BinaryOperatorKind.DecimalAddition: 402case BinaryOperatorKind.DecimalSubtraction: 403case BinaryOperatorKind.DecimalMultiplication: 404case BinaryOperatorKind.DecimalDivision: 405case BinaryOperatorKind.DecimalRemainder: 406case BinaryOperatorKind.DecimalEqual: 407case BinaryOperatorKind.DecimalNotEqual: 408case BinaryOperatorKind.DecimalLessThan: 409case BinaryOperatorKind.DecimalLessThanOrEqual: 410case BinaryOperatorKind.DecimalGreaterThan: 411case BinaryOperatorKind.DecimalGreaterThanOrEqual: 414case BinaryOperatorKind.PointerAndIntAddition: 415case BinaryOperatorKind.PointerAndUIntAddition: 416case BinaryOperatorKind.PointerAndLongAddition: 417case BinaryOperatorKind.PointerAndULongAddition: 418case BinaryOperatorKind.PointerAndIntSubtraction: 419case BinaryOperatorKind.PointerAndUIntSubtraction: 420case BinaryOperatorKind.PointerAndLongSubtraction: 421case BinaryOperatorKind.PointerAndULongSubtraction: 428case BinaryOperatorKind.IntAndPointerAddition: 429case BinaryOperatorKind.UIntAndPointerAddition: 430case BinaryOperatorKind.LongAndPointerAddition: 431case BinaryOperatorKind.ULongAndPointerAddition: 438case BinaryOperatorKind.PointerSubtraction: 441case BinaryOperatorKind.IntAddition: 442case BinaryOperatorKind.UIntAddition: 443case BinaryOperatorKind.LongAddition: 444case BinaryOperatorKind.ULongAddition: 455case BinaryOperatorKind.IntSubtraction: 456case BinaryOperatorKind.LongSubtraction: 457case BinaryOperatorKind.UIntSubtraction: 458case BinaryOperatorKind.ULongSubtraction: 465case BinaryOperatorKind.IntMultiplication: 466case BinaryOperatorKind.LongMultiplication: 467case BinaryOperatorKind.UIntMultiplication: 468case BinaryOperatorKind.ULongMultiplication: 487case BinaryOperatorKind.IntGreaterThan: 488case BinaryOperatorKind.IntLessThanOrEqual: 492var newOp = operatorKind == BinaryOperatorKind.IntGreaterThan ? 493BinaryOperatorKind.NotEqual : 494BinaryOperatorKind.Equal; 496operatorKind &= ~BinaryOperatorKind.OpMask; 502case BinaryOperatorKind.IntLessThan: 503case BinaryOperatorKind.IntGreaterThanOrEqual: 507var newOp = operatorKind == BinaryOperatorKind.IntLessThan ? 508BinaryOperatorKind.NotEqual : 509BinaryOperatorKind.Equal; 511operatorKind &= ~BinaryOperatorKind.OpMask; 517case BinaryOperatorKind.IntEqual: 518case BinaryOperatorKind.IntNotEqual: 530case BinaryOperatorKind.Utf8Addition: 543private BoundExpression RewriteLiftedBinaryOperator(SyntaxNode syntax, BinaryOperatorKind operatorKind, BoundExpression loweredLeft, BoundExpression loweredRight, TypeSymbol type, MethodSymbol? method, TypeSymbol? constrainedToTypeOpt) 551operatorKind != BinaryOperatorKind.LiftedBoolOr && operatorKind != BinaryOperatorKind.LiftedBoolAnd && 572if (operatorKind.Operator() == BinaryOperatorKind.NotEqual || 573operatorKind.Operator() == BinaryOperatorKind.Equal) 603BinaryOperatorKind operatorKind, 612Debug.Assert(operatorKind.Operator() == BinaryOperatorKind.And || operatorKind.Operator() == BinaryOperatorKind.Or); 623bool isAnd = operatorKind.Operator() == BinaryOperatorKind.And; 687result = _factory.Binary(BinaryOperatorKind.LogicalOr, boolean, leftTest, result); 775BinaryOperatorKind operatorKind, 803BinaryOperatorKind kind, 822return MakeLiteral(syntax, ConstantValue.Create(kind.Operator() == BinaryOperatorKind.Equal), boolType); 845BinaryOperatorKind operatorKind = kind.Operator(); 849BoundExpression result = MakeLiteral(syntax, ConstantValue.Create(operatorKind == BinaryOperatorKind.NotEqual), boolType); 876if (operatorKind == BinaryOperatorKind.Equal || operatorKind == BinaryOperatorKind.NotEqual) 879BoundExpression result = operatorKind == BinaryOperatorKind.Equal ? 886BoundExpression falseExpr = MakeBooleanConstant(syntax, operatorKind == BinaryOperatorKind.NotEqual); 943BinaryOperatorKind kind, 1006if (kind.Operator() is BinaryOperatorKind.Equal or BinaryOperatorKind.NotEqual) 1043BinaryOperatorKind leftOperator; 1044BinaryOperatorKind rightOperator; 1046BinaryOperatorKind operatorKind = kind.Operator(); 1049case BinaryOperatorKind.Equal: 1050case BinaryOperatorKind.NotEqual: 1051leftOperator = BinaryOperatorKind.Equal; 1052rightOperator = BinaryOperatorKind.BoolEqual; 1056rightOperator = BinaryOperatorKind.BoolAnd; 1084operatorKind: BinaryOperatorKind.BoolAnd, 1093if (operatorKind == BinaryOperatorKind.NotEqual) 1133BinaryOperatorKind kind, 1217BinaryOperatorKind conditionOperator; 1218BinaryOperatorKind operatorKind = kind.Operator(); 1221case BinaryOperatorKind.Equal: 1222case BinaryOperatorKind.NotEqual: 1223conditionOperator = BinaryOperatorKind.BoolEqual; 1226conditionOperator = BinaryOperatorKind.BoolAnd; 1252if (operatorKind == BinaryOperatorKind.Equal || operatorKind == BinaryOperatorKind.NotEqual) 1267rewrittenAlternative: MakeLiteral(syntax, ConstantValue.Create(operatorKind == BinaryOperatorKind.Equal), boolType), 1280BoundExpression alternative = MakeBooleanConstant(syntax, operatorKind == BinaryOperatorKind.NotEqual); 1301BinaryOperatorKind kind, 1341BinaryOperatorKind kind, 1410BinaryOperatorKind kind, 1464BoundExpression condition = MakeBinaryOperator(syntax, BinaryOperatorKind.BoolAnd, callX_HasValue, callY_HasValue, boolType, method: null, constrainedToTypeOpt: null); 1512BinaryOperatorKind kind, 1526if (kind == BinaryOperatorKind.LiftedBoolAnd || kind == BinaryOperatorKind.LiftedBoolOr) 1663BinaryOperatorKind kind, 1700BoundExpression newNullBool = MakeNewNullableBoolean(syntax, kind == BinaryOperatorKind.LiftedBoolOr); 1705rewrittenConsequence: kind == BinaryOperatorKind.LiftedBoolAnd ? nullBool : newNullBool, 1706rewrittenAlternative: kind == BinaryOperatorKind.LiftedBoolAnd ? newNullBool : nullBool, 1727BoundExpression consequence = kind == BinaryOperatorKind.LiftedBoolAnd ? nullBool : boundTemp; 1728BoundExpression alternative = kind == BinaryOperatorKind.LiftedBoolAnd ? boundTemp : nullBool; 1748BinaryOperatorKind kind, 1788BoundExpression newNullBool = MakeNewNullableBoolean(syntax, kind == BinaryOperatorKind.LiftedBoolOr); 1789BoundExpression consequence = kind == BinaryOperatorKind.LiftedBoolOr ? newNullBool : maybeNullTemp; 1790BoundExpression alternative = kind == BinaryOperatorKind.LiftedBoolOr ? maybeNullTemp : newNullBool; 1809BinaryOperatorKind kind, 1855operatorKind: BinaryOperatorKind.LogicalBoolOr, 1868operatorKind: BinaryOperatorKind.LogicalBoolOr, 1875BoundExpression consequence = kind == BinaryOperatorKind.LiftedBoolAnd ? boundTempY : boundTempX; 1876BoundExpression alternative = kind == BinaryOperatorKind.LiftedBoolAnd ? boundTempX : boundTempY; 1931BinaryOperatorKind kind, 1957return MakeLiteral(syntax, ConstantValue.Create(kind == BinaryOperatorKind.NullableNullEqual), returnType); 1972value: MakeBooleanConstant(syntax, kind == BinaryOperatorKind.NullableNullNotEqual), 1988var whenNull = kind == BinaryOperatorKind.NullableNullEqual ? MakeBooleanConstant(syntax, true) : null; 1994BoundExpression result = kind == BinaryOperatorKind.NullableNullNotEqual ? 2001private BoundExpression RewriteStringEquality(BoundBinaryOperator? oldNode, SyntaxNode syntax, BinaryOperatorKind operatorKind, BoundExpression loweredLeft, BoundExpression loweredRight, TypeSymbol type, SpecialMember member) 2014private BoundExpression RewriteDelegateOperation(SyntaxNode syntax, BinaryOperatorKind operatorKind, BoundExpression loweredLeft, BoundExpression loweredRight, TypeSymbol type, SpecialMember member) 2017if (operatorKind == BinaryOperatorKind.DelegateEqual || operatorKind == BinaryOperatorKind.DelegateNotEqual) 2025operatorKind = (operatorKind & (~BinaryOperatorKind.Delegate)) | BinaryOperatorKind.Object; 2044private BoundExpression RewriteDecimalBinaryOperation(SyntaxNode syntax, BoundExpression loweredLeft, BoundExpression loweredRight, BinaryOperatorKind operatorKind) 2053case BinaryOperatorKind.DecimalAddition: member = SpecialMember.System_Decimal__op_Addition; break; 2054case BinaryOperatorKind.DecimalSubtraction: member = SpecialMember.System_Decimal__op_Subtraction; break; 2055case BinaryOperatorKind.DecimalMultiplication: member = SpecialMember.System_Decimal__op_Multiply; break; 2056case BinaryOperatorKind.DecimalDivision: member = SpecialMember.System_Decimal__op_Division; break; 2057case BinaryOperatorKind.DecimalRemainder: member = SpecialMember.System_Decimal__op_Modulus; break; 2058case BinaryOperatorKind.DecimalEqual: member = SpecialMember.System_Decimal__op_Equality; break; 2059case BinaryOperatorKind.DecimalNotEqual: member = SpecialMember.System_Decimal__op_Inequality; break; 2060case BinaryOperatorKind.DecimalLessThan: member = SpecialMember.System_Decimal__op_LessThan; break; 2061case BinaryOperatorKind.DecimalLessThanOrEqual: member = SpecialMember.System_Decimal__op_LessThanOrEqual; break; 2062case BinaryOperatorKind.DecimalGreaterThan: member = SpecialMember.System_Decimal__op_GreaterThan; break; 2063case BinaryOperatorKind.DecimalGreaterThanOrEqual: member = SpecialMember.System_Decimal__op_GreaterThanOrEqual; break; 2075private BoundExpression MakeNullCheck(SyntaxNode syntax, BoundExpression rewrittenExpr, BinaryOperatorKind operatorKind) 2077Debug.Assert((operatorKind == BinaryOperatorKind.Equal) || (operatorKind == BinaryOperatorKind.NotEqual) || 2078(operatorKind == BinaryOperatorKind.NullableNullEqual) || (operatorKind == BinaryOperatorKind.NullableNullNotEqual)); 2096case BinaryOperatorKind.Equal: 2098case BinaryOperatorKind.NotEqual: 2114operatorKind |= BinaryOperatorKind.NullableNull; 2135BinaryOperatorKind operatorKind, 2159BinaryOperatorKind andOperatorKind = (operatorKind & ~BinaryOperatorKind.OpMask) | BinaryOperatorKind.And; 2197BinaryOperatorKind operatorKind, 2237BinaryOperatorKind andOperatorKind = (operatorKind & ~BinaryOperatorKind.OpMask) | BinaryOperatorKind.And; 2257BinaryOperatorKind kind, 2277Debug.Assert(kind.Operator() == BinaryOperatorKind.Addition); 2282kind = kind & ~BinaryOperatorKind.Checked; 2379BinaryOperatorKind multiplicationKind = BinaryOperatorKind.Multiplication; 2394multiplicationKind |= BinaryOperatorKind.Int; //i.e. signed 2407multiplicationKind |= BinaryOperatorKind.Long; 2419multiplicationKind |= BinaryOperatorKind.Long; 2431multiplicationKind |= BinaryOperatorKind.ULong; 2444multiplicationKind |= BinaryOperatorKind.Checked; 2453BinaryOperatorKind kind, 2471BinaryOperatorKind.Division, 2474kind & ~BinaryOperatorKind.Checked, // For some reason, dev10 never checks for subtraction overflow.
Lowering\LocalRewriter\LocalRewriter_Call.cs (1)
464BinaryOperatorKind.ObjectEqual,
Lowering\LocalRewriter\LocalRewriter_CollectionExpression.cs (4)
810_factory.Binary(BinaryOperatorKind.Addition, indexTemp.Type, indexTemp, _factory.Literal(1)), 1014sideEffects.Add(new BoundAssignmentOperator(rewrittenSpreadOperand.Syntax, indexTemp, _factory.Binary(BinaryOperatorKind.Addition, indexTemp.Type, indexTemp, spreadLength), isRef: false, indexTemp.Type)); 1146_factory.Binary(BinaryOperatorKind.Addition, indexTemp.Type, indexTemp, _factory.Literal(1)), 1318_factory.Binary(BinaryOperatorKind.Addition, sum.Type!, sum, value);
Lowering\LocalRewriter\LocalRewriter_CompoundAssignmentOperator.cs (5)
74var kind = node.Operator.Kind; 77var binaryOperator = kind.Operator(); 86(binaryOperator == BinaryOperatorKind.Addition || binaryOperator == BinaryOperatorKind.Subtraction)) 133(binaryOperator == BinaryOperatorKind.Addition ? "add_" : "remove_") + memberAccess.Name,
Lowering\LocalRewriter\LocalRewriter_Conversion.cs (2)
166Debug.Assert(node.OperatorKind is BinaryOperatorKind.Utf8Addition); 194Debug.Assert(utf8Addition.OperatorKind is BinaryOperatorKind.Utf8Addition);
Lowering\LocalRewriter\LocalRewriter_FixedStatement.cs (5)
473BoundExpression notNullCheck = _factory.MakeNullCheck(factory.Syntax, factory.Local(localSymbol), BinaryOperatorKind.NotEqual); 486BoundExpression addition = factory.Binary(BinaryOperatorKind.PointerAndIntAddition, localType, factory.Local(localSymbol), helperCall); 527BoundExpression notNullCheck = _factory.MakeNullCheck(factory.Syntax, arrayTempInit, BinaryOperatorKind.NotEqual); 550BoundExpression lengthCheck = factory.Binary(BinaryOperatorKind.IntNotEqual, factory.SpecialType(SpecialType.System_Boolean), lengthCall, factory.Literal(0)); 553BoundExpression condition = factory.Binary(BinaryOperatorKind.LogicalBoolAnd, factory.SpecialType(SpecialType.System_Boolean), notNullCheck, lengthCheck);
Lowering\LocalRewriter\LocalRewriter_ForEachStatement.cs (5)
451operatorKind: BinaryOperatorKind.NotEqual, // reference equality 654operatorKind: BinaryOperatorKind.IntLessThan, 950operatorKind: BinaryOperatorKind.IntLessThan, 1154operatorKind: BinaryOperatorKind.IntLessThanOrEqual, 1248operatorKind: BinaryOperatorKind.IntAddition, // unchecked, never overflows since array/string index can't be >= Int32.MaxValue
Lowering\LocalRewriter\LocalRewriter_IsOperator.cs (1)
73return _factory.MakeNullCheck(syntax, rewrittenOperand, BinaryOperatorKind.NotEqual);
Lowering\LocalRewriter\LocalRewriter_NullCoalescingOperator.cs (1)
163BoundExpression nullCheck = _factory.MakeNullCheck(syntax, boundTemp, BinaryOperatorKind.NotEqual);
Lowering\LocalRewriter\LocalRewriter_PointerElementAccess.cs (7)
44BinaryOperatorKind additionKind = BinaryOperatorKind.Addition; 51additionKind |= BinaryOperatorKind.PointerAndIntAddition; 54additionKind |= BinaryOperatorKind.PointerAndUIntAddition; 57additionKind |= BinaryOperatorKind.PointerAndLongAddition; 60additionKind |= BinaryOperatorKind.PointerAndULongAddition; 68additionKind |= BinaryOperatorKind.Checked;
Lowering\LocalRewriter\LocalRewriter_Range.cs (1)
144condition = MakeBinaryOperator(node.Syntax, BinaryOperatorKind.BoolAnd, condition, operandHasValue, boolType, method: null, constrainedToTypeOpt: null);
Lowering\LocalRewriter\LocalRewriter_StackAlloc.cs (3)
148BinaryOperatorKind multiplicationKind = BinaryOperatorKind.Checked | BinaryOperatorKind.UIntMultiplication; //"UInt" just to make it unsigned
Lowering\LocalRewriter\LocalRewriter_StringConcat.cs (6)
20private static bool IsBinaryStringConcatenation(BinaryOperatorKind binaryOperator) 21=> binaryOperator is BinaryOperatorKind.StringConcatenation or BinaryOperatorKind.StringAndObjectConcatenation or BinaryOperatorKind.ObjectAndStringConcatenation; 23private BoundExpression VisitCompoundAssignmentStringConcatenation(BoundExpression left, BoundExpression unvisitedRight, BinaryOperatorKind operatorKind, SyntaxNode syntax) 556SpecialMember member = (current.OperatorKind == BinaryOperatorKind.StringConcatenation) ?
Lowering\LocalRewriter\LocalRewriter_StringInterpolation.cs (1)
183_factory.Binary(BinaryOperatorKind.StringConcatenation, node.Type, result, part);
Lowering\LocalRewriter\LocalRewriter_TupleBinaryOperator.cs (14)
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) 867BinaryOperatorKind binaryOperatorKind = GetCorrespondingBinaryOperator(node); 868binaryOperatorKind |= IsIncrement(node) ? BinaryOperatorKind.Addition : BinaryOperatorKind.Subtraction; 904Debug.Assert(binaryOperatorKind.OperandTypes() == BinaryOperatorKind.PointerAndInt); 940private MethodSymbol GetDecimalIncDecOperator(BinaryOperatorKind oper) 945case BinaryOperatorKind.Addition: member = SpecialMember.System_Decimal__op_Increment; break; 946case BinaryOperatorKind.Subtraction: member = SpecialMember.System_Decimal__op_Decrement; break; 957private BoundExpression MakeDecimalIncDecOperator(SyntaxNode syntax, BinaryOperatorKind oper, BoundExpression operand) 964private BoundExpression MakeLiftedDecimalIncDecOperator(SyntaxNode syntax, BinaryOperatorKind oper, BoundExpression operand) 1105private static BinaryOperatorKind GetCorrespondingBinaryOperator(BoundIncrementOperator node) 1113BinaryOperatorKind result; 1120result = BinaryOperatorKind.Int; 1126result = BinaryOperatorKind.UInt; 1129result = BinaryOperatorKind.Long; 1132result = BinaryOperatorKind.ULong; 1135result = BinaryOperatorKind.NInt; 1138result = BinaryOperatorKind.NUInt; 1141result = BinaryOperatorKind.Float; 1144result = BinaryOperatorKind.Double; 1147result = BinaryOperatorKind.Decimal; 1169result = BinaryOperatorKind.Int; 1174result = BinaryOperatorKind.UInt; 1177result = BinaryOperatorKind.Long; 1180result = BinaryOperatorKind.ULong; 1188result = BinaryOperatorKind.PointerAndInt; 1198case BinaryOperatorKind.UInt: 1199case BinaryOperatorKind.Int: 1200case BinaryOperatorKind.ULong: 1201case BinaryOperatorKind.Long: 1202case BinaryOperatorKind.NUInt: 1203case BinaryOperatorKind.NInt: 1204case BinaryOperatorKind.PointerAndInt: 1205result |= (BinaryOperatorKind)unaryOperatorKind.OverflowChecks(); 1211result |= BinaryOperatorKind.Lifted; 1219BinaryOperatorKind binaryOperatorKind) 1224case BinaryOperatorKind.PointerAndInt: 1225case BinaryOperatorKind.Int: 1228case BinaryOperatorKind.UInt: 1231case BinaryOperatorKind.Long: 1234case BinaryOperatorKind.ULong: 1237case BinaryOperatorKind.NInt: 1240case BinaryOperatorKind.NUInt: 1243case BinaryOperatorKind.Float: 1246case BinaryOperatorKind.Double: 1249case BinaryOperatorKind.Decimal:
Lowering\LocalRewriter\LocalRewriter_UsingStatement.cs (1)
392ifCondition = _factory.MakeNullCheck(resourceSyntax, local, BinaryOperatorKind.NotEqual);
Lowering\LocalRewriter\LoweredDynamicOperationFactory.cs (1)
151BinaryOperatorKind operatorKind,
Lowering\SpillSequenceSpiller.cs (3)
994if (node.OperatorKind == BinaryOperatorKind.LogicalBoolOr || node.OperatorKind == BinaryOperatorKind.LogicalBoolAnd) 1000node.OperatorKind == BinaryOperatorKind.LogicalBoolAnd ? _F.Local(tmp) : _F.Not(_F.Local(tmp)),
Lowering\StateMachineRewriter\ResumableStateMachineStateAllocator.cs (2)
91_increasing ? BinaryOperatorKind.IntGreaterThanOrEqual : BinaryOperatorKind.IntLessThanOrEqual,
Lowering\SyntheticBoundNodeFactory.cs (26)
642public BoundBinaryOperator Binary(BinaryOperatorKind kind, TypeSymbol type, BoundExpression left, BoundExpression right) 665return Binary(BinaryOperatorKind.LogicalBoolAnd, SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Boolean), left, right); 672return Binary(BinaryOperatorKind.LogicalBoolOr, SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Boolean), left, right); 677return Binary(BinaryOperatorKind.IntEqual, SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Boolean), left, right); 682return Binary(BinaryOperatorKind.ObjectEqual, SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Boolean), left, right); 693return Binary(BinaryOperatorKind.ObjectNotEqual, SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Boolean), left, right); 698return Binary(BinaryOperatorKind.IntNotEqual, SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Boolean), left, right); 703return Binary(BinaryOperatorKind.IntLessThan, SpecialType(Microsoft.CodeAnalysis.SpecialType.System_Boolean), left, right); 708return Binary(BinaryOperatorKind.IntGreaterThanOrEqual, SpecialType(CodeAnalysis.SpecialType.System_Boolean), left, right); 713return Binary(BinaryOperatorKind.IntSubtraction, SpecialType(CodeAnalysis.SpecialType.System_Int32), left, right); 718return Binary(BinaryOperatorKind.IntMultiplication, SpecialType(CodeAnalysis.SpecialType.System_Int32), left, right); 1759internal BoundExpression MakeNullCheck(SyntaxNode syntax, BoundExpression rewrittenExpr, BinaryOperatorKind operatorKind) 1761Debug.Assert((operatorKind == BinaryOperatorKind.Equal) || (operatorKind == BinaryOperatorKind.NotEqual) || 1762(operatorKind == BinaryOperatorKind.NullableNullEqual) || (operatorKind == BinaryOperatorKind.NullableNullNotEqual)); 1780case BinaryOperatorKind.Equal: 1782case BinaryOperatorKind.NotEqual: 1798operatorKind |= BinaryOperatorKind.NullableNull; 1801if (operatorKind == BinaryOperatorKind.NullableNullEqual || operatorKind == BinaryOperatorKind.NullableNullNotEqual) 1823BinaryOperatorKind kind, 1849return Literal(kind == BinaryOperatorKind.NullableNullEqual); 1864value: Literal(kind == BinaryOperatorKind.NullableNullNotEqual), 1880var whenNull = kind == BinaryOperatorKind.NullableNullEqual ? Literal(true) : null; 1886BoundExpression result = kind == BinaryOperatorKind.NullableNullNotEqual ?
Operations\CSharpOperationFactory.cs (2)
1487IMethodSymbol unaryOperatorMethod = boundBinaryOperator.OperatorKind.Operator() == CSharp.BinaryOperatorKind.And ? 1498GetConstrainedToTypeForOperator(boundBinaryOperator.OperatorKind.Operator() == CSharp.BinaryOperatorKind.And ?
Operations\CSharpOperationFactory_Methods.cs (20)
547internal static BinaryOperatorKind DeriveBinaryOperatorKind(CSharp.BinaryOperatorKind operatorKind) 551case CSharp.BinaryOperatorKind.Addition: 554case CSharp.BinaryOperatorKind.Subtraction: 557case CSharp.BinaryOperatorKind.Multiplication: 560case CSharp.BinaryOperatorKind.Division: 563case CSharp.BinaryOperatorKind.Remainder: 566case CSharp.BinaryOperatorKind.LeftShift: 569case CSharp.BinaryOperatorKind.RightShift: 572case CSharp.BinaryOperatorKind.UnsignedRightShift: 575case CSharp.BinaryOperatorKind.And: 578case CSharp.BinaryOperatorKind.Or: 581case CSharp.BinaryOperatorKind.Xor: 584case CSharp.BinaryOperatorKind.LessThan: 587case CSharp.BinaryOperatorKind.LessThanOrEqual: 590case CSharp.BinaryOperatorKind.Equal: 593case CSharp.BinaryOperatorKind.NotEqual: 596case CSharp.BinaryOperatorKind.GreaterThanOrEqual: 599case CSharp.BinaryOperatorKind.GreaterThan: 602case CSharp.BinaryOperatorKind.LogicalAnd: 605case CSharp.BinaryOperatorKind.LogicalOr:
Utilities\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; 24bool INumericTC<byte>.Related(BinaryOperatorKind relation, byte left, byte right)
Utilities\ValueSetFactory.CharTC.cs (2)
10using static BinaryOperatorKind; 24bool INumericTC<char>.Related(BinaryOperatorKind relation, char left, char right)
Utilities\ValueSetFactory.DecimalTC.cs (2)
11using static BinaryOperatorKind; 89bool INumericTC<decimal>.Related(BinaryOperatorKind relation, decimal left, decimal right)
Utilities\ValueSetFactory.DecimalValueSetFactory.cs (3)
21public 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; 64bool INumericTC<double>.Related(BinaryOperatorKind relation, double left, double right)
Utilities\ValueSetFactory.EnumeratedValueSet.cs (9)
58if (this.Any(BinaryOperatorKind.Equal, (T)(object)"")) 61if (this.Any(BinaryOperatorKind.Equal, (T)(object)c.ToString())) 69if (this.Any(BinaryOperatorKind.Equal, value)) 77public bool Any(BinaryOperatorKind relation, T value) 81case BinaryOperatorKind.Equal: 88bool IValueSet.Any(BinaryOperatorKind relation, ConstantValue value) => value.IsBad || Any(relation, _tc.FromConstantValue(value)); 90public bool All(BinaryOperatorKind relation, T value) 94case BinaryOperatorKind.Equal: 111bool IValueSet.All(BinaryOperatorKind relation, ConstantValue value) => !value.IsBad && All(relation, _tc.FromConstantValue(value));
Utilities\ValueSetFactory.EnumeratedValueSetFactory.cs (5)
10using static BinaryOperatorKind; 27public IValueSet<T> Related(BinaryOperatorKind relation, T value) 38IValueSet IValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue value) => 41bool IValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue left, ConstantValue right) 43Debug.Assert(relation == BinaryOperatorKind.Equal);
Utilities\ValueSetFactory.FloatingValueSet.cs (11)
12using static BinaryOperatorKind; 70public static IValueSet<TFloating> Related(BinaryOperatorKind relation, TFloating value, FloatingTC<TFloating> tc) 76case BinaryOperatorKind.Equal: 77case BinaryOperatorKind.LessThanOrEqual: 78case BinaryOperatorKind.GreaterThanOrEqual: 84case BinaryOperatorKind.LessThan: 85case BinaryOperatorKind.GreaterThan: 138bool IValueSet.Any(BinaryOperatorKind relation, ConstantValue value) => 141public bool Any(BinaryOperatorKind relation, TFloating value) 148bool IValueSet.All(BinaryOperatorKind relation, ConstantValue value) => !value.IsBad && All(relation, _tc.FromConstantValue(value)); 150public bool All(BinaryOperatorKind relation, TFloating value)
Utilities\ValueSetFactory.FloatingValueSetFactory.cs (3)
24public IValueSet<TFloating> Related(BinaryOperatorKind relation, TFloating value) => 35IValueSet IValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue value) => 40bool IValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue left, ConstantValue right)
Utilities\ValueSetFactory.IntTC.cs (2)
10using static BinaryOperatorKind; 34public bool Related(BinaryOperatorKind relation, int left, int right)
Utilities\ValueSetFactory.INumericTC.cs (1)
31bool Related(BinaryOperatorKind relation, T left, T right);
Utilities\ValueSetFactory.LongTC.cs (2)
10using static BinaryOperatorKind; 24bool INumericTC<long>.Related(BinaryOperatorKind relation, long left, long right)
Utilities\ValueSetFactory.NintValueSet.cs (5)
11using static BinaryOperatorKind; 65public bool All(BinaryOperatorKind relation, int value) 74bool 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.NonNegativeIntValueSetFactory.cs (4)
10using static BinaryOperatorKind; 25public IValueSet<int> Related(BinaryOperatorKind relation, int value) 57IValueSet IValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue value) => 60bool IValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue left, ConstantValue right) => s_underlying.Related(relation, left, right);
Utilities\ValueSetFactory.NuintValueSet.cs (5)
11using static BinaryOperatorKind; 56public bool All(BinaryOperatorKind relation, uint value) 63bool 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 = new NumericValueSetFactory<T>(_tc).Related(BinaryOperatorKind.GreaterThanOrEqual, _tc.Zero); 72public bool Any(BinaryOperatorKind relation, T value) 107bool IValueSet.Any(BinaryOperatorKind relation, ConstantValue value) => value.IsBad || Any(relation, _tc.FromConstantValue(value)); 109public bool All(BinaryOperatorKind relation, T value) 129bool IValueSet.All(BinaryOperatorKind relation, ConstantValue value) => !value.IsBad && All(relation, _tc.FromConstantValue(value));
Utilities\ValueSetFactory.NumericValueSetFactory.cs (4)
10using static BinaryOperatorKind; 29public IValueSet<T> Related(BinaryOperatorKind relation, T value) 52IValueSet IValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue value) => 63bool IValueSetFactory.Related(BinaryOperatorKind relation, ConstantValue left, ConstantValue right)
Utilities\ValueSetFactory.SByteTC.cs (2)
10using static BinaryOperatorKind; 23bool INumericTC<sbyte>.Related(BinaryOperatorKind relation, sbyte left, sbyte right)
Utilities\ValueSetFactory.ShortTC.cs (2)
10using static BinaryOperatorKind; 24bool INumericTC<short>.Related(BinaryOperatorKind relation, short left, short right)
Utilities\ValueSetFactory.SingleTC.cs (2)
10using static BinaryOperatorKind; 68bool INumericTC<float>.Related(BinaryOperatorKind relation, float left, float right)
Utilities\ValueSetFactory.UIntTC.cs (2)
10using static BinaryOperatorKind; 24public bool Related(BinaryOperatorKind relation, uint left, uint right)
Utilities\ValueSetFactory.ULongTC.cs (2)
10using static BinaryOperatorKind; 24bool INumericTC<ulong>.Related(BinaryOperatorKind relation, ulong left, ulong right)
Utilities\ValueSetFactory.UShortTC.cs (2)
10using static BinaryOperatorKind; 24bool INumericTC<ushort>.Related(BinaryOperatorKind relation, ushort left, ushort right)
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (1)
Emit\NumericIntPtrTests.cs (1)
1571foreach (var operatorKind in binaryOperators)
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (2)
Semantics\NativeIntegerTests.cs (1)
4811foreach (var operatorKind in binaryOperators)
Semantics\OperatorTests.cs (1)
7360foreach (var op in operators)