609 references to BinaryOperatorKind
ILLink.RoslynAnalyzer (3)
Metrics (22)
Metrics.Legacy (22)
Microsoft.AspNetCore.Mvc.Api.Analyzers (2)
Microsoft.CodeAnalysis (46)
Generated\Operations.Generated.cs (20)
1107BinaryOperatorKind OperatorKind { get; }
1516BinaryOperatorKind OperatorKind { get; }
2773BinaryOperatorKind Relation { get; }
2976BinaryOperatorKind OperatorKind { get; }
3531/// Kind of binary pattern; either <see cref="BinaryOperatorKind.And" /> or <see cref="BinaryOperatorKind.Or" />.
3533BinaryOperatorKind OperatorKind { get; }
3589BinaryOperatorKind OperatorKind { get; }
5642internal BinaryOperation(BinaryOperatorKind operatorKind, IOperation leftOperand, IOperation rightOperand, bool isLifted, bool isChecked, bool isCompareText, IMethodSymbol? operatorMethod, ITypeSymbol? constrainedToType, IMethodSymbol? unaryOperatorMethod, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit)
5657public BinaryOperatorKind OperatorKind { get; }
6306internal CompoundAssignmentOperation(IConvertibleConversion inConversion, IConvertibleConversion outConversion, BinaryOperatorKind operatorKind, bool isLifted, bool isChecked, IMethodSymbol? operatorMethod, ITypeSymbol? constrainedToType, IOperation target, IOperation value, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit)
6322public BinaryOperatorKind OperatorKind { get; }
8275internal RelationalCaseClauseOperation(IOperation value, BinaryOperatorKind relation, ILabelSymbol? label, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit)
8282public BinaryOperatorKind Relation { get; }
8592internal TupleBinaryOperation(BinaryOperatorKind operatorKind, IOperation leftOperand, IOperation rightOperand, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit)
8600public BinaryOperatorKind OperatorKind { get; }
9889internal BinaryPatternOperation(BinaryOperatorKind operatorKind, IPatternOperation leftPattern, IPatternOperation rightPattern, ITypeSymbol inputType, ITypeSymbol narrowedType, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit)
9896public BinaryOperatorKind OperatorKind { get; }
9971internal RelationalPatternOperation(BinaryOperatorKind operatorKind, IOperation value, ITypeSymbol inputType, ITypeSymbol narrowedType, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit)
9977public BinaryOperatorKind OperatorKind { get; }
Operations\ControlFlowGraphBuilder.cs (26)
2156case BinaryOperatorKind.ConditionalOr:
2157case BinaryOperatorKind.ConditionalAnd:
2273case BinaryOperatorKind.ConditionalOr:
2277case BinaryOperatorKind.ConditionalAnd:
2539new BinaryOperation(isAndAlso ? BinaryOperatorKind.And : BinaryOperatorKind.Or,
2629new BinaryOperation(isAndAlso ? BinaryOperatorKind.And : BinaryOperatorKind.Or,
4960isUp = new BinaryOperation(BinaryOperatorKind.GreaterThanOrEqual,
5080var comparisonKind = BinaryOperatorKind.None;
5085comparisonKind = BinaryOperatorKind.LessThanOrEqual;
5092comparisonKind = BinaryOperatorKind.GreaterThanOrEqual;
5096comparisonKind = BinaryOperatorKind.LessThanOrEqual;
5103if (comparisonKind == BinaryOperatorKind.None && ITypeSymbolHelpers.IsSignedIntegralType(stepEnumUnderlyingTypeOrSelf))
5105comparisonKind = BinaryOperatorKind.LessThanOrEqual;
5112if (comparisonKind != BinaryOperatorKind.None)
5151eitherLimitOrControlVariableIsNull = new BinaryOperation(BinaryOperatorKind.Or,
5192condition = new BinaryOperation(BinaryOperatorKind.LessThanOrEqual,
5212condition = new BinaryOperation(BinaryOperatorKind.GreaterThanOrEqual,
5246var shiftedStep = new BinaryOperation(BinaryOperatorKind.RightShift,
5261return new BinaryOperation(BinaryOperatorKind.ExclusiveOr,
5333IOperation condition = new BinaryOperation(BinaryOperatorKind.Or,
5385IOperation increment = new BinaryOperation(BinaryOperatorKind.Add,
5579condition = new BinaryOperation(BinaryOperatorKind.Equals,
5629if (relationalValueClause.Relation == BinaryOperatorKind.Equals)
Microsoft.CodeAnalysis.Analyzers (27)
Microsoft.CodeAnalysis.AnalyzerUtilities (86)
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\ValueContentAnalysis\ValueContentAbstractValue.cs (46)
255BinaryOperatorKind binaryOperatorKind,
289private static bool TryMerge(object? value1, object? value2, BinaryOperatorKind binaryOperatorKind, ITypeSymbol? type1, ITypeSymbol? type2, ITypeSymbol? resultType, [NotNullWhen(returnValue: true)] out object? result)
408private static bool TryMerge(char value1, char value2, BinaryOperatorKind binaryOperatorKind, [NotNullWhen(returnValue: true)] out object? result)
412case BinaryOperatorKind.Add:
413case BinaryOperatorKind.Concatenate:
422private static bool TryMerge(string value1, string value2, BinaryOperatorKind binaryOperatorKind, [NotNullWhen(returnValue: true)] out object? result)
426case BinaryOperatorKind.Add:
427case BinaryOperatorKind.Concatenate:
436private static bool TryMerge(bool value1, bool value2, BinaryOperatorKind binaryOperatorKind, [NotNullWhen(returnValue: true)] out object? result)
440case BinaryOperatorKind.And:
441case BinaryOperatorKind.ConditionalAnd:
445case BinaryOperatorKind.Or:
446case BinaryOperatorKind.ConditionalOr:
450case BinaryOperatorKind.Equals:
454case BinaryOperatorKind.NotEquals:
463private static bool TryMerge(ulong value1, ulong value2, BinaryOperatorKind binaryOperatorKind, out ulong result)
467case BinaryOperatorKind.Add:
471case BinaryOperatorKind.Subtract:
475case BinaryOperatorKind.Multiply:
479case BinaryOperatorKind.Divide:
488case BinaryOperatorKind.And:
492case BinaryOperatorKind.Or:
496case BinaryOperatorKind.Remainder:
500case BinaryOperatorKind.Power:
504case BinaryOperatorKind.LeftShift:
513case BinaryOperatorKind.RightShift:
522case BinaryOperatorKind.ExclusiveOr:
526case BinaryOperatorKind.Equals:
530case BinaryOperatorKind.NotEquals:
534case BinaryOperatorKind.LessThan:
538case BinaryOperatorKind.LessThanOrEqual:
542case BinaryOperatorKind.GreaterThan:
546case BinaryOperatorKind.GreaterThanOrEqual:
555private static bool TryMerge(double value1, double value2, BinaryOperatorKind binaryOperatorKind, out double result)
559case BinaryOperatorKind.Add:
563case BinaryOperatorKind.Subtract:
567case BinaryOperatorKind.Multiply:
571case BinaryOperatorKind.Divide:
580case BinaryOperatorKind.Remainder:
584case BinaryOperatorKind.Power:
588case BinaryOperatorKind.Equals:
592case BinaryOperatorKind.NotEquals:
596case BinaryOperatorKind.LessThan:
600case BinaryOperatorKind.LessThanOrEqual:
604case BinaryOperatorKind.GreaterThan:
608case BinaryOperatorKind.GreaterThanOrEqual:
Microsoft.CodeAnalysis.BannedApiAnalyzers (22)
Microsoft.CodeAnalysis.CodeStyle (15)
Microsoft.CodeAnalysis.CodeStyle.Fixes (48)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_Negate.cs (47)
18private static readonly ImmutableDictionary<BinaryOperatorKind, BinaryOperatorKind> s_negatedBinaryMap =
19new Dictionary<BinaryOperatorKind, BinaryOperatorKind>
21{ BinaryOperatorKind.Equals, BinaryOperatorKind.NotEquals },
22{ BinaryOperatorKind.NotEquals, BinaryOperatorKind.Equals },
23{ BinaryOperatorKind.LessThan, BinaryOperatorKind.GreaterThanOrEqual },
24{ BinaryOperatorKind.GreaterThan, BinaryOperatorKind.LessThanOrEqual },
25{ BinaryOperatorKind.LessThanOrEqual, BinaryOperatorKind.GreaterThan },
26{ BinaryOperatorKind.GreaterThanOrEqual, BinaryOperatorKind.LessThan },
27{ BinaryOperatorKind.Or, BinaryOperatorKind.And },
28{ BinaryOperatorKind.And, BinaryOperatorKind.Or },
29{ BinaryOperatorKind.ConditionalOr, BinaryOperatorKind.ConditionalAnd },
30{ BinaryOperatorKind.ConditionalAnd, BinaryOperatorKind.ConditionalOr },
151if (!s_negatedBinaryMap.TryGetValue(binaryOperation.OperatorKind, out var negatedKind))
157&& binaryOperation.OperatorKind is BinaryOperatorKind.LessThan or
158BinaryOperatorKind.LessThanOrEqual or
159BinaryOperatorKind.GreaterThan or
160BinaryOperatorKind.GreaterThanOrEqual)
165if (binaryOperation.OperatorKind is BinaryOperatorKind.Or or
166BinaryOperatorKind.And or
167BinaryOperatorKind.ConditionalAnd or
168BinaryOperatorKind.ConditionalOr)
174var newBinaryExpressionSyntax = negatedKind is BinaryOperatorKind.Equals or BinaryOperatorKind.NotEquals
382BinaryOperatorKind operationKind,
387BinaryOperatorKind.LessThanOrEqual => IsSpecialCaseBinaryExpression(binaryOperation, operationKind)
390BinaryOperatorKind.GreaterThanOrEqual => IsSpecialCaseBinaryExpression(binaryOperation, operationKind)
393BinaryOperatorKind.LessThan => generator.LessThanExpression(leftOperand, rightOperand),
394BinaryOperatorKind.GreaterThan => generator.GreaterThanExpression(leftOperand, rightOperand),
395BinaryOperatorKind.Or => generator.BitwiseOrExpression(leftOperand, rightOperand),
396BinaryOperatorKind.And => generator.BitwiseAndExpression(leftOperand, rightOperand),
397BinaryOperatorKind.ConditionalOr => generator.LogicalOrExpression(leftOperand, rightOperand),
398BinaryOperatorKind.ConditionalAnd => generator.LogicalAndExpression(leftOperand, rightOperand),
410BinaryOperatorKind operationKind)
420BinaryOperatorKind.LessThanOrEqual when rightOperand.IsNumericLiteral()
422BinaryOperatorKind.GreaterThanOrEqual when leftOperand.IsNumericLiteral()
Microsoft.CodeAnalysis.CSharp (30)
Microsoft.CodeAnalysis.CSharp.CodeStyle (20)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (18)
Microsoft.CodeAnalysis.CSharp.Features (39)
ConvertIfToSwitch\CSharpConvertIfToSwitchCodeRefactoringProvider.Rewriting.cs (6)
22private static readonly Dictionary<BinaryOperatorKind, SyntaxKind> s_operatorMap = new Dictionary<BinaryOperatorKind, SyntaxKind>
24{ BinaryOperatorKind.LessThan, SyntaxKind.LessThanToken },
25{ BinaryOperatorKind.GreaterThan, SyntaxKind.GreaterThanToken },
26{ BinaryOperatorKind.LessThanOrEqual, SyntaxKind.LessThanEqualsToken },
27{ BinaryOperatorKind.GreaterThanOrEqual, SyntaxKind.GreaterThanEqualsToken },
Microsoft.CodeAnalysis.CSharp.Workspaces (5)
Microsoft.CodeAnalysis.Features (18)
Microsoft.CodeAnalysis.ResxSourceGenerator (22)
Microsoft.CodeAnalysis.Test.Utilities (45)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (3)
Microsoft.CodeAnalysis.VisualBasic.Features (7)
ConvertIfToSwitch\VisualBasicConvertIfToSwitchCodeRefactoringProvider.Rewriting.vb (7)
12Private Shared ReadOnly s_operatorMap As Dictionary(Of BinaryOperatorKind, (CaseClauseKind As SyntaxKind, OperatorTokenKind As SyntaxKind)) =
13New Dictionary(Of BinaryOperatorKind, (SyntaxKind, SyntaxKind))() From
15{BinaryOperatorKind.NotEquals, (SyntaxKind.CaseNotEqualsClause, SyntaxKind.LessThanGreaterThanToken)},
16{BinaryOperatorKind.LessThan, (SyntaxKind.CaseLessThanClause, SyntaxKind.LessThanToken)},
17{BinaryOperatorKind.GreaterThan, (SyntaxKind.CaseGreaterThanClause, SyntaxKind.GreaterThanToken)},
18{BinaryOperatorKind.LessThanOrEqual, (SyntaxKind.CaseLessThanOrEqualClause, SyntaxKind.LessThanEqualsToken)},
19{BinaryOperatorKind.GreaterThanOrEqual, (SyntaxKind.CaseGreaterThanOrEqualClause, SyntaxKind.GreaterThanEqualsToken)}
Microsoft.CodeAnalysis.VisualBasic.Workspaces (3)
Microsoft.CodeAnalysis.Workspaces (52)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_Negate.cs (47)
18private static readonly ImmutableDictionary<BinaryOperatorKind, BinaryOperatorKind> s_negatedBinaryMap =
19new Dictionary<BinaryOperatorKind, BinaryOperatorKind>
21{ BinaryOperatorKind.Equals, BinaryOperatorKind.NotEquals },
22{ BinaryOperatorKind.NotEquals, BinaryOperatorKind.Equals },
23{ BinaryOperatorKind.LessThan, BinaryOperatorKind.GreaterThanOrEqual },
24{ BinaryOperatorKind.GreaterThan, BinaryOperatorKind.LessThanOrEqual },
25{ BinaryOperatorKind.LessThanOrEqual, BinaryOperatorKind.GreaterThan },
26{ BinaryOperatorKind.GreaterThanOrEqual, BinaryOperatorKind.LessThan },
27{ BinaryOperatorKind.Or, BinaryOperatorKind.And },
28{ BinaryOperatorKind.And, BinaryOperatorKind.Or },
29{ BinaryOperatorKind.ConditionalOr, BinaryOperatorKind.ConditionalAnd },
30{ BinaryOperatorKind.ConditionalAnd, BinaryOperatorKind.ConditionalOr },
151if (!s_negatedBinaryMap.TryGetValue(binaryOperation.OperatorKind, out var negatedKind))
157&& binaryOperation.OperatorKind is BinaryOperatorKind.LessThan or
158BinaryOperatorKind.LessThanOrEqual or
159BinaryOperatorKind.GreaterThan or
160BinaryOperatorKind.GreaterThanOrEqual)
165if (binaryOperation.OperatorKind is BinaryOperatorKind.Or or
166BinaryOperatorKind.And or
167BinaryOperatorKind.ConditionalAnd or
168BinaryOperatorKind.ConditionalOr)
174var newBinaryExpressionSyntax = negatedKind is BinaryOperatorKind.Equals or BinaryOperatorKind.NotEquals
382BinaryOperatorKind operationKind,
387BinaryOperatorKind.LessThanOrEqual => IsSpecialCaseBinaryExpression(binaryOperation, operationKind)
390BinaryOperatorKind.GreaterThanOrEqual => IsSpecialCaseBinaryExpression(binaryOperation, operationKind)
393BinaryOperatorKind.LessThan => generator.LessThanExpression(leftOperand, rightOperand),
394BinaryOperatorKind.GreaterThan => generator.GreaterThanExpression(leftOperand, rightOperand),
395BinaryOperatorKind.Or => generator.BitwiseOrExpression(leftOperand, rightOperand),
396BinaryOperatorKind.And => generator.BitwiseAndExpression(leftOperand, rightOperand),
397BinaryOperatorKind.ConditionalOr => generator.LogicalOrExpression(leftOperand, rightOperand),
398BinaryOperatorKind.ConditionalAnd => generator.LogicalAndExpression(leftOperand, rightOperand),
410BinaryOperatorKind operationKind)
420BinaryOperatorKind.LessThanOrEqual when rightOperand.IsNumericLiteral()
422BinaryOperatorKind.GreaterThanOrEqual when leftOperand.IsNumericLiteral()
Roslyn.Diagnostics.Analyzers (22)
Test.Utilities (10)
Text.Analyzers (22)