1 implementation of OperatorKind
Microsoft.CodeAnalysis (1)
Generated\Operations.Generated.cs (1)
5657public BinaryOperatorKind OperatorKind { get; }
164 references to OperatorKind
ILLink.RoslynAnalyzer (2)
DataFlow\FeatureChecksVisitor.cs (1)
99 switch (operation.OperatorKind) {
TrimAnalysis\TrimAnalysisVisitor.cs (1)
186 operation.OperatorKind == BinaryOperatorKind.Or &&
Metrics (7)
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\ComputationalComplexityMetrics.cs (1)
211countBinaryOperator(operation, ((IBinaryOperation)operation).OperatorKind);
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (4)
340return binaryOperation.OperatorKind == BinaryOperatorKind.ConditionalAnd || 341binaryOperation.OperatorKind == BinaryOperatorKind.ConditionalOr || 343(binaryOperation.OperatorKind == BinaryOperatorKind.Or || binaryOperation.OperatorKind == BinaryOperatorKind.And));
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IOperationExtensions.cs (2)
399=> binaryOperation.OperatorKind switch 420switch (binaryOperation.OperatorKind)
Metrics.Legacy (7)
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\ComputationalComplexityMetrics.cs (1)
211countBinaryOperator(operation, ((IBinaryOperation)operation).OperatorKind);
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (4)
340return binaryOperation.OperatorKind == BinaryOperatorKind.ConditionalAnd || 341binaryOperation.OperatorKind == BinaryOperatorKind.ConditionalOr || 343(binaryOperation.OperatorKind == BinaryOperatorKind.Or || binaryOperation.OperatorKind == BinaryOperatorKind.And));
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IOperationExtensions.cs (2)
399=> binaryOperation.OperatorKind switch 420switch (binaryOperation.OperatorKind)
Microsoft.AspNetCore.Mvc.Api.Analyzers (2)
ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzer.cs (2)
139if (binaryOperation.OperatorKind == BinaryOperatorKind.Equals) 145else if (binaryOperation.OperatorKind == BinaryOperatorKind.NotEquals)
Microsoft.CodeAnalysis (4)
Operations\ControlFlowGraphBuilder.cs (4)
2154switch (operation.OperatorKind) 2230leftOperand = PopStackFrame(frame, new BinaryOperation(operation.OperatorKind, PopOperand(), rightOperand, operation.IsLifted, operation.IsChecked, operation.IsCompareText, 2271switch (binOp.OperatorKind) 2281throw ExceptionUtilities.UnexpectedValue(binOp.OperatorKind);
Microsoft.CodeAnalysis.Analyzers (10)
MetaAnalyzers\CompareSymbolsCorrectlyAnalyzer.cs (1)
128if (binary.OperatorKind is not BinaryOperatorKind.Equals and not BinaryOperatorKind.NotEquals)
MetaAnalyzers\Fixers\CompareSymbolsCorrectlyFix.cs (1)
279if (binaryOperation.OperatorKind == BinaryOperatorKind.NotEquals)
MetaAnalyzers\PreferIsKindAnalyzer.cs (1)
73if (operation.OperatorKind is not (BinaryOperatorKind.Equals or BinaryOperatorKind.NotEquals))
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\ComputationalComplexityMetrics.cs (1)
211countBinaryOperator(operation, ((IBinaryOperation)operation).OperatorKind);
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (4)
340return binaryOperation.OperatorKind == BinaryOperatorKind.ConditionalAnd || 341binaryOperation.OperatorKind == BinaryOperatorKind.ConditionalOr || 343(binaryOperation.OperatorKind == BinaryOperatorKind.Or || binaryOperation.OperatorKind == BinaryOperatorKind.And));
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IOperationExtensions.cs (2)
399=> binaryOperation.OperatorKind switch 420switch (binaryOperation.OperatorKind)
Microsoft.CodeAnalysis.AnalyzerUtilities (17)
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\ComputationalComplexityMetrics.cs (1)
211countBinaryOperator(operation, ((IBinaryOperation)operation).OperatorKind);
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (4)
340return binaryOperation.OperatorKind == BinaryOperatorKind.ConditionalAnd || 341binaryOperation.OperatorKind == BinaryOperatorKind.ConditionalOr || 343(binaryOperation.OperatorKind == BinaryOperatorKind.Or || binaryOperation.OperatorKind == BinaryOperatorKind.And));
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IOperationExtensions.cs (2)
399=> binaryOperation.OperatorKind switch 420switch (binaryOperation.OperatorKind)
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\DisposeAnalysis\DisposeAnalysis.DisposeDataFlowOperationVisitor.cs (4)
451(operation.OperatorKind == BinaryOperatorKind.Equals || operation.OperatorKind == BinaryOperatorKind.ObjectValueEquals); 459(operation.OperatorKind == BinaryOperatorKind.NotEquals || operation.OperatorKind == BinaryOperatorKind.ObjectValueNotEquals);
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\ParameterValidationAnalysis\ParameterValidationAnalysis.ParameterValidationDataFlowOperationVisitor.cs (4)
395(operation.OperatorKind == BinaryOperatorKind.NotEquals || operation.OperatorKind == BinaryOperatorKind.ObjectValueNotEquals); 403(operation.OperatorKind == BinaryOperatorKind.Equals || operation.OperatorKind == BinaryOperatorKind.ObjectValueEquals);
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\ValueContentAnalysis\ValueContentAnalysis.ValueContentDataFlowOperationVisitor.cs (1)
228return leftValue.MergeBinaryOperation(rightValue, operation.OperatorKind, operation.LeftOperand.Type, operation.RightOperand.Type, operation.Type);
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\DataFlowOperationVisitor.cs (1)
1868switch (operation.OperatorKind)
Microsoft.CodeAnalysis.BannedApiAnalyzers (7)
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\ComputationalComplexityMetrics.cs (1)
211countBinaryOperator(operation, ((IBinaryOperation)operation).OperatorKind);
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (4)
340return binaryOperation.OperatorKind == BinaryOperatorKind.ConditionalAnd || 341binaryOperation.OperatorKind == BinaryOperatorKind.ConditionalOr || 343(binaryOperation.OperatorKind == BinaryOperatorKind.Or || binaryOperation.OperatorKind == BinaryOperatorKind.And));
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IOperationExtensions.cs (2)
399=> binaryOperation.OperatorKind switch 420switch (binaryOperation.OperatorKind)
Microsoft.CodeAnalysis.CodeStyle (7)
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\RemoveRedundantEquality\AbstractRemoveRedundantEqualityDiagnosticAnalyzer.cs (2)
65if (operation.OperatorKind is not (BinaryOperatorKind.Equals or BinaryOperatorKind.NotEquals)) 68var isOperatorEquals = operation.OperatorKind == BinaryOperatorKind.Equals;
src\Analyzers\Core\Analyzers\UseConditionalExpression\ForAssignment\UseConditionalExpressionForAssignmentHelpers.cs (1)
164if (current is IBinaryOperation { OperatorKind: BinaryOperatorKind.Equals or BinaryOperatorKind.NotEquals } binaryOperation)
src\Analyzers\Core\Analyzers\UseThrowExpression\AbstractUseThrowExpressionDiagnosticAnalyzer.cs (1)
219if (binaryOperator.OperatorKind != BinaryOperatorKind.Equals)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SemanticFacts\ISemanticFactsExtensions.cs (1)
86return op.OperatorKind is BinaryOperatorKind.Add or
Microsoft.CodeAnalysis.CodeStyle.Fixes (3)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_Negate.cs (3)
151if (!s_negatedBinaryMap.TryGetValue(binaryOperation.OperatorKind, out var negatedKind)) 157&& binaryOperation.OperatorKind is BinaryOperatorKind.LessThan or 165if (binaryOperation.OperatorKind is BinaryOperatorKind.Or or
Microsoft.CodeAnalysis.CSharp.CodeStyle (10)
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\Helpers.cs (1)
57binaryOperation.OperatorKind == BinaryOperatorKind.Subtract)
src\Analyzers\CSharp\Analyzers\UsePatternCombinators\CSharpUsePatternCombinatorsAnalyzer.cs (7)
43case IBinaryOperation { OperatorKind: BinaryOperatorKind.Equals } op: 46case IBinaryOperation { OperatorKind: NotEquals } op: 49case IBinaryOperation { OperatorKind: ConditionalOr, Syntax: BinaryExpressionSyntax syntax } op: 52case IBinaryOperation { OperatorKind: ConditionalAnd, Syntax: BinaryExpressionSyntax syntax } op: 55case IBinaryOperation op when IsRelationalOperator(op.OperatorKind): 105=> new Relational(Flip(op.OperatorKind), left, op.RightOperand), 107=> new Relational(op.OperatorKind, right, op.LeftOperand),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (2)
957ConvertedHasUserDefinedEquals(binaryOperation.OperatorKind, binaryOperation.RightOperand)) 964ConvertedHasUserDefinedEquals(binaryOperation.OperatorKind, binaryOperation.LeftOperand))
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (8)
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordHelpers.cs (8)
158OperatorKind: BinaryOperatorKind.Equals, 667return binOp.OperatorKind == expectedKind && 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,
Microsoft.CodeAnalysis.CSharp.Features (16)
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\Helpers.cs (1)
57binaryOperation.OperatorKind == BinaryOperatorKind.Subtract)
src\Analyzers\CSharp\Analyzers\UsePatternCombinators\CSharpUsePatternCombinatorsAnalyzer.cs (7)
43case IBinaryOperation { OperatorKind: BinaryOperatorKind.Equals } op: 46case IBinaryOperation { OperatorKind: NotEquals } op: 49case IBinaryOperation { OperatorKind: ConditionalOr, Syntax: BinaryExpressionSyntax syntax } op: 52case IBinaryOperation { OperatorKind: ConditionalAnd, Syntax: BinaryExpressionSyntax syntax } op: 55case IBinaryOperation op when IsRelationalOperator(op.OperatorKind): 105=> new Relational(Flip(op.OperatorKind), left, op.RightOperand), 107=> new Relational(op.OperatorKind, right, op.LeftOperand),
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordHelpers.cs (8)
158OperatorKind: BinaryOperatorKind.Equals, 667return binOp.OperatorKind == expectedKind && 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,
Microsoft.CodeAnalysis.CSharp.Workspaces (2)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (2)
957ConvertedHasUserDefinedEquals(binaryOperation.OperatorKind, binaryOperation.RightOperand)) 964ConvertedHasUserDefinedEquals(binaryOperation.OperatorKind, binaryOperation.LeftOperand))
Microsoft.CodeAnalysis.Features (15)
ConvertIfToSwitch\AbstractConvertIfToSwitchCodeRefactoringProvider.Analyzer.cs (9)
207if (operation is IBinaryOperation { OperatorKind: ConditionalOr } op) 280case IBinaryOperation { OperatorKind: ConditionalAnd } op 284case IBinaryOperation { OperatorKind: BinaryOperatorKind.Equals } op: 294case IBinaryOperation { OperatorKind: NotEquals } op 299when Supports(Feature.RelationalPattern) && IsRelationalOperator(op.OperatorKind): 304case IBinaryOperation { OperatorKind: ConditionalAnd } op 351=> new AnalyzedPattern.Relational(Flip(op.OperatorKind), left), 353=> new AnalyzedPattern.Relational(op.OperatorKind, right), 397return op.OperatorKind switch
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\RemoveRedundantEquality\AbstractRemoveRedundantEqualityDiagnosticAnalyzer.cs (2)
65if (operation.OperatorKind is not (BinaryOperatorKind.Equals or BinaryOperatorKind.NotEquals)) 68var isOperatorEquals = operation.OperatorKind == BinaryOperatorKind.Equals;
src\Analyzers\Core\Analyzers\UseConditionalExpression\ForAssignment\UseConditionalExpressionForAssignmentHelpers.cs (1)
164if (current is IBinaryOperation { OperatorKind: BinaryOperatorKind.Equals or BinaryOperatorKind.NotEquals } binaryOperation)
src\Analyzers\Core\Analyzers\UseThrowExpression\AbstractUseThrowExpressionDiagnosticAnalyzer.cs (1)
219if (binaryOperator.OperatorKind != BinaryOperatorKind.Equals)
Microsoft.CodeAnalysis.ResxSourceGenerator (7)
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\ComputationalComplexityMetrics.cs (1)
211countBinaryOperator(operation, ((IBinaryOperation)operation).OperatorKind);
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (4)
340return binaryOperation.OperatorKind == BinaryOperatorKind.ConditionalAnd || 341binaryOperation.OperatorKind == BinaryOperatorKind.ConditionalOr || 343(binaryOperation.OperatorKind == BinaryOperatorKind.Or || binaryOperation.OperatorKind == BinaryOperatorKind.And));
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IOperationExtensions.cs (2)
399=> binaryOperation.OperatorKind switch 420switch (binaryOperation.OperatorKind)
Microsoft.CodeAnalysis.Test.Utilities (18)
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 (1)
1190var kindStr = $"{nameof(BinaryOperatorKind)}.{operation.OperatorKind}";
Compilation\TestOperationVisitor.cs (1)
766var binaryOperationKind = operation.OperatorKind;
Diagnostics\OperationTestAnalyzer.cs (10)
204(condition.OperatorKind == BinaryOperatorKind.LessThan || 205condition.OperatorKind == BinaryOperatorKind.LessThanOrEqual || 206condition.OperatorKind == BinaryOperatorKind.NotEquals || 207condition.OperatorKind == BinaryOperatorKind.GreaterThan || 208condition.OperatorKind == BinaryOperatorKind.GreaterThanOrEqual)) 254advanceOperationCode = advanceOperation.OperatorKind; 1516if (binary.OperatorKind == BinaryOperatorKind.Add && binary.OperatorMethod != null && binary.OperatorMethod.Name.Contains("Addition")) 1521if (binary.OperatorKind == BinaryOperatorKind.Multiply && binary.Type.SpecialType == SpecialType.System_Double) 1575binary.OperatorKind.ToString())); 1628binary.OperatorKind.ToString()));
Microsoft.CodeAnalysis.Workspaces (4)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SemanticFacts\ISemanticFactsExtensions.cs (1)
86return op.OperatorKind is BinaryOperatorKind.Add or
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_Negate.cs (3)
151if (!s_negatedBinaryMap.TryGetValue(binaryOperation.OperatorKind, out var negatedKind)) 157&& binaryOperation.OperatorKind is BinaryOperatorKind.LessThan or 165if (binaryOperation.OperatorKind is BinaryOperatorKind.Or or
Roslyn.Compilers.VisualBasic.IOperation.UnitTests (2)
IOperation\IOperationTests.vb (2)
67Assert.Equal(add1.OperatorKind, Operations.BinaryOperatorKind.Add) 100Assert.Equal(add2.OperatorKind, Operations.BinaryOperatorKind.Add)
Roslyn.Diagnostics.Analyzers (7)
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\ComputationalComplexityMetrics.cs (1)
211countBinaryOperator(operation, ((IBinaryOperation)operation).OperatorKind);
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (4)
340return binaryOperation.OperatorKind == BinaryOperatorKind.ConditionalAnd || 341binaryOperation.OperatorKind == BinaryOperatorKind.ConditionalOr || 343(binaryOperation.OperatorKind == BinaryOperatorKind.Or || binaryOperation.OperatorKind == BinaryOperatorKind.And));
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IOperationExtensions.cs (2)
399=> binaryOperation.OperatorKind switch 420switch (binaryOperation.OperatorKind)
Test.Utilities (2)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IOperationExtensions.cs (2)
399=> binaryOperation.OperatorKind switch 420switch (binaryOperation.OperatorKind)
Text.Analyzers (7)
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\ComputationalComplexityMetrics.cs (1)
211countBinaryOperator(operation, ((IBinaryOperation)operation).OperatorKind);
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (4)
340return binaryOperation.OperatorKind == BinaryOperatorKind.ConditionalAnd || 341binaryOperation.OperatorKind == BinaryOperatorKind.ConditionalOr || 343(binaryOperation.OperatorKind == BinaryOperatorKind.Or || binaryOperation.OperatorKind == BinaryOperatorKind.And));
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IOperationExtensions.cs (2)
399=> binaryOperation.OperatorKind switch 420switch (binaryOperation.OperatorKind)