1 implementation of ILiteralOperation
Microsoft.CodeAnalysis (1)
Generated\Operations.Generated.cs (1)
5114internal sealed partial class LiteralOperation : Operation, ILiteralOperation
102 references to ILiteralOperation
GenerateDocumentationAndConfigFiles (4)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (1)
381=> operand is ILiteralOperation { ConstantValue: { HasValue: true, Value: null } };
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_Negate.cs (3)
419=> CanSimplifyToLengthEqualsZeroExpression(leftOperand, (ILiteralOperation)rightOperand), 421=> CanSimplifyToLengthEqualsZeroExpression(rightOperand, (ILiteralOperation)leftOperand), 434IOperation variableExpression, ILiteralOperation numericLiteralExpression)
ILLink.RoslynAnalyzer (2)
DataFlow\FeatureChecksVisitor.cs (2)
72public override FeatureChecksValue VisitLiteral(ILiteralOperation operation, StateValue state) 83if (operation is not ILiteralOperation literal)
Microsoft.Analyzers.Extra (1)
CallAnalysis\Fixers\LegacyLoggingFixer.FixDetails.cs (1)
109case ILiteralOperation lit:
Microsoft.AspNetCore.App.Analyzers (3)
Http\HeaderDictionaryIndexerAnalyzer.cs (1)
35propertyReference.Arguments[0].Value is ILiteralOperation literalOperation &&
RouteHandlers\DetectAmbiguousRoutes.cs (2)
256else if (argument1 is ILiteralOperation literal && argument2 is ILiteralOperation otherLiteral)
Microsoft.AspNetCore.Mvc.Api.Analyzers (1)
ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzer.cs (1)
169var constantValue = ((ILiteralOperation)operation).ConstantValue;
Microsoft.CodeAnalysis (9)
Generated\OperationKind.Generated.cs (1)
58/// <summary>Indicates an <see cref="ILiteralOperation"/>.</summary>
Generated\Operations.Generated.cs (3)
10963public override IOperation VisitLiteral(ILiteralOperation operation, object? argument) 11512public virtual void VisitLiteral(ILiteralOperation operation) => DefaultVisit(operation); 11653public virtual TResult? VisitLiteral(ILiteralOperation operation, TArgument argument) => DefaultVisit(operation, argument);
Operations\ControlFlowGraphBuilder.cs (5)
7092Debug.Assert(interpolation.FormatString is ILiteralOperation or IConversionOperation { Operand: ILiteralOperation }); 7105Debug.Assert(interpolatedStringText.Text is ILiteralOperation or IConversionOperation { Operand: ILiteralOperation }); 7138public override IOperation VisitLiteral(ILiteralOperation operation, int? captureIdForResult)
Microsoft.CodeAnalysis.Analyzers (9)
MetaAnalyzers\DiagnosticDescriptorCreationAnalyzer.cs (2)
893if (argumentValueOperation is ILiteralOperation literalOperation) 903fieldInitializer.Value.WalkDownConversion() is ILiteralOperation fieldInitializerLiteral)
MetaAnalyzers\Fixers\DefineDiagnosticDescriptorArgumentsCorrectlyFix.cs (3)
83public FixInfo(string fixValue, ILiteralOperation sourceLiteralAtLocationToFix) 99public ILiteralOperation? SourceLiteralAtLocationToFix { get; } 124model.GetOperation(fixNode, cancellationToken) is ILiteralOperation literal &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (1)
381=> operand is ILiteralOperation { ConstantValue: { HasValue: true, Value: null } };
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_Negate.cs (3)
419=> CanSimplifyToLengthEqualsZeroExpression(leftOperand, (ILiteralOperation)rightOperand), 421=> CanSimplifyToLengthEqualsZeroExpression(rightOperand, (ILiteralOperation)leftOperand), 434IOperation variableExpression, ILiteralOperation numericLiteralExpression)
Microsoft.CodeAnalysis.AnalyzerUtilities (1)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (1)
381=> operand is ILiteralOperation { ConstantValue: { HasValue: true, Value: null } };
Microsoft.CodeAnalysis.CodeStyle (3)
src\roslyn\src\Analyzers\Core\Analyzers\SimplifyInterpolation\AbstractSimplifyInterpolationHelpers.cs (1)
143if (invocation.Arguments[0].Value is ILiteralOperation { ConstantValue: { HasValue: true, Value: string value } } literal &&
src\roslyn\src\Analyzers\Core\Analyzers\UseConditionalExpression\UseConditionalExpressionHelpers.cs (1)
118=> trueValue is ILiteralOperation { ConstantValue: { HasValue: true, Value: bool value } } && value == val;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (1)
381=> operand is ILiteralOperation { ConstantValue: { HasValue: true, Value: null } };
Microsoft.CodeAnalysis.CodeStyle.Fixes (4)
src\939a5660f39ce290\AbstractUseConditionalExpressionForAssignmentCodeFixProvider.cs (1)
242if (unwrapped is not ILiteralOperation and
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_Negate.cs (3)
419=> CanSimplifyToLengthEqualsZeroExpression(leftOperand, (ILiteralOperation)rightOperand), 421=> CanSimplifyToLengthEqualsZeroExpression(rightOperand, (ILiteralOperation)leftOperand), 434IOperation variableExpression, ILiteralOperation numericLiteralExpression)
Microsoft.CodeAnalysis.CSharp (1)
Operations\CSharpOperationFactory.cs (1)
681internal ILiteralOperation CreateBoundLiteralOperation(BoundLiteral boundLiteral, bool @implicit = false)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (2)
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordHelpers.cs (2)
703ReturnedValue: ILiteralOperation 887ReturnedValue: ILiteralOperation
Microsoft.CodeAnalysis.CSharp.Features (2)
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordHelpers.cs (2)
703ReturnedValue: ILiteralOperation 887ReturnedValue: ILiteralOperation
Microsoft.CodeAnalysis.Features (7)
InitializeParameter\AbstractAddParameterCheckCodeRefactoringProvider.cs (1)
321Value: ILiteralOperation value
src\939a5660f39ce290\AbstractUseConditionalExpressionForAssignmentCodeFixProvider.cs (1)
242if (unwrapped is not ILiteralOperation and
src\roslyn\src\Analyzers\Core\Analyzers\SimplifyInterpolation\AbstractSimplifyInterpolationHelpers.cs (1)
143if (invocation.Arguments[0].Value is ILiteralOperation { ConstantValue: { HasValue: true, Value: string value } } literal &&
src\roslyn\src\Analyzers\Core\Analyzers\UseConditionalExpression\UseConditionalExpressionHelpers.cs (1)
118=> trueValue is ILiteralOperation { ConstantValue: { HasValue: true, Value: bool value } } && value == val;
ValueTracking\ValueTracker.OperationCollector.cs (3)
30ILiteralOperation literalOperation => VisitLiteralAsync(literalOperation, cancellationToken), 153private Task VisitLiteralAsync(ILiteralOperation literalOperation, CancellationToken cancellationToken) 267if (argumentOperation.Value is ILiteralOperation)
Microsoft.CodeAnalysis.NetAnalyzers (42)
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\ImplementIDisposableCorrectly.cs (2)
493var literal = (ILiteralOperation)argument.Value;
Microsoft.CodeQuality.Analyzers\Maintainability\AvoidLengthCalculationWhenSlicingToEnd.cs (4)
91ILiteralOperation => false, 149else if (operation is ILiteralOperation { ConstantValue.Value: int } literalOperation) 286(ILiteralOperation literalRef1, ILiteralOperation literalRef2) => literalRef1.ConstantValue.HasValue && literalRef1.ConstantValue.Value!.Equals(literalRef2.ConstantValue.Value),
Microsoft.CodeQuality.Analyzers\QualityGuidelines\DoNotInitializeUnnecessarily.cs (1)
115if (value is not ILiteralOperation literal || !literal.ConstantValue.HasValue)
Microsoft.NetCore.Analyzers\InteropServices\PlatformCompatibilityAnalyzer.Value.cs (1)
72if (arguments.GetArgumentForParameterAtIndex(0).Value is ILiteralOperation literal)
Microsoft.NetCore.Analyzers\Performance\UseCountProperly.cs (9)
343if (negatedPattern.Pattern is IRelationalPatternOperation { OperatorKind: BinaryOperatorKind.GreaterThan, Value: ILiteralOperation { ConstantValue: { HasValue: true, Value: 0 } } } 344or IRelationalPatternOperation { OperatorKind: BinaryOperatorKind.GreaterThanOrEqual, Value: ILiteralOperation { ConstantValue: { HasValue: true, Value: 1 } } }) 352return negatedPattern.Pattern is IConstantPatternOperation { Value: ILiteralOperation { ConstantValue: { HasValue: true, Value: 0 } } } 353or IRelationalPatternOperation { OperatorKind: BinaryOperatorKind.LessThanOrEqual, Value: ILiteralOperation { ConstantValue: { HasValue: true, Value: 0 } } }; 357if (isPatternOperation.Pattern is IConstantPatternOperation { Value: ILiteralOperation { ConstantValue: { HasValue: true, Value: 0 } } }) 368if (relationalPattern is { OperatorKind: BinaryOperatorKind.LessThan, Value: ILiteralOperation { ConstantValue: { HasValue: true, Value: 1 } } } 369or { OperatorKind: BinaryOperatorKind.LessThanOrEqual, Value: ILiteralOperation { ConstantValue: { HasValue: true, Value: 0 } } }) 377return relationalPattern is { OperatorKind: BinaryOperatorKind.GreaterThan, Value: ILiteralOperation { ConstantValue: { HasValue: true, Value: 0 } } } 378or { OperatorKind: BinaryOperatorKind.GreaterThanOrEqual, Value: ILiteralOperation { ConstantValue: { HasValue: true, Value: 1 } } };
Microsoft.NetCore.Analyzers\Performance\UseSearchValues.cs (2)
311operation is ILiteralOperation or IFieldReferenceOperation or ILocalReferenceOperation && 353operation is not ILiteralOperation literal ||
Microsoft.NetCore.Analyzers\Performance\UseStringContainsCharOverloadWithSingleCharactersAnalyzer.cs (1)
87if (primaryArgument.Value is ILiteralOperation literalOperation
Microsoft.NetCore.Analyzers\Performance\UseStringMethodCharOverloadWithSingleCharacters.cs (1)
216if (argument.Value is ILiteralOperation literalOperation &&
Microsoft.NetCore.Analyzers\Runtime\AvoidConstArrays.cs (1)
112initializer.ElementValues.Any(x => x is not ILiteralOperation))
Microsoft.NetCore.Analyzers\Runtime\InstantiateArgumentExceptionsCorrectly.Fixer.cs (1)
119if (expression is ILiteralOperation literal &&
Microsoft.NetCore.Analyzers\Runtime\PreferConstCharOverConstUnitString.Fixer.cs (3)
38var literalOperation = argumentOperation.Value as ILiteralOperation; 103static async Task<Document> HandleStringLiteral(ILiteralOperation argumentLiteral, Document doc, SyntaxNode root, CancellationToken cancellationToken)
Microsoft.NetCore.Analyzers\Runtime\UseExceptionThrowHelpers.cs (6)
359arg.Value.WalkDownConversion() is ILiteralOperation { ConstantValue.HasValue: true } literal && 444right.WalkDownConversion() is ILiteralOperation literalOperation && 476if (binaryOperation.LeftOperand.WalkDownConversion() is ILiteralOperation { ConstantValue: { HasValue: true, Value: 0 } }) 484if (binaryOperation.RightOperand.WalkDownConversion() is ILiteralOperation { ConstantValue: { HasValue: true, Value: 0 } }) 496binaryOperation.RightOperand.WalkDownConversion() is ILiteralOperation { ConstantValue: { HasValue: true, Value: 0 } }) 509binaryOperation.LeftOperand.WalkDownConversion() is ILiteralOperation { ConstantValue: { HasValue: true, Value: 0 } })
Microsoft.NetCore.Analyzers\Runtime\UseSpanBasedStringConcat.cs (1)
90case SpecialType.System_Char when value is ILiteralOperation:
Microsoft.NetCore.Analyzers\Runtime\UseSpanBasedStringConcat.Fixer.cs (1)
140value is ILiteralOperation literalOperation &&
Microsoft.NetCore.Analyzers\Runtime\UseStringEqualsOverStringCompare.cs (3)
197return operation is ILiteralOperation literal && literal.ConstantValue.Value is 0; 208if (invocation!.Arguments.FirstOrDefault()?.Value is ILiteralOperation { ConstantValue.Value: 0 }) 272invocation.Arguments.GetArgumentForParameterAtIndex(2).Value is ILiteralOperation literal &&
Microsoft.NetCore.Analyzers\Runtime\UseStringEqualsOverStringCompare.Fixer.cs (2)
188var ignoreCaseLiteral = (ILiteralOperation)compareInvocation.Arguments.GetArgumentForParameterAtIndex(2).Value;
Microsoft.NetCore.Analyzers\Usage\ProvideHttpClientHandlerMaxResponseHeaderLengthValueCorrectly.cs (1)
98return operation.Value is IFieldReferenceOperation or ILiteralOperation or IBinaryOperation;
Microsoft.NetFramework.Analyzers\Helpers\SecurityDiagnosticHelpers.cs (2)
143return operation is ILiteralOperation literal && literal.HasNullConstantValue(); 154if (operation is not ILiteralOperation literal || !literal.ConstantValue.HasValue)
Microsoft.CodeAnalysis.ResxSourceGenerator (1)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (1)
381=> operand is ILiteralOperation { ConstantValue: { HasValue: true, Value: null } };
Microsoft.CodeAnalysis.Workspaces (4)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (1)
381=> operand is ILiteralOperation { ConstantValue: { HasValue: true, Value: null } };
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_Negate.cs (3)
419=> CanSimplifyToLengthEqualsZeroExpression(leftOperand, (ILiteralOperation)rightOperand), 421=> CanSimplifyToLengthEqualsZeroExpression(rightOperand, (ILiteralOperation)leftOperand), 434IOperation variableExpression, ILiteralOperation numericLiteralExpression)
Roslyn.Diagnostics.Analyzers (5)
AbstractDoNotCopyValue.cs (1)
901public override void VisitLiteral(ILiteralOperation operation)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (1)
381=> operand is ILiteralOperation { ConstantValue: { HasValue: true, Value: null } };
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_Negate.cs (3)
419=> CanSimplifyToLengthEqualsZeroExpression(leftOperand, (ILiteralOperation)rightOperand), 421=> CanSimplifyToLengthEqualsZeroExpression(rightOperand, (ILiteralOperation)leftOperand), 434IOperation variableExpression, ILiteralOperation numericLiteralExpression)
System.Text.RegularExpressions.Generator (1)
UpgradeToGeneratedRegexCodeFixer.cs (1)
401if (argument.Value is ILiteralOperation or IFieldReferenceOperation { Member: IFieldSymbol { IsConst: true } })