984 references to BinaryOperatorKind
GenerateDocumentationAndConfigFiles (60)
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 },
149if (!s_negatedBinaryMap.TryGetValue(binaryOperation.OperatorKind, out var negatedKind))
155&& binaryOperation.OperatorKind is BinaryOperatorKind.LessThan or
156BinaryOperatorKind.LessThanOrEqual or
157BinaryOperatorKind.GreaterThan or
158BinaryOperatorKind.GreaterThanOrEqual)
163if (binaryOperation.OperatorKind is BinaryOperatorKind.Or or
164BinaryOperatorKind.And or
165BinaryOperatorKind.ConditionalAnd or
166BinaryOperatorKind.ConditionalOr)
172var newBinaryExpressionSyntax = negatedKind is BinaryOperatorKind.Equals or BinaryOperatorKind.NotEquals
380BinaryOperatorKind operationKind,
385BinaryOperatorKind.LessThanOrEqual => IsSpecialCaseBinaryExpression(binaryOperation, operationKind)
388BinaryOperatorKind.GreaterThanOrEqual => IsSpecialCaseBinaryExpression(binaryOperation, operationKind)
391BinaryOperatorKind.LessThan => generator.LessThanExpression(leftOperand, rightOperand),
392BinaryOperatorKind.GreaterThan => generator.GreaterThanExpression(leftOperand, rightOperand),
393BinaryOperatorKind.Or => generator.BitwiseOrExpression(leftOperand, rightOperand),
394BinaryOperatorKind.And => generator.BitwiseAndExpression(leftOperand, rightOperand),
395BinaryOperatorKind.ConditionalOr => generator.LogicalOrExpression(leftOperand, rightOperand),
396BinaryOperatorKind.ConditionalAnd => generator.LogicalAndExpression(leftOperand, rightOperand),
408BinaryOperatorKind operationKind)
418BinaryOperatorKind.LessThanOrEqual when rightOperand.IsNumericLiteral()
420BinaryOperatorKind.GreaterThanOrEqual when leftOperand.IsNumericLiteral()
ILLink.RoslynAnalyzer (3)
Metrics (24)
Metrics.Legacy (24)
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; }
5680internal 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)
5695public BinaryOperatorKind OperatorKind { get; }
6344internal 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)
6360public BinaryOperatorKind OperatorKind { get; }
8313internal RelationalCaseClauseOperation(IOperation value, BinaryOperatorKind relation, ILabelSymbol? label, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit)
8320public BinaryOperatorKind Relation { get; }
8630internal TupleBinaryOperation(BinaryOperatorKind operatorKind, IOperation leftOperand, IOperation rightOperand, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit)
8638public BinaryOperatorKind OperatorKind { get; }
9927internal BinaryPatternOperation(BinaryOperatorKind operatorKind, IPatternOperation leftPattern, IPatternOperation rightPattern, ITypeSymbol inputType, ITypeSymbol narrowedType, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit)
9934public BinaryOperatorKind OperatorKind { get; }
10009internal RelationalPatternOperation(BinaryOperatorKind operatorKind, IOperation value, ITypeSymbol inputType, ITypeSymbol narrowedType, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit)
10015public BinaryOperatorKind OperatorKind { get; }
Operations\ControlFlowGraphBuilder.cs (26)
2158case BinaryOperatorKind.ConditionalOr:
2159case BinaryOperatorKind.ConditionalAnd:
2275case BinaryOperatorKind.ConditionalOr:
2279case BinaryOperatorKind.ConditionalAnd:
2541new BinaryOperation(isAndAlso ? BinaryOperatorKind.And : BinaryOperatorKind.Or,
2631new BinaryOperation(isAndAlso ? BinaryOperatorKind.And : BinaryOperatorKind.Or,
4962isUp = new BinaryOperation(BinaryOperatorKind.GreaterThanOrEqual,
5082var comparisonKind = BinaryOperatorKind.None;
5087comparisonKind = BinaryOperatorKind.LessThanOrEqual;
5094comparisonKind = BinaryOperatorKind.GreaterThanOrEqual;
5098comparisonKind = BinaryOperatorKind.LessThanOrEqual;
5105if (comparisonKind == BinaryOperatorKind.None && ITypeSymbolHelpers.IsSignedIntegralType(stepEnumUnderlyingTypeOrSelf))
5107comparisonKind = BinaryOperatorKind.LessThanOrEqual;
5114if (comparisonKind != BinaryOperatorKind.None)
5153eitherLimitOrControlVariableIsNull = new BinaryOperation(BinaryOperatorKind.Or,
5194condition = new BinaryOperation(BinaryOperatorKind.LessThanOrEqual,
5214condition = new BinaryOperation(BinaryOperatorKind.GreaterThanOrEqual,
5248var shiftedStep = new BinaryOperation(BinaryOperatorKind.RightShift,
5263return new BinaryOperation(BinaryOperatorKind.ExclusiveOr,
5335IOperation condition = new BinaryOperation(BinaryOperatorKind.Or,
5387IOperation increment = new BinaryOperation(BinaryOperatorKind.Add,
5581condition = new BinaryOperation(BinaryOperatorKind.Equals,
5631if (relationalValueClause.Relation == BinaryOperatorKind.Equals)
Microsoft.CodeAnalysis.Analyzers (77)
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 },
149if (!s_negatedBinaryMap.TryGetValue(binaryOperation.OperatorKind, out var negatedKind))
155&& binaryOperation.OperatorKind is BinaryOperatorKind.LessThan or
156BinaryOperatorKind.LessThanOrEqual or
157BinaryOperatorKind.GreaterThan or
158BinaryOperatorKind.GreaterThanOrEqual)
163if (binaryOperation.OperatorKind is BinaryOperatorKind.Or or
164BinaryOperatorKind.And or
165BinaryOperatorKind.ConditionalAnd or
166BinaryOperatorKind.ConditionalOr)
172var newBinaryExpressionSyntax = negatedKind is BinaryOperatorKind.Equals or BinaryOperatorKind.NotEquals
380BinaryOperatorKind operationKind,
385BinaryOperatorKind.LessThanOrEqual => IsSpecialCaseBinaryExpression(binaryOperation, operationKind)
388BinaryOperatorKind.GreaterThanOrEqual => IsSpecialCaseBinaryExpression(binaryOperation, operationKind)
391BinaryOperatorKind.LessThan => generator.LessThanExpression(leftOperand, rightOperand),
392BinaryOperatorKind.GreaterThan => generator.GreaterThanExpression(leftOperand, rightOperand),
393BinaryOperatorKind.Or => generator.BitwiseOrExpression(leftOperand, rightOperand),
394BinaryOperatorKind.And => generator.BitwiseAndExpression(leftOperand, rightOperand),
395BinaryOperatorKind.ConditionalOr => generator.LogicalOrExpression(leftOperand, rightOperand),
396BinaryOperatorKind.ConditionalAnd => generator.LogicalAndExpression(leftOperand, rightOperand),
408BinaryOperatorKind operationKind)
418BinaryOperatorKind.LessThanOrEqual when rightOperand.IsNumericLiteral()
420BinaryOperatorKind.GreaterThanOrEqual when leftOperand.IsNumericLiteral()
Microsoft.CodeAnalysis.AnalyzerUtilities (88)
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 (72)
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 },
149if (!s_negatedBinaryMap.TryGetValue(binaryOperation.OperatorKind, out var negatedKind))
155&& binaryOperation.OperatorKind is BinaryOperatorKind.LessThan or
156BinaryOperatorKind.LessThanOrEqual or
157BinaryOperatorKind.GreaterThan or
158BinaryOperatorKind.GreaterThanOrEqual)
163if (binaryOperation.OperatorKind is BinaryOperatorKind.Or or
164BinaryOperatorKind.And or
165BinaryOperatorKind.ConditionalAnd or
166BinaryOperatorKind.ConditionalOr)
172var newBinaryExpressionSyntax = negatedKind is BinaryOperatorKind.Equals or BinaryOperatorKind.NotEquals
380BinaryOperatorKind operationKind,
385BinaryOperatorKind.LessThanOrEqual => IsSpecialCaseBinaryExpression(binaryOperation, operationKind)
388BinaryOperatorKind.GreaterThanOrEqual => IsSpecialCaseBinaryExpression(binaryOperation, operationKind)
391BinaryOperatorKind.LessThan => generator.LessThanExpression(leftOperand, rightOperand),
392BinaryOperatorKind.GreaterThan => generator.GreaterThanExpression(leftOperand, rightOperand),
393BinaryOperatorKind.Or => generator.BitwiseOrExpression(leftOperand, rightOperand),
394BinaryOperatorKind.And => generator.BitwiseAndExpression(leftOperand, rightOperand),
395BinaryOperatorKind.ConditionalOr => generator.LogicalOrExpression(leftOperand, rightOperand),
396BinaryOperatorKind.ConditionalAnd => generator.LogicalAndExpression(leftOperand, rightOperand),
408BinaryOperatorKind operationKind)
418BinaryOperatorKind.LessThanOrEqual when rightOperand.IsNumericLiteral()
420BinaryOperatorKind.GreaterThanOrEqual when leftOperand.IsNumericLiteral()
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 },
149if (!s_negatedBinaryMap.TryGetValue(binaryOperation.OperatorKind, out var negatedKind))
155&& binaryOperation.OperatorKind is BinaryOperatorKind.LessThan or
156BinaryOperatorKind.LessThanOrEqual or
157BinaryOperatorKind.GreaterThan or
158BinaryOperatorKind.GreaterThanOrEqual)
163if (binaryOperation.OperatorKind is BinaryOperatorKind.Or or
164BinaryOperatorKind.And or
165BinaryOperatorKind.ConditionalAnd or
166BinaryOperatorKind.ConditionalOr)
172var newBinaryExpressionSyntax = negatedKind is BinaryOperatorKind.Equals or BinaryOperatorKind.NotEquals
380BinaryOperatorKind operationKind,
385BinaryOperatorKind.LessThanOrEqual => IsSpecialCaseBinaryExpression(binaryOperation, operationKind)
388BinaryOperatorKind.GreaterThanOrEqual => IsSpecialCaseBinaryExpression(binaryOperation, operationKind)
391BinaryOperatorKind.LessThan => generator.LessThanExpression(leftOperand, rightOperand),
392BinaryOperatorKind.GreaterThan => generator.GreaterThanExpression(leftOperand, rightOperand),
393BinaryOperatorKind.Or => generator.BitwiseOrExpression(leftOperand, rightOperand),
394BinaryOperatorKind.And => generator.BitwiseAndExpression(leftOperand, rightOperand),
395BinaryOperatorKind.ConditionalOr => generator.LogicalOrExpression(leftOperand, rightOperand),
396BinaryOperatorKind.ConditionalAnd => generator.LogicalAndExpression(leftOperand, rightOperand),
408BinaryOperatorKind operationKind)
418BinaryOperatorKind.LessThanOrEqual when rightOperand.IsNumericLiteral()
420BinaryOperatorKind.GreaterThanOrEqual when leftOperand.IsNumericLiteral()
Microsoft.CodeAnalysis.CSharp (28)
Microsoft.CodeAnalysis.CSharp.CodeStyle (20)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (18)
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (12)
Microsoft.CodeAnalysis.CSharp.Features (38)
Microsoft.CodeAnalysis.CSharp.Workspaces (5)
Microsoft.CodeAnalysis.Features (26)
Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers (72)
Microsoft.CodeAnalysis.PublicApiAnalyzers (24)
Microsoft.CodeAnalysis.ResxSourceGenerator (24)
Microsoft.CodeAnalysis.Test.Utilities (45)
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 },
149if (!s_negatedBinaryMap.TryGetValue(binaryOperation.OperatorKind, out var negatedKind))
155&& binaryOperation.OperatorKind is BinaryOperatorKind.LessThan or
156BinaryOperatorKind.LessThanOrEqual or
157BinaryOperatorKind.GreaterThan or
158BinaryOperatorKind.GreaterThanOrEqual)
163if (binaryOperation.OperatorKind is BinaryOperatorKind.Or or
164BinaryOperatorKind.And or
165BinaryOperatorKind.ConditionalAnd or
166BinaryOperatorKind.ConditionalOr)
172var newBinaryExpressionSyntax = negatedKind is BinaryOperatorKind.Equals or BinaryOperatorKind.NotEquals
380BinaryOperatorKind operationKind,
385BinaryOperatorKind.LessThanOrEqual => IsSpecialCaseBinaryExpression(binaryOperation, operationKind)
388BinaryOperatorKind.GreaterThanOrEqual => IsSpecialCaseBinaryExpression(binaryOperation, operationKind)
391BinaryOperatorKind.LessThan => generator.LessThanExpression(leftOperand, rightOperand),
392BinaryOperatorKind.GreaterThan => generator.GreaterThanExpression(leftOperand, rightOperand),
393BinaryOperatorKind.Or => generator.BitwiseOrExpression(leftOperand, rightOperand),
394BinaryOperatorKind.And => generator.BitwiseAndExpression(leftOperand, rightOperand),
395BinaryOperatorKind.ConditionalOr => generator.LogicalOrExpression(leftOperand, rightOperand),
396BinaryOperatorKind.ConditionalAnd => generator.LogicalAndExpression(leftOperand, rightOperand),
408BinaryOperatorKind operationKind)
418BinaryOperatorKind.LessThanOrEqual when rightOperand.IsNumericLiteral()
420BinaryOperatorKind.GreaterThanOrEqual when leftOperand.IsNumericLiteral()
Roslyn.Diagnostics.Analyzers (72)
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 },
149if (!s_negatedBinaryMap.TryGetValue(binaryOperation.OperatorKind, out var negatedKind))
155&& binaryOperation.OperatorKind is BinaryOperatorKind.LessThan or
156BinaryOperatorKind.LessThanOrEqual or
157BinaryOperatorKind.GreaterThan or
158BinaryOperatorKind.GreaterThanOrEqual)
163if (binaryOperation.OperatorKind is BinaryOperatorKind.Or or
164BinaryOperatorKind.And or
165BinaryOperatorKind.ConditionalAnd or
166BinaryOperatorKind.ConditionalOr)
172var newBinaryExpressionSyntax = negatedKind is BinaryOperatorKind.Equals or BinaryOperatorKind.NotEquals
380BinaryOperatorKind operationKind,
385BinaryOperatorKind.LessThanOrEqual => IsSpecialCaseBinaryExpression(binaryOperation, operationKind)
388BinaryOperatorKind.GreaterThanOrEqual => IsSpecialCaseBinaryExpression(binaryOperation, operationKind)
391BinaryOperatorKind.LessThan => generator.LessThanExpression(leftOperand, rightOperand),
392BinaryOperatorKind.GreaterThan => generator.GreaterThanExpression(leftOperand, rightOperand),
393BinaryOperatorKind.Or => generator.BitwiseOrExpression(leftOperand, rightOperand),
394BinaryOperatorKind.And => generator.BitwiseAndExpression(leftOperand, rightOperand),
395BinaryOperatorKind.ConditionalOr => generator.LogicalOrExpression(leftOperand, rightOperand),
396BinaryOperatorKind.ConditionalAnd => generator.LogicalAndExpression(leftOperand, rightOperand),
408BinaryOperatorKind operationKind)
418BinaryOperatorKind.LessThanOrEqual when rightOperand.IsNumericLiteral()
420BinaryOperatorKind.GreaterThanOrEqual when leftOperand.IsNumericLiteral()
Roslyn.Diagnostics.CSharp.Analyzers (5)
Test.Utilities (12)
Text.Analyzers (72)
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 },
149if (!s_negatedBinaryMap.TryGetValue(binaryOperation.OperatorKind, out var negatedKind))
155&& binaryOperation.OperatorKind is BinaryOperatorKind.LessThan or
156BinaryOperatorKind.LessThanOrEqual or
157BinaryOperatorKind.GreaterThan or
158BinaryOperatorKind.GreaterThanOrEqual)
163if (binaryOperation.OperatorKind is BinaryOperatorKind.Or or
164BinaryOperatorKind.And or
165BinaryOperatorKind.ConditionalAnd or
166BinaryOperatorKind.ConditionalOr)
172var newBinaryExpressionSyntax = negatedKind is BinaryOperatorKind.Equals or BinaryOperatorKind.NotEquals
380BinaryOperatorKind operationKind,
385BinaryOperatorKind.LessThanOrEqual => IsSpecialCaseBinaryExpression(binaryOperation, operationKind)
388BinaryOperatorKind.GreaterThanOrEqual => IsSpecialCaseBinaryExpression(binaryOperation, operationKind)
391BinaryOperatorKind.LessThan => generator.LessThanExpression(leftOperand, rightOperand),
392BinaryOperatorKind.GreaterThan => generator.GreaterThanExpression(leftOperand, rightOperand),
393BinaryOperatorKind.Or => generator.BitwiseOrExpression(leftOperand, rightOperand),
394BinaryOperatorKind.And => generator.BitwiseAndExpression(leftOperand, rightOperand),
395BinaryOperatorKind.ConditionalOr => generator.LogicalOrExpression(leftOperand, rightOperand),
396BinaryOperatorKind.ConditionalAnd => generator.LogicalAndExpression(leftOperand, rightOperand),
408BinaryOperatorKind operationKind)
418BinaryOperatorKind.LessThanOrEqual when rightOperand.IsNumericLiteral()
420BinaryOperatorKind.GreaterThanOrEqual when leftOperand.IsNumericLiteral()