350 references to BinaryOperatorKind
ILLink.RoslynAnalyzer (3)
DataFlow\FeatureChecksVisitor.cs (2)
100 case BinaryOperatorKind.Equals: 103 case BinaryOperatorKind.NotEquals:
TrimAnalysis\TrimAnalysisVisitor.cs (1)
186 operation.OperatorKind == BinaryOperatorKind.Or &&
Microsoft.AspNetCore.Mvc.Api.Analyzers (2)
ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzer.cs (2)
139if (binaryOperation.OperatorKind == BinaryOperatorKind.Equals) 145else if (binaryOperation.OperatorKind == BinaryOperatorKind.NotEquals)
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.CodeStyle (13)
src\Analyzers\Core\Analyzers\Helpers\HashCodeAnalyzer\HashCodeAnalyzer.OperationDeconstructor.cs (2)
99if (binary.OperatorKind == BinaryOperatorKind.Equals) 105else if (binary.OperatorKind == BinaryOperatorKind.NotEquals)
src\Analyzers\Core\Analyzers\PopulateSwitch\PopulateSwitchExpressionHelpers.cs (3)
66if (binaryPattern?.OperatorKind == BinaryOperatorKind.Or) 98BinaryOperatorKind.Or => IsDefault(binaryPattern.LeftPattern) || IsDefault(binaryPattern.RightPattern), 100BinaryOperatorKind.And => IsDefault(binaryPattern.LeftPattern) && IsDefault(binaryPattern.RightPattern),
src\Analyzers\Core\Analyzers\RemoveRedundantEquality\AbstractRemoveRedundantEqualityDiagnosticAnalyzer.cs (3)
65if (operation.OperatorKind is not (BinaryOperatorKind.Equals or BinaryOperatorKind.NotEquals)) 68var isOperatorEquals = operation.OperatorKind == BinaryOperatorKind.Equals;
src\Analyzers\Core\Analyzers\UseThrowExpression\AbstractUseThrowExpressionDiagnosticAnalyzer.cs (1)
220if (binaryOperator.OperatorKind != BinaryOperatorKind.Equals)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SemanticFacts\ISemanticFactsExtensions.cs (4)
86return op.OperatorKind is BinaryOperatorKind.Add or 87BinaryOperatorKind.Subtract or 88BinaryOperatorKind.Multiply or 89BinaryOperatorKind.Divide;
Microsoft.CodeAnalysis.CodeStyle.Fixes (48)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_Negate.cs (47)
20private static readonly ImmutableDictionary<BinaryOperatorKind, BinaryOperatorKind> s_negatedBinaryMap = 21new Dictionary<BinaryOperatorKind, BinaryOperatorKind> 23{ BinaryOperatorKind.Equals, BinaryOperatorKind.NotEquals }, 24{ BinaryOperatorKind.NotEquals, BinaryOperatorKind.Equals }, 25{ BinaryOperatorKind.LessThan, BinaryOperatorKind.GreaterThanOrEqual }, 26{ BinaryOperatorKind.GreaterThan, BinaryOperatorKind.LessThanOrEqual }, 27{ BinaryOperatorKind.LessThanOrEqual, BinaryOperatorKind.GreaterThan }, 28{ BinaryOperatorKind.GreaterThanOrEqual, BinaryOperatorKind.LessThan }, 29{ BinaryOperatorKind.Or, BinaryOperatorKind.And }, 30{ BinaryOperatorKind.And, BinaryOperatorKind.Or }, 31{ BinaryOperatorKind.ConditionalOr, BinaryOperatorKind.ConditionalAnd }, 32{ BinaryOperatorKind.ConditionalAnd, BinaryOperatorKind.ConditionalOr }, 153if (!s_negatedBinaryMap.TryGetValue(binaryOperation.OperatorKind, out var negatedKind)) 159&& binaryOperation.OperatorKind is BinaryOperatorKind.LessThan or 160BinaryOperatorKind.LessThanOrEqual or 161BinaryOperatorKind.GreaterThan or 162BinaryOperatorKind.GreaterThanOrEqual) 167if (binaryOperation.OperatorKind is BinaryOperatorKind.Or or 168BinaryOperatorKind.And or 169BinaryOperatorKind.ConditionalAnd or 170BinaryOperatorKind.ConditionalOr) 176var newBinaryExpressionSyntax = negatedKind is BinaryOperatorKind.Equals or BinaryOperatorKind.NotEquals 384BinaryOperatorKind operationKind, 389BinaryOperatorKind.LessThanOrEqual => IsSpecialCaseBinaryExpression(binaryOperation, operationKind) 392BinaryOperatorKind.GreaterThanOrEqual => IsSpecialCaseBinaryExpression(binaryOperation, operationKind) 395BinaryOperatorKind.LessThan => generator.LessThanExpression(leftOperand, rightOperand), 396BinaryOperatorKind.GreaterThan => generator.GreaterThanExpression(leftOperand, rightOperand), 397BinaryOperatorKind.Or => generator.BitwiseOrExpression(leftOperand, rightOperand), 398BinaryOperatorKind.And => generator.BitwiseAndExpression(leftOperand, rightOperand), 399BinaryOperatorKind.ConditionalOr => generator.LogicalOrExpression(leftOperand, rightOperand), 400BinaryOperatorKind.ConditionalAnd => generator.LogicalAndExpression(leftOperand, rightOperand), 412BinaryOperatorKind operationKind) 422BinaryOperatorKind.LessThanOrEqual when rightOperand.IsNumericLiteral() 424BinaryOperatorKind.GreaterThanOrEqual when leftOperand.IsNumericLiteral()
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\SyntaxGeneratorInternalExtensions\SyntaxGeneratorInternal.cs (1)
103public abstract SyntaxNode NegateEquality(SyntaxGenerator generator, SyntaxNode binaryExpression, SyntaxNode left, BinaryOperatorKind negatedKind, SyntaxNode right);
Microsoft.CodeAnalysis.CSharp (30)
Operations\CSharpOperationFactory.cs (9)
1359BinaryOperatorKind operatorKind = Helper.DeriveBinaryOperatorKind(boundCompoundAssignmentOperator.Operator.Kind); 1485BinaryOperatorKind operatorKind = Helper.DeriveBinaryOperatorKind(boundBinaryOperator.OperatorKind); 1509BinaryOperatorKind operatorKind = Helper.DeriveBinaryOperatorKind(boundBinaryOperator.OperatorKind); 1515(operatorKind == BinaryOperatorKind.ConditionalAnd || operatorKind == BinaryOperatorKind.ConditionalOr) && 1565BinaryOperatorKind operatorKind = Helper.DeriveBinaryOperatorKind(boundTupleBinaryOperator.OperatorKind); 2527BinaryOperatorKind operatorKind = Helper.DeriveBinaryOperatorKind(boundRelationalPattern.Relation); 2673boundBinaryPattern.Disjunction ? BinaryOperatorKind.Or : BinaryOperatorKind.And,
Operations\CSharpOperationFactory_Methods.cs (21)
547internal static BinaryOperatorKind DeriveBinaryOperatorKind(CSharp.BinaryOperatorKind operatorKind) 552return BinaryOperatorKind.Add; 555return BinaryOperatorKind.Subtract; 558return BinaryOperatorKind.Multiply; 561return BinaryOperatorKind.Divide; 564return BinaryOperatorKind.Remainder; 567return BinaryOperatorKind.LeftShift; 570return BinaryOperatorKind.RightShift; 573return BinaryOperatorKind.UnsignedRightShift; 576return BinaryOperatorKind.And; 579return BinaryOperatorKind.Or; 582return BinaryOperatorKind.ExclusiveOr; 585return BinaryOperatorKind.LessThan; 588return BinaryOperatorKind.LessThanOrEqual; 591return BinaryOperatorKind.Equals; 594return BinaryOperatorKind.NotEquals; 597return BinaryOperatorKind.GreaterThanOrEqual; 600return BinaryOperatorKind.GreaterThan; 603return BinaryOperatorKind.ConditionalAnd; 606return BinaryOperatorKind.ConditionalOr; 609return BinaryOperatorKind.None;
Microsoft.CodeAnalysis.CSharp.CodeStyle (20)
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\Helpers.cs (1)
57binaryOperation.OperatorKind == BinaryOperatorKind.Subtract)
src\Analyzers\CSharp\Analyzers\UsePatternCombinators\AnalyzedPattern.cs (12)
100internal sealed class Relational(BinaryOperatorKind operatorKind, ExpressionSyntax value, IOperation target) : AnalyzedPattern(target) 102public readonly BinaryOperatorKind OperatorKind = operatorKind; 184private static BinaryOperatorKind Negate(BinaryOperatorKind kind) 188BinaryOperatorKind.LessThan => BinaryOperatorKind.GreaterThanOrEqual, 189BinaryOperatorKind.GreaterThan => BinaryOperatorKind.LessThanOrEqual, 190BinaryOperatorKind.LessThanOrEqual => BinaryOperatorKind.GreaterThan, 191BinaryOperatorKind.GreaterThanOrEqual => BinaryOperatorKind.LessThan,
src\Analyzers\CSharp\Analyzers\UsePatternCombinators\CSharpUsePatternCombinatorsAnalyzer.cs (5)
11using static BinaryOperatorKind; 44case IBinaryOperation { OperatorKind: BinaryOperatorKind.Equals } op: 125private static bool IsRelationalOperator(BinaryOperatorKind operatorKind) 147public static BinaryOperatorKind Flip(BinaryOperatorKind operatorKind)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (2)
936private static bool ConvertedHasUserDefinedEquals(BinaryOperatorKind operatorKind, IOperation operation) 952var opName = operatorKind == BinaryOperatorKind.Equals
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (18)
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordHelpers.cs (10)
158OperatorKind: BinaryOperatorKind.Equals, 663var expectedKind = successRequirement 664? BinaryOperatorKind.NotEquals 665: BinaryOperatorKind.Equals; 738(true, IBinaryOperation { OperatorKind: BinaryOperatorKind.ConditionalAnd } andOp) 745(false, IBinaryOperation { OperatorKind: BinaryOperatorKind.ConditionalOr } orOp) 752OperatorKind: BinaryOperatorKind.Equals, 760OperatorKind: BinaryOperatorKind.NotEquals, 804OperatorKind: BinaryOperatorKind.ConditionalAnd, 816OperatorKind: BinaryOperatorKind.ConditionalOr,
src\Analyzers\CSharp\CodeFixes\UsePatternCombinators\CSharpUsePatternCombinatorsCodeFixProvider.cs (5)
36private static SyntaxKind MapToSyntaxKind(BinaryOperatorKind kind) 40BinaryOperatorKind.LessThan => SyntaxKind.LessThanToken, 41BinaryOperatorKind.GreaterThan => SyntaxKind.GreaterThanToken, 42BinaryOperatorKind.LessThanOrEqual => SyntaxKind.LessThanEqualsToken, 43BinaryOperatorKind.GreaterThanOrEqual => SyntaxKind.GreaterThanEqualsToken,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSyntaxGeneratorInternal.cs (3)
183public override SyntaxNode NegateEquality(SyntaxGenerator generator, SyntaxNode binaryExpression, SyntaxNode left, BinaryOperatorKind negatedKind, SyntaxNode right) 186BinaryOperatorKind.Equals => generator.ReferenceEqualsExpression(left, right), 187BinaryOperatorKind.NotEquals => generator.ReferenceNotEqualsExpression(left, right),
Microsoft.CodeAnalysis.CSharp.Features (39)
ConvertIfToSwitch\CSharpConvertIfToSwitchCodeRefactoringProvider.Rewriting.cs (6)
23private static readonly Dictionary<BinaryOperatorKind, SyntaxKind> s_operatorMap = new Dictionary<BinaryOperatorKind, SyntaxKind> 25{ BinaryOperatorKind.LessThan, SyntaxKind.LessThanToken }, 26{ BinaryOperatorKind.GreaterThan, SyntaxKind.GreaterThanToken }, 27{ BinaryOperatorKind.LessThanOrEqual, SyntaxKind.LessThanEqualsToken }, 28{ BinaryOperatorKind.GreaterThanOrEqual, SyntaxKind.GreaterThanEqualsToken },
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\Helpers.cs (1)
57binaryOperation.OperatorKind == BinaryOperatorKind.Subtract)
src\Analyzers\CSharp\Analyzers\UsePatternCombinators\AnalyzedPattern.cs (12)
100internal sealed class Relational(BinaryOperatorKind operatorKind, ExpressionSyntax value, IOperation target) : AnalyzedPattern(target) 102public readonly BinaryOperatorKind OperatorKind = operatorKind; 184private static BinaryOperatorKind Negate(BinaryOperatorKind kind) 188BinaryOperatorKind.LessThan => BinaryOperatorKind.GreaterThanOrEqual, 189BinaryOperatorKind.GreaterThan => BinaryOperatorKind.LessThanOrEqual, 190BinaryOperatorKind.LessThanOrEqual => BinaryOperatorKind.GreaterThan, 191BinaryOperatorKind.GreaterThanOrEqual => BinaryOperatorKind.LessThan,
src\Analyzers\CSharp\Analyzers\UsePatternCombinators\CSharpUsePatternCombinatorsAnalyzer.cs (5)
11using static BinaryOperatorKind; 44case IBinaryOperation { OperatorKind: BinaryOperatorKind.Equals } op: 125private static bool IsRelationalOperator(BinaryOperatorKind operatorKind) 147public static BinaryOperatorKind Flip(BinaryOperatorKind operatorKind)
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordHelpers.cs (10)
158OperatorKind: BinaryOperatorKind.Equals, 663var expectedKind = successRequirement 664? BinaryOperatorKind.NotEquals 665: BinaryOperatorKind.Equals; 738(true, IBinaryOperation { OperatorKind: BinaryOperatorKind.ConditionalAnd } andOp) 745(false, IBinaryOperation { OperatorKind: BinaryOperatorKind.ConditionalOr } orOp) 752OperatorKind: BinaryOperatorKind.Equals, 760OperatorKind: BinaryOperatorKind.NotEquals, 804OperatorKind: BinaryOperatorKind.ConditionalAnd, 816OperatorKind: BinaryOperatorKind.ConditionalOr,
src\Analyzers\CSharp\CodeFixes\UsePatternCombinators\CSharpUsePatternCombinatorsCodeFixProvider.cs (5)
36private static SyntaxKind MapToSyntaxKind(BinaryOperatorKind kind) 40BinaryOperatorKind.LessThan => SyntaxKind.LessThanToken, 41BinaryOperatorKind.GreaterThan => SyntaxKind.GreaterThanToken, 42BinaryOperatorKind.LessThanOrEqual => SyntaxKind.LessThanEqualsToken, 43BinaryOperatorKind.GreaterThanOrEqual => SyntaxKind.GreaterThanEqualsToken,
Microsoft.CodeAnalysis.CSharp.Workspaces (5)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (2)
936private static bool ConvertedHasUserDefinedEquals(BinaryOperatorKind operatorKind, IOperation operation) 952var opName = operatorKind == BinaryOperatorKind.Equals
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSyntaxGeneratorInternal.cs (3)
183public override SyntaxNode NegateEquality(SyntaxGenerator generator, SyntaxNode binaryExpression, SyntaxNode left, BinaryOperatorKind negatedKind, SyntaxNode right) 186BinaryOperatorKind.Equals => generator.ReferenceEqualsExpression(left, right), 187BinaryOperatorKind.NotEquals => generator.ReferenceNotEqualsExpression(left, right),
Microsoft.CodeAnalysis.Features (16)
ConvertIfToSwitch\AbstractConvertIfToSwitchCodeRefactoringProvider.AnalyzedNodes.cs (2)
77internal sealed class Relational(BinaryOperatorKind operatorKind, TExpressionSyntax value) : AnalyzedPattern 79public readonly BinaryOperatorKind OperatorKind = operatorKind;
ConvertIfToSwitch\AbstractConvertIfToSwitchCodeRefactoringProvider.Analyzer.cs (5)
14using static BinaryOperatorKind; 284case IBinaryOperation { OperatorKind: BinaryOperatorKind.Equals } op: 414private static BinaryOperatorKind Flip(BinaryOperatorKind operatorKind) 427private static bool IsRelationalOperator(BinaryOperatorKind operatorKind)
src\Analyzers\Core\Analyzers\Helpers\HashCodeAnalyzer\HashCodeAnalyzer.OperationDeconstructor.cs (2)
99if (binary.OperatorKind == BinaryOperatorKind.Equals) 105else if (binary.OperatorKind == BinaryOperatorKind.NotEquals)
src\Analyzers\Core\Analyzers\PopulateSwitch\PopulateSwitchExpressionHelpers.cs (3)
66if (binaryPattern?.OperatorKind == BinaryOperatorKind.Or) 98BinaryOperatorKind.Or => IsDefault(binaryPattern.LeftPattern) || IsDefault(binaryPattern.RightPattern), 100BinaryOperatorKind.And => IsDefault(binaryPattern.LeftPattern) && IsDefault(binaryPattern.RightPattern),
src\Analyzers\Core\Analyzers\RemoveRedundantEquality\AbstractRemoveRedundantEqualityDiagnosticAnalyzer.cs (3)
65if (operation.OperatorKind is not (BinaryOperatorKind.Equals or BinaryOperatorKind.NotEquals)) 68var isOperatorEquals = operation.OperatorKind == BinaryOperatorKind.Equals;
src\Analyzers\Core\Analyzers\UseThrowExpression\AbstractUseThrowExpressionDiagnosticAnalyzer.cs (1)
220if (binaryOperator.OperatorKind != BinaryOperatorKind.Equals)
Microsoft.CodeAnalysis.Test.Utilities (45)
Compilation\ControlFlowGraphVerifier.cs (6)
947(binOp.OperatorKind == Operations.BinaryOperatorKind.And || binOp.OperatorKind == Operations.BinaryOperatorKind.Or) && 973binOp.OperatorKind == Operations.BinaryOperatorKind.And && 980binOp.OperatorKind == Operations.BinaryOperatorKind.Or && 1876return (binary.OperatorKind != Operations.BinaryOperatorKind.ConditionalAnd && binary.OperatorKind != Operations.BinaryOperatorKind.ConditionalOr) ||
Compilation\OperationTreeVerifier.cs (6)
1190var kindStr = $"{nameof(BinaryOperatorKind)}.{operation.OperatorKind}"; 1218var kindStr = $"{nameof(BinaryOperatorKind)}.{operation.OperatorKind}"; 1693var kindStr = $"{nameof(BinaryOperatorKind)}.{operation.OperatorKind}"; 1846var kindStr = $"{nameof(BinaryOperatorKind)}.{operation.Relation}"; 1966LogString($" ({nameof(BinaryOperatorKind)}.{operation.OperatorKind})"); 1981LogString($" ({nameof(BinaryOperatorKind)}.{operation.OperatorKind})");
Compilation\TestOperationVisitor.cs (14)
230var relation = operation.Relation; 766var binaryOperationKind = operation.OperatorKind; 772if (binaryOperationKind is BinaryOperatorKind.ConditionalAnd or BinaryOperatorKind.ConditionalOr) 833var binaryOperationKind = operation.OperatorKind; 1172var binaryOperationKind = operation.OperatorKind; 1375Assert.True(operation.OperatorKind is Operations.BinaryOperatorKind.LessThan or 1376Operations.BinaryOperatorKind.LessThanOrEqual or 1377Operations.BinaryOperatorKind.GreaterThan or 1378Operations.BinaryOperatorKind.GreaterThanOrEqual or 1379Operations.BinaryOperatorKind.Equals or // Error cases 1380Operations.BinaryOperatorKind.NotEquals); 1389Assert.True(operation.OperatorKind switch { Operations.BinaryOperatorKind.Or => true, Operations.BinaryOperatorKind.And => true, _ => false });
Diagnostics\OperationTestAnalyzer.cs (19)
190BinaryOperatorKind? advanceOperationCode; 196if (advanceOperationCode.Value == BinaryOperatorKind.Subtract) 198advanceOperationCode = BinaryOperatorKind.Add; 202if (advanceOperationCode.Value == BinaryOperatorKind.Add && 204(condition.OperatorKind == BinaryOperatorKind.LessThan || 205condition.OperatorKind == BinaryOperatorKind.LessThanOrEqual || 206condition.OperatorKind == BinaryOperatorKind.NotEquals || 207condition.OperatorKind == BinaryOperatorKind.GreaterThan || 208condition.OperatorKind == BinaryOperatorKind.GreaterThanOrEqual)) 229out BinaryOperatorKind? advanceOperationCode, out Optional<object> advanceIncrementOpt) 281advanceOperationCode = BinaryOperatorKind.Add; 407case BinaryOperatorKind.Equals: 411case BinaryOperatorKind.NotEquals: 413case BinaryOperatorKind.LessThan: 417case BinaryOperatorKind.LessThanOrEqual: 421case BinaryOperatorKind.GreaterThanOrEqual: 425case BinaryOperatorKind.GreaterThan: 1516if (binary.OperatorKind == BinaryOperatorKind.Add && binary.OperatorMethod != null && binary.OperatorMethod.Name.Contains("Addition")) 1521if (binary.OperatorKind == BinaryOperatorKind.Multiply && binary.Type.SpecialType == SpecialType.System_Double)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (3)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicSyntaxGeneratorInternal.vb (3)
156Public Overrides Function NegateEquality(generator As SyntaxGenerator, node As SyntaxNode, left As SyntaxNode, negatedKind As Operations.BinaryOperatorKind, right As SyntaxNode) As SyntaxNode 158Case BinaryOperatorKind.Equals 162Case BinaryOperatorKind.NotEquals
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)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicSyntaxGeneratorInternal.vb (3)
156Public Overrides Function NegateEquality(generator As SyntaxGenerator, node As SyntaxNode, left As SyntaxNode, negatedKind As Operations.BinaryOperatorKind, right As SyntaxNode) As SyntaxNode 158Case BinaryOperatorKind.Equals 162Case BinaryOperatorKind.NotEquals
Microsoft.CodeAnalysis.Workspaces (52)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SemanticFacts\ISemanticFactsExtensions.cs (4)
86return op.OperatorKind is BinaryOperatorKind.Add or 87BinaryOperatorKind.Subtract or 88BinaryOperatorKind.Multiply or 89BinaryOperatorKind.Divide;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_Negate.cs (47)
20private static readonly ImmutableDictionary<BinaryOperatorKind, BinaryOperatorKind> s_negatedBinaryMap = 21new Dictionary<BinaryOperatorKind, BinaryOperatorKind> 23{ BinaryOperatorKind.Equals, BinaryOperatorKind.NotEquals }, 24{ BinaryOperatorKind.NotEquals, BinaryOperatorKind.Equals }, 25{ BinaryOperatorKind.LessThan, BinaryOperatorKind.GreaterThanOrEqual }, 26{ BinaryOperatorKind.GreaterThan, BinaryOperatorKind.LessThanOrEqual }, 27{ BinaryOperatorKind.LessThanOrEqual, BinaryOperatorKind.GreaterThan }, 28{ BinaryOperatorKind.GreaterThanOrEqual, BinaryOperatorKind.LessThan }, 29{ BinaryOperatorKind.Or, BinaryOperatorKind.And }, 30{ BinaryOperatorKind.And, BinaryOperatorKind.Or }, 31{ BinaryOperatorKind.ConditionalOr, BinaryOperatorKind.ConditionalAnd }, 32{ BinaryOperatorKind.ConditionalAnd, BinaryOperatorKind.ConditionalOr }, 153if (!s_negatedBinaryMap.TryGetValue(binaryOperation.OperatorKind, out var negatedKind)) 159&& binaryOperation.OperatorKind is BinaryOperatorKind.LessThan or 160BinaryOperatorKind.LessThanOrEqual or 161BinaryOperatorKind.GreaterThan or 162BinaryOperatorKind.GreaterThanOrEqual) 167if (binaryOperation.OperatorKind is BinaryOperatorKind.Or or 168BinaryOperatorKind.And or 169BinaryOperatorKind.ConditionalAnd or 170BinaryOperatorKind.ConditionalOr) 176var newBinaryExpressionSyntax = negatedKind is BinaryOperatorKind.Equals or BinaryOperatorKind.NotEquals 384BinaryOperatorKind operationKind, 389BinaryOperatorKind.LessThanOrEqual => IsSpecialCaseBinaryExpression(binaryOperation, operationKind) 392BinaryOperatorKind.GreaterThanOrEqual => IsSpecialCaseBinaryExpression(binaryOperation, operationKind) 395BinaryOperatorKind.LessThan => generator.LessThanExpression(leftOperand, rightOperand), 396BinaryOperatorKind.GreaterThan => generator.GreaterThanExpression(leftOperand, rightOperand), 397BinaryOperatorKind.Or => generator.BitwiseOrExpression(leftOperand, rightOperand), 398BinaryOperatorKind.And => generator.BitwiseAndExpression(leftOperand, rightOperand), 399BinaryOperatorKind.ConditionalOr => generator.LogicalOrExpression(leftOperand, rightOperand), 400BinaryOperatorKind.ConditionalAnd => generator.LogicalAndExpression(leftOperand, rightOperand), 412BinaryOperatorKind operationKind) 422BinaryOperatorKind.LessThanOrEqual when rightOperand.IsNumericLiteral() 424BinaryOperatorKind.GreaterThanOrEqual when leftOperand.IsNumericLiteral()
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\SyntaxGeneratorInternalExtensions\SyntaxGeneratorInternal.cs (1)
103public abstract SyntaxNode NegateEquality(SyntaxGenerator generator, SyntaxNode binaryExpression, SyntaxNode left, BinaryOperatorKind negatedKind, SyntaxNode right);