1 implementation of IBinaryOperation
Microsoft.CodeAnalysis (1)
Generated\Operations.Generated.cs (1)
5640internal sealed partial class BinaryOperation : Operation, IBinaryOperation
155 references to IBinaryOperation
ILLink.RoslynAnalyzer (2)
DataFlow\FeatureChecksVisitor.cs (1)
96 public override FeatureChecksValue VisitBinaryOperator (IBinaryOperation operation, StateValue state)
TrimAnalysis\TrimAnalysisVisitor.cs (1)
183 public override MultiValue VisitBinaryOperator (IBinaryOperation operation, StateValue argument)
Microsoft.AspNetCore.Mvc.Api.Analyzers (2)
ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzer.cs (2)
138var binaryOperation = (IBinaryOperation)condition;
Microsoft.CodeAnalysis (27)
Generated\OperationKind.Generated.cs (2)
83/// <summary>Indicates an <see cref="IBinaryOperation"/>.</summary> 85/// <summary>Indicates an <see cref="IBinaryOperation"/>. Use <see cref="Binary"/> instead.</summary>
Generated\Operations.Generated.cs (3)
10946public override IOperation VisitBinaryOperator(IBinaryOperation operation, object? argument) 11446public virtual void VisitBinaryOperator(IBinaryOperation operation) => DefaultVisit(operation); 11585public virtual TResult? VisitBinaryOperator(IBinaryOperation operation, TArgument argument) => DefaultVisit(operation, argument);
Operations\ControlFlowGraphBuilder.cs (16)
2152private static bool IsConditional(IBinaryOperation operation) 2164public override IOperation VisitBinaryOperator(IBinaryOperation operation, int? captureIdForResult) 2204var stack = ArrayBuilder<(IBinaryOperation, EvalStackFrame)>.GetInstance(); 2212if (leftOperand is not IBinaryOperation binary || IsConditional(binary)) 2269private static bool CalculateAndOrSense(IBinaryOperation binOp, bool sense) 2285private IOperation VisitBinaryConditionalOperator(IBinaryOperation binOp, bool sense, int? captureIdForResult, 2301private IOperation VisitNullableBinaryConditionalOperator(IBinaryOperation binOp, int? captureIdForResult) 2407private IOperation VisitObjectBinaryConditionalOperator(IBinaryOperation binOp) 2462private IOperation VisitDynamicBinaryConditionalOperator(IBinaryOperation binOp, int? captureIdForResult) 2562private IOperation VisitUserDefinedBinaryConditionalOperator(IBinaryOperation binOp, int? captureIdForResult) 2651private IOperation VisitShortCircuitingOperator(IBinaryOperation condition, bool sense, bool stopSense, bool stopValue, 2727var binOp = (IBinaryOperation)condition; 2749private static bool IsBooleanConditionalOperator(IBinaryOperation binOp) 2791if (IsBooleanConditionalOperator((IBinaryOperation)condition)) 2806else if (top.condition is IBinaryOperation binOp && IsBooleanConditionalOperator(binOp))
Operations\Loops\ForToLoopOperationInfo.cs (4)
11public readonly IBinaryOperation Addition; 12public readonly IBinaryOperation Subtraction; 16public ForToLoopOperationUserDefinedInfo(IBinaryOperation addition, IBinaryOperation subtraction, IOperation lessThanOrEqual, IOperation greaterThanOrEqual)
Operations\OperationMapBuilder.cs (2)
35public override object? VisitBinaryOperator([DisallowNull] IBinaryOperation? operation, Dictionary<SyntaxNode, IOperation> argument) 43if (operation.LeftOperand is IBinaryOperation nested)
Microsoft.CodeAnalysis.CodeStyle (14)
src\Analyzers\Core\Analyzers\Helpers\HashCodeAnalyzer\HashCodeAnalyzer.OperationDeconstructor.cs (3)
50case IBinaryOperation topBinary: 56topBinary.LeftOperand is IBinaryOperation leftBinary && 95if (conditional.Condition is IBinaryOperation binary &&
src\Analyzers\Core\Analyzers\RemoveRedundantEquality\AbstractRemoveRedundantEqualityDiagnosticAnalyzer.cs (2)
61var operation = (IBinaryOperation)context.Operation;
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.BlockAnalyzer.cs (1)
353if (operation.Parent is IBinaryOperation)
src\Analyzers\Core\Analyzers\UseCompoundAssignment\AbstractUseCompoundAssignmentDiagnosticAnalyzer.cs (4)
151var operation = (IBinaryOperation)semanticModel.GetRequiredOperation(binaryExpression, cancellationToken); 171var operation = (IBinaryOperation)semanticModel.GetRequiredOperation(binaryExpression, cancellationToken);
src\Analyzers\Core\Analyzers\UseThrowExpression\AbstractUseThrowExpressionDiagnosticAnalyzer.cs (1)
215if (condition is not IBinaryOperation binaryOperator)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SemanticFacts\ISemanticFactsExtensions.cs (3)
70if (semanticModel.GetOperation(parentBinary) is IBinaryOperation parentBinaryOp && 71semanticModel.GetOperation(innerBinary) is IBinaryOperation innerBinaryOp) 84static bool IsArithmetic(IBinaryOperation op)
Microsoft.CodeAnalysis.CodeStyle.Fixes (3)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_Negate.cs (3)
151if (operation is IBinaryOperation binaryOperation) 382IBinaryOperation binaryOperation, 411IBinaryOperation binaryOperation,
Microsoft.CodeAnalysis.CSharp (3)
Operations\CSharpOperationFactory.cs (3)
1483IBinaryOperation createBoundUserDefinedConditionalLogicalOperator(BoundUserDefinedConditionalLogicalOperator boundBinaryOperator, IOperation left, IOperation right) 1507private IBinaryOperation CreateBoundBinaryOperatorOperation(BoundBinaryOperator boundBinaryOperator, IOperation left, IOperation right) 1553static IBinaryOperation createBoundBinaryOperatorOperation(
Microsoft.CodeAnalysis.CSharp.CodeStyle (16)
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseIndexOperatorDiagnosticAnalyzer.cs (1)
171!IsSubtraction(argumentValue, out var subtraction))
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseRangeOperatorDiagnosticAnalyzer.cs (2)
186if (IsSubtraction(startOperation, out var subtraction)) 233if (!IsSubtraction(invocation.Arguments[1].Value, out var subtraction) ||
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\Helpers.cs (2)
54public static bool IsSubtraction(IOperation operation, [NotNullWhen(true)] out IBinaryOperation? subtraction) 56if (operation is IBinaryOperation binaryOperation &&
src\Analyzers\CSharp\Analyzers\UsePatternCombinators\CSharpUsePatternCombinatorsAnalyzer.cs (9)
44case IBinaryOperation { OperatorKind: BinaryOperatorKind.Equals } op: 47case IBinaryOperation { OperatorKind: NotEquals } op: 50case IBinaryOperation { OperatorKind: ConditionalOr, Syntax: BinaryExpressionSyntax syntax } op: 53case IBinaryOperation { OperatorKind: ConditionalAnd, Syntax: BinaryExpressionSyntax syntax } op: 56case IBinaryOperation op when IsRelationalOperator(op.OperatorKind): 75private static AnalyzedPattern? ParseBinaryPattern(IBinaryOperation op, bool isDisjunctive, SyntaxToken token) 88private static ConstantResult DetermineConstant(IBinaryOperation op) 98private static AnalyzedPattern? ParseRelationalPattern(IBinaryOperation op) 113private static AnalyzedPattern? ParseConstantPattern(IBinaryOperation op)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (2)
914if (operation.UnwrapImplicitConversion() is IBinaryOperation binaryOperation) 1411if (operation is IBinaryOperation { OperatorMethod: not null })
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (8)
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordHelpers.cs (8)
156if (operand is not IBinaryOperation 660if (operation is IBinaryOperation binOp) 739(true, IBinaryOperation { OperatorKind: BinaryOperatorKind.ConditionalAnd } andOp) 746(false, IBinaryOperation { OperatorKind: BinaryOperatorKind.ConditionalOr } orOp) 751(true, IBinaryOperation 759(false, IBinaryOperation 803(true, IBinaryOperation 815(false, IBinaryOperation
Microsoft.CodeAnalysis.CSharp.Features (25)
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseIndexOperatorDiagnosticAnalyzer.cs (1)
171!IsSubtraction(argumentValue, out var subtraction))
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseRangeOperatorDiagnosticAnalyzer.cs (2)
186if (IsSubtraction(startOperation, out var subtraction)) 233if (!IsSubtraction(invocation.Arguments[1].Value, out var subtraction) ||
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\Helpers.cs (2)
54public static bool IsSubtraction(IOperation operation, [NotNullWhen(true)] out IBinaryOperation? subtraction) 56if (operation is IBinaryOperation binaryOperation &&
src\Analyzers\CSharp\Analyzers\UsePatternCombinators\CSharpUsePatternCombinatorsAnalyzer.cs (9)
44case IBinaryOperation { OperatorKind: BinaryOperatorKind.Equals } op: 47case IBinaryOperation { OperatorKind: NotEquals } op: 50case IBinaryOperation { OperatorKind: ConditionalOr, Syntax: BinaryExpressionSyntax syntax } op: 53case IBinaryOperation { OperatorKind: ConditionalAnd, Syntax: BinaryExpressionSyntax syntax } op: 56case IBinaryOperation op when IsRelationalOperator(op.OperatorKind): 75private static AnalyzedPattern? ParseBinaryPattern(IBinaryOperation op, bool isDisjunctive, SyntaxToken token) 88private static ConstantResult DetermineConstant(IBinaryOperation op) 98private static AnalyzedPattern? ParseRelationalPattern(IBinaryOperation op) 113private static AnalyzedPattern? ParseConstantPattern(IBinaryOperation op)
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordHelpers.cs (8)
156if (operand is not IBinaryOperation 660if (operation is IBinaryOperation binOp) 739(true, IBinaryOperation { OperatorKind: BinaryOperatorKind.ConditionalAnd } andOp) 746(false, IBinaryOperation { OperatorKind: BinaryOperatorKind.ConditionalOr } orOp) 751(true, IBinaryOperation 759(false, IBinaryOperation 803(true, IBinaryOperation 815(false, IBinaryOperation
src\Analyzers\CSharp\CodeFixes\UseIndexOrRangeOperator\CSharpUseRangeOperatorCodeFixProvider.cs (3)
156if (IsSubtraction(result.InvocationOperation.Arguments[0].Value, out var subtraction) && 170if (IsSubtraction(result.InvocationOperation.Arguments[1].Value, out var subtraction) && 274if (IsSubtraction(rangeOperation, out var subtraction) &&
Microsoft.CodeAnalysis.CSharp.Workspaces (2)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (2)
914if (operation.UnwrapImplicitConversion() is IBinaryOperation binaryOperation) 1411if (operation is IBinaryOperation { OperatorMethod: not null })
Microsoft.CodeAnalysis.Features (25)
ConvertIfToSwitch\AbstractConvertIfToSwitchCodeRefactoringProvider.Analyzer.cs (12)
207if (operation is IBinaryOperation { OperatorKind: ConditionalOr } op) 253private ConstantResult DetermineConstant(IBinaryOperation op) 280case IBinaryOperation { OperatorKind: ConditionalAnd } op 284case IBinaryOperation { OperatorKind: BinaryOperatorKind.Equals } op: 294case IBinaryOperation { OperatorKind: NotEquals } op 298case IBinaryOperation op 304case IBinaryOperation { OperatorKind: ConditionalAnd } op 346private AnalyzedPattern? ParseRelationalPattern(IBinaryOperation op) 374private (SyntaxNode Lower, SyntaxNode Higher) GetRangeBounds(IBinaryOperation op) 377{ LeftOperand: IBinaryOperation left, RightOperand: IBinaryOperation right }) 395private static (BoundKind Kind, IOperation Expression, IOperation Value) GetRangeBound(IBinaryOperation op)
InitializeParameter\AbstractAddParameterCheckCodeRefactoringProvider.cs (1)
218if (condition is IBinaryOperation binaryOperator)
src\Analyzers\Core\Analyzers\Helpers\HashCodeAnalyzer\HashCodeAnalyzer.OperationDeconstructor.cs (3)
50case IBinaryOperation topBinary: 56topBinary.LeftOperand is IBinaryOperation leftBinary && 95if (conditional.Condition is IBinaryOperation binary &&
src\Analyzers\Core\Analyzers\RemoveRedundantEquality\AbstractRemoveRedundantEqualityDiagnosticAnalyzer.cs (2)
61var operation = (IBinaryOperation)context.Operation;
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.BlockAnalyzer.cs (1)
353if (operation.Parent is IBinaryOperation)
src\Analyzers\Core\Analyzers\UseCompoundAssignment\AbstractUseCompoundAssignmentDiagnosticAnalyzer.cs (4)
151var operation = (IBinaryOperation)semanticModel.GetRequiredOperation(binaryExpression, cancellationToken); 171var operation = (IBinaryOperation)semanticModel.GetRequiredOperation(binaryExpression, cancellationToken);
src\Analyzers\Core\Analyzers\UseThrowExpression\AbstractUseThrowExpressionDiagnosticAnalyzer.cs (1)
215if (condition is not IBinaryOperation binaryOperator)
ValueTracking\ValueTracker.OperationCollector.cs (1)
241or IBinaryOperation
Microsoft.CodeAnalysis.Test.Utilities (18)
Compilation\ControlFlowGraphVerifier.cs (3)
944if (reference.Parent is IBinaryOperation binOp) 1875var binary = (IBinaryOperation)n;
Compilation\OperationTreeVerifier.cs (2)
1186public override void VisitBinaryOperator(IBinaryOperation operation) 1188LogString(nameof(IBinaryOperation));
Compilation\TestOperationVisitor.cs (1)
760public override void VisitBinaryOperator(IBinaryOperation operation)
Diagnostics\OperationTestAnalyzer.cs (12)
154IBinaryOperation condition = (IBinaryOperation)forCondition; 245IBinaryOperation advanceOperation = (IBinaryOperation)advanceAssignment.Value; 1515IBinaryOperation binary = (IBinaryOperation)operationContext.Operation; 1569var binary = (IBinaryOperation)operationContext.Operation; 1608var binary = (IBinaryOperation)operationContext.Operation; 1788var binary = (IBinaryOperation)operation;
Microsoft.CodeAnalysis.Workspaces (6)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SemanticFacts\ISemanticFactsExtensions.cs (3)
70if (semanticModel.GetOperation(parentBinary) is IBinaryOperation parentBinaryOp && 71semanticModel.GetOperation(innerBinary) is IBinaryOperation innerBinaryOp) 84static bool IsArithmetic(IBinaryOperation op)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_Negate.cs (3)
151if (operation is IBinaryOperation binaryOperation) 382IBinaryOperation binaryOperation, 411IBinaryOperation binaryOperation,
Roslyn.Compilers.VisualBasic.IOperation.UnitTests (4)
IOperation\IOperationTests.vb (4)
66Dim add1 As IBinaryOperation = DirectCast(assignment1.Value, IBinaryOperation) 99Dim add2 As IBinaryOperation = DirectCast(assignment2.Value, IBinaryOperation)