105 interfaces inheriting from IOperation
Microsoft.CodeAnalysis (105)
Generated\FlowAnalysis.Generated.cs (6)
26public interface IFlowCaptureOperation : IOperation 50public interface IFlowCaptureReferenceOperation : IOperation 76public interface IIsNullOperation : IOperation 95public interface ICaughtExceptionOperation : IOperation 112public interface IStaticLocalInitializationSemaphoreOperation : IOperation 139public interface IFlowAnonymousFunctionOperation : IOperation
Generated\Operations.Generated.cs (99)
36public interface IInvalidOperation : IOperation 57public interface IBlockOperation : IOperation 90public interface IVariableDeclarationGroupOperation : IOperation 118public interface ISwitchOperation : IOperation 151public interface ILoopOperation : IOperation 339public interface ILabeledOperation : IOperation 368public interface IBranchOperation : IOperation 396public interface IEmptyOperation : IOperation 419public interface IReturnOperation : IOperation 444public interface ILockOperation : IOperation 473public interface ITryOperation : IOperation 510public interface IUsingOperation : IOperation 548public interface IExpressionStatementOperation : IOperation 572public interface ILocalFunctionOperation : IOperation 610public interface IStopOperation : IOperation 630public interface IEndOperation : IOperation 650public interface IRaiseEventOperation : IOperation 683public interface ILiteralOperation : IOperation 704public interface IConversionOperation : IOperation 771public interface IInvocationOperation : IOperation 817public interface IArrayElementReferenceOperation : IOperation 846public interface ILocalReferenceOperation : IOperation 876public interface IParameterReferenceOperation : IOperation 897public interface IMemberReferenceOperation : IOperation 1052public interface IUnaryOperation : IOperation 1102public interface IBinaryOperation : IOperation 1165public interface IConditionalOperation : IOperation 1209public interface ICoalesceOperation : IOperation 1245public interface IAnonymousFunctionOperation : IOperation 1274public interface IObjectCreationOperation : IOperation 1311public interface ITypeParameterObjectCreationOperation : IOperation 1336public interface IArrayCreationOperation : IOperation 1367public interface IInstanceReferenceOperation : IOperation 1392public interface IIsTypeOperation : IOperation 1427public interface IAwaitOperation : IOperation 1448public interface IAssignmentOperation : IOperation 1552public interface IParenthesizedOperation : IOperation 1577public interface IEventAssignmentOperation : IOperation 1611public interface IConditionalAccessOperation : IOperation 1642public interface IConditionalAccessInstanceOperation : IOperation 1661public interface IInterpolatedStringOperation : IOperation 1686public interface IAnonymousObjectCreationOperation : IOperation 1719public interface IObjectOrCollectionInitializerOperation : IOperation 1750public interface IMemberInitializerOperation : IOperation 1778public interface ICollectionElementInitializerOperation : IOperation 1802public interface INameOfOperation : IOperation 1827public interface ITupleOperation : IOperation 1858public interface IDynamicObjectCreationOperation : IOperation 1887public interface IDynamicMemberReferenceOperation : IOperation 1939public interface IDynamicInvocationOperation : IOperation 1967public interface IDynamicIndexerAccessOperation : IOperation 2001public interface ITranslatedQueryOperation : IOperation 2026public interface IDelegateCreationOperation : IOperation 2050public interface IDefaultValueOperation : IOperation 2071public interface ITypeOfOperation : IOperation 2095public interface ISizeOfOperation : IOperation 2119public interface IAddressOfOperation : IOperation 2143public interface IIsPatternOperation : IOperation 2174public interface IIncrementOrDecrementOperation : IOperation 2224public interface IThrowOperation : IOperation 2277public interface IDeclarationExpressionOperation : IOperation 2301public interface IOmittedArgumentOperation : IOperation 2318public interface ISymbolInitializerOperation : IOperation 2443public interface IArrayInitializerOperation : IOperation 2472public interface IVariableDeclaratorOperation : IOperation 2517public interface IVariableDeclarationOperation : IOperation 2558public interface IArgumentOperation : IOperation 2599public interface ICatchClauseOperation : IOperation 2644public interface ISwitchCaseOperation : IOperation 2673public interface ICaseClauseOperation : IOperation 2810public interface IInterpolatedStringContentOperation : IOperation 2884public interface IPatternOperation : IOperation 2971public interface ITupleBinaryOperation : IOperation 2999public interface IMethodBodyBaseOperation : IOperation 3077public interface IDiscardOperation : IOperation 3126public interface IRangeOperation : IOperation 3166public interface IReDimOperation : IOperation 3194public interface IReDimClauseOperation : IOperation 3278public interface ISwitchExpressionOperation : IOperation 3304public interface ISwitchExpressionArmOperation : IOperation 3335public interface IPropertySubpatternOperation : IOperation 3354internal interface IAggregateQueryOperation : IOperation 3366internal interface IFixedOperation : IOperation 3395internal interface INoPiaObjectCreationOperation : IOperation 3410internal interface IPlaceholderOperation : IOperation 3427internal interface IPointerIndirectionReferenceOperation : IOperation 3447internal interface IWithStatementOperation : IOperation 3476public interface IUsingDeclarationOperation : IOperation 3612public interface IWithOperation : IOperation 3638public interface IInterpolatedStringHandlerCreationOperation : IOperation 3679public interface IInterpolatedStringAdditionOperation : IOperation 3724public interface IInterpolatedStringHandlerArgumentPlaceholderOperation : IOperation 3747public interface IFunctionPointerInvocationOperation : IOperation 3829public interface IImplicitIndexerReferenceOperation : IOperation 3865public interface IUtf8StringOperation : IOperation 3890public interface IAttributeOperation : IOperation 3914public interface IInlineArrayAccessOperation : IOperation 3942public interface ICollectionExpressionOperation : IOperation 3980public interface ISpreadOperation : IOperation
1 implementation of IOperation
Microsoft.CodeAnalysis (1)
Operations\Operation.cs (1)
18internal abstract partial class Operation : IOperation
3190 references to IOperation
ConfigurationSchemaGenerator (1)
RuntimeSource\Configuration.Binder\Parser\ConfigurationBinder.cs (1)
103static ITypeSymbol? ResolveType(IOperation conversionOperation) =>
ILLink.RoslynAnalyzer (86)
DataFlow\BasicBlockExtensions.cs (4)
12 public static IEnumerable<IOperation> DescendantOperations (this BasicBlock basicBlock) 14 foreach (var statement in basicBlock.Operations) { 15 foreach (var operation in statement.DescendantsAndSelf ()) { 21 foreach (var operation in basicBlock.BranchValue.DescendantsAndSelf ()) {
DataFlow\CapturedReferenceValue.cs (2)
13 public readonly IOperation Reference; 15 public CapturedReferenceValue (IOperation operation)
DataFlow\ControlFlowGraphExtensions.cs (2)
29 public static IEnumerable<IOperation> DescendantOperations (this ControlFlowGraph cfg) 33 where T : IOperation
DataFlow\FeatureChecksVisitor.cs (2)
36 public override FeatureChecksValue DefaultVisit (IOperation operation, StateValue state) 80 public static bool? GetLiteralBool (IOperation operation)
DataFlow\LocalDataFlowAnalysis.cs (2)
39 readonly IOperation OperationBlock; 56 IOperation operationBlock,
DataFlow\LocalDataFlowVisitor.cs (16)
82 foreach (IOperation operation in block.Block.Operations) 86 IOperation? branchValueOperation = block.Block.BranchValue; 128 IOperation branchValueOperation, 138 IOperation operation, 141 public abstract TValue HandleArrayElementRead (TValue arrayValue, TValue indexValue, IOperation operation); 143 public abstract void HandleArrayElementWrite (TValue arrayValue, TValue indexValue, TValue valueToWrite, IOperation operation, bool merge); 149 IOperation operation, 154 IOperation branchValueOperation); 166 IOperation operation, 174 TValue ProcessBinderCall (IOperation operation, string methodName, LocalDataFlowState<TValue, TContext, TValueLattice, TContextLattice> state) { 238 TValue ProcessSingleTargetAssignment (IOperation targetOperation, IAssignmentOperation operation, LocalDataFlowState<TValue, TContext, TValueLattice, TContextLattice> state, bool merge) 387 var targetOperation = operation.Target; 595 public abstract TValue HandleDelegateCreation (IMethodSymbol methodReference, IOperation operation, in TContext context); 727 IOperation operation, 800 IOperation operation, 802 IOperation? instance,
DataFlow\OperationWalker.cs (4)
14 private void VisitChildOperations (IOperation operation, TArgument argument) 16 foreach (var child in operation.ChildOperations) 20 public override TResult? Visit (IOperation? operation, TArgument argument) 34 public override TResult? DefaultVisit (IOperation operation, TArgument argument)
DataFlow\UnexpectedOperationHandler.cs (2)
18 public static void Handle (IOperation operation) 37 foreach (var descendant in operation.Descendants()) {
DynamicallyAccessedMembersAnalyzer.cs (1)
103 foreach (var operationBlock in context.OperationBlocks) {
IOperationExtensions.cs (8)
17 public static ValueUsageInfo GetValueUsageInfo (this IOperation operation, ISymbol containingSymbol) 181 public static IMethodSymbol? TryGetContainingAnonymousFunctionOrLocalFunction (this IOperation? operation) 199 public static bool IsInLeftOfDeconstructionAssignment (this IOperation operation, out IDeconstructionAssignmentOperation? deconstructionAssignment) 203 var previousOperation = operation; 204 var current = operation.Parent; 233 public static bool IsAnyCompoundAssignment (this IOperation operation) 252 public static ISymbol FindContainingSymbol (this IOperation operation, ISymbol owningSymbol) 254 var parent = operation.Parent;
RequiresAnalyzerBase.cs (2)
204 var parent = operationContext.Operation.Parent; 346 IOperation operation,
TrimAnalysis\FeatureCheckReturnValuePattern.cs (2)
18 public IOperation Operation { get; init; } 24 IOperation operation,
TrimAnalysis\HandleCallAction.cs (2)
26 readonly IOperation _operation; 33 IOperation operation,
TrimAnalysis\TrimAnalysisAssignmentPattern.cs (2)
22 public IOperation Operation { get; init; } 29 IOperation operation,
TrimAnalysis\TrimAnalysisGenericInstantiationPattern.cs (2)
15 public IOperation Operation { get; init; } 21 IOperation operation,
TrimAnalysis\TrimAnalysisMethodCallPattern.cs (2)
21 public IOperation Operation { get; init; } 29 IOperation operation,
TrimAnalysis\TrimAnalysisPatternStore.cs (12)
15 readonly Dictionary<IOperation, TrimAnalysisAssignmentPattern> AssignmentPatterns; 16 readonly Dictionary<IOperation, TrimAnalysisFieldAccessPattern> FieldAccessPatterns; 17 readonly Dictionary<IOperation, TrimAnalysisGenericInstantiationPattern> GenericInstantiationPatterns; 18 readonly Dictionary<IOperation, TrimAnalysisMethodCallPattern> MethodCallPatterns; 19 readonly Dictionary<IOperation, TrimAnalysisReflectionAccessPattern> ReflectionAccessPatterns; 20 readonly Dictionary<IOperation, FeatureCheckReturnValuePattern> FeatureCheckReturnValuePatterns; 28 AssignmentPatterns = new Dictionary<IOperation, TrimAnalysisAssignmentPattern> (); 29 FieldAccessPatterns = new Dictionary<IOperation, TrimAnalysisFieldAccessPattern> (); 30 GenericInstantiationPatterns = new Dictionary<IOperation, TrimAnalysisGenericInstantiationPattern> (); 31 MethodCallPatterns = new Dictionary<IOperation, TrimAnalysisMethodCallPattern> (); 32 ReflectionAccessPatterns = new Dictionary<IOperation, TrimAnalysisReflectionAccessPattern> (); 33 FeatureCheckReturnValuePatterns = new Dictionary<IOperation, FeatureCheckReturnValuePattern> ();
TrimAnalysis\TrimAnalysisReflectionAccessPattern.cs (2)
15 public IOperation Operation { get; init; } 21 IOperation operation,
TrimAnalysis\TrimAnalysisVisitor.cs (13)
62 public override FeatureChecksValue GetConditionValue (IOperation branchValueOperation, StateValue state) 78 public override MultiValue DefaultVisit (IOperation operation, StateValue argument) 232 public override void HandleAssignment (MultiValue source, MultiValue target, IOperation operation, in FeatureContext featureContext) 244 public override MultiValue HandleArrayElementRead (MultiValue arrayValue, MultiValue indexValue, IOperation operation) 259 public override void HandleArrayElementWrite (MultiValue arrayValue, MultiValue indexValue, MultiValue valueToWrite, IOperation operation, bool merge) 281 IOperation operation, 318 IOperation operation, 340 public override void HandleReturnValue (MultiValue returnValue, IOperation operation, in FeatureContext featureContext) 355 public override void HandleReturnConditionValue (FeatureChecksValue returnConditionValue, IOperation operation) 378 public override MultiValue HandleDelegateCreation (IMethodSymbol method, IOperation operation, in FeatureContext featureContext) 392 private void ProcessGenericArgumentDataFlow (IMethodSymbol method, IOperation operation, in FeatureContext featureContext) 409 private void ProcessGenericArgumentDataFlow (IFieldSymbol field, IOperation operation, in FeatureContext featureContext) 425 static bool TryGetConstantValue (IOperation operation, out MultiValue constValue)
TrimAnalysis\TrimDataFlowAnalysis.cs (4)
43 IOperation operationBlock) 93 if (block.Block.Operations.FirstOrDefault () is not IOperation op) 115 if (block.Block.Operations.FirstOrDefault () is IOperation firstBlockOp) { 117 } else if (block.Block.BranchValue is IOperation branchOp) {
Microsoft.Analyzers.Extra (19)
AsyncCallInsideUsingBlockAnalyzer.cs (3)
73IOperation block) 153private static bool IsTaskAwaited(IOperation block, ILocalSymbol taskSymbol) 182private static bool ReferencesSymbol(IOperation? operation, ILocalSymbol symbol)
CallAnalysis\Fixers\LegacyLoggingFixer.cs (8)
41internal Func<SemanticModel, SyntaxNode, CancellationToken, IOperation?> GetOperation = (sm, sn, t) => sm.GetOperation(sn, t); 392foreach (var o in details.InterpolationArgs) 402foreach (var e in arrayCreation.Initializer!.ElementValues) 441foreach (var a in details.InterpolationArgs) 451foreach (var e in arrayCreation.Initializer!.ElementValues) 453foreach (var d in e.Descendants()) 500foreach (var a in details.InterpolationArgs) 507foreach (var e in arrayCreation.Initializer!.ElementValues)
CallAnalysis\Fixers\LegacyLoggingFixer.FixDetails.cs (5)
32public IReadOnlyList<IOperation>? InterpolationArgs { get; } 54var interpolationArgs = new List<IOperation>(); 61foreach (var o in children[0].ChildOperations) 70var operation = intOp.ChildOperations.First(); 106var op = invocationOp.Arguments[LogLevelParamIndex].Descendants().SingleOrDefault(x => x.Kind == OperationKind.Literal || x.Kind == OperationKind.FieldReference);
Utilities\OperationExtensions.cs (3)
17public static IEnumerable<IOperation> Ancestors(this IOperation operationToStart, IOperation parent)
Microsoft.AspNetCore.Analyzers (1)
CompilationFeatureDetector.cs (1)
42var operation = semanticModel.GetOperation(syntax, cancellationToken);
Microsoft.AspNetCore.App.Analyzers (30)
Authorization\AddAuthorizationBuilderAnalyzer.cs (3)
143private static bool DoesOperationInvolveAuthorizationOptions(IOperation operation, AuthorizationOptionsTypes authorizationOptionsTypes) 172private static bool UsesAuthorizationOptionsSpecificGetters(IOperation operation, AuthorizationOptionsTypes authorizationOptionsTypes) 204private static bool UsesAuthorizationOptionsGetPolicy(IOperation operation, AuthorizationOptionsTypes authorizationOptionsTypes)
Http\RequestDelegateReturnTypeAnalyzer.cs (4)
53foreach (var item in anonymousFunction.Body.Descendants()) 58var resolvedOperation = WalkDownConversion(returnedValue); 84private static IOperation WalkDownConversion(IOperation operation)
Kestrel\ListenOnIPv6AnyAnalyzer.cs (2)
41var nodeOperation = context.SemanticModel.GetOperation(context.Node, context.CancellationToken); 108private static bool IsKestrelServerOptionsType(IOperation? operation, out IInvocationOperation? kestrelOptionsListenInvocation)
RouteHandlers\DetectAmbiguousRoutes.cs (14)
48private static IOperation? ResolveOperation(IOperation operation, WellKnownTypes wellKnownTypes) 61var current = operation; 146public IOperation? ParentOperation { get; } 147public IOperation? Builder { get; } 151public MapOperationGroupKey(IOperation? builder, IOperation parentOperation, RoutePatternTree routePattern, ImmutableArray<string> httpMethods) 180static bool AreBuildersEqual(IOperation builder, IOperation? other) 239var argument1 = GetParameterArgument(method.Parameters[i], arguments1); 240var argument2 = GetParameterArgument(method.Parameters[i], arguments2); 271static IOperation? GetParameterArgument(IParameterSymbol parameter, ImmutableArray<IArgumentOperation> arguments) 285private static IOperation WalkDownConversion(IOperation operation)
RouteHandlers\DetectMisplacedLambdaAttribute.cs (1)
73foreach (var op in Enumerable.Reverse(blockOperation.ChildOperations))
RouteHandlers\DisallowReturningActionResultFromMapMethods.cs (1)
61var returnedValue = returnOperation.ReturnedValue;
RouteHandlers\RouteHandlerAnalyzer.cs (5)
128var methodOperation = syntaxNode.SyntaxTree == invocation.SemanticModel!.SyntaxTree 221private record struct MapOperation(IOperation? Builder, IInvocationOperation Operation, RouteUsageModel RouteUsageModel) 225IOperation? builder = null; 236private static IOperation WalkDownConversion(IOperation operation)
Microsoft.AspNetCore.Components.Analyzers (1)
ComponentParameterUsageAnalyzer.cs (1)
41IOperation leftHandSide;
Microsoft.AspNetCore.Components.SdkAnalyzers (1)
ComponentParameterUsageAnalyzer.cs (1)
41IOperation leftHandSide;
Microsoft.AspNetCore.Http.RequestDelegateGenerator (7)
RequestDelegateGenerator.cs (1)
26var operation = context.SemanticModel.GetOperation(context.Node, token);
RequestDelegateGeneratorSuppressor.cs (1)
71var operation = semanticModel.GetOperation(node, context.CancellationToken);
StaticRouteHandlerModel\InvocationOperationExtensions.cs (5)
26public static bool IsValidOperation(this IOperation? operation, WellKnownTypes wellKnownTypes, [NotNullWhen(true)] out IInvocationOperation? invocationOperation) 83private static IMethodSymbol? ResolveMethodFromOperation(IOperation operation, SemanticModel semanticModel) => operation switch 88IFieldReferenceOperation { Field.IsReadOnly: true } f when ResolveDeclarationOperation(f.Field, semanticModel) is IOperation op => 97private static IOperation? ResolveDeclarationOperation(ISymbol symbol, SemanticModel? semanticModel) 113var operation = targetSemanticModel?.GetOperation(expr);
Microsoft.AspNetCore.Mvc.Analyzers (2)
TagHelpersInCodeBlocksAnalyzer.cs (2)
60var parent = context.Operation.Parent; 113private static bool IsParentMethod(IOperation operation)
Microsoft.AspNetCore.Mvc.Api.Analyzers (15)
ActualApiResponseMetadataFactory.cs (5)
64var returnedValue = armOperation?.Value ?? returnOperation.ReturnedValue; 162foreach (var child in initializer.Initializers) 209var operation = argument.Value; 225IOperation operation, 305var parent = operation.Parent;
ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzer.cs (10)
51var parent = ifOperation.Parent; 69var trueStatement = UnwrapSingleStatementBlock(ifOperation.WhenTrue); 95var returnValue = returnOperation.ReturnedValue; 129private static bool IsModelStateIsValidCheck(in ApiControllerSymbolCache symbolCache, IOperation condition) 134var operation = ((IUnaryOperation)condition).Operand; 160IOperation operation, 161IOperation otherOperation, 180private static bool IsModelStateIsValidPropertyAccessor(in ApiControllerSymbolCache symbolCache, IOperation operation) 213private static IOperation UnwrapSingleStatementBlock(IOperation statement)
Microsoft.CodeAnalysis (1411)
Compilation\Compilation.cs (1)
1759internal abstract IConvertibleConversion ClassifyConvertibleConversion(IOperation source, ITypeSymbol destination, out ConstantValue? constantValue);
Compilation\SemanticModel.cs (2)
76public IOperation? GetOperation(SyntaxNode node, CancellationToken cancellationToken = default(CancellationToken)) 81protected abstract IOperation? GetOperationCore(SyntaxNode node, CancellationToken cancellationToken);
DiagnosticAnalyzer\AnalysisContextInfo.cs (4)
17private readonly IOperation? _operation; 47public AnalysisContextInfo(Compilation compilation, IOperation operation) : 59IOperation? operation, 85sb.AppendLine($"{nameof(IOperation)}: {_operation.Kind}");
DiagnosticAnalyzer\AnalyzerDriver.cs (15)
2716ImmutableArray<IOperation> getOperationsToAnalyzeWithStackGuard(ImmutableArray<IOperation> operationBlocksToAnalyze) 2728return ImmutableArray<IOperation>.Empty; 2732void executeOperationsActions(ImmutableArray<IOperation> operationsToAnalyze) 2741void executeOperationsActionsByKind(ImmutableArray<IOperation> operationsToAnalyze, GroupedAnalyzerActions groupedActions, bool arePerSymbolActions) 2767void executeOperationsBlockActions(ImmutableArray<IOperation> operationBlocksToAnalyze, ImmutableArray<IOperation> operationsToAnalyze, IEnumerable<ExecutableCodeBlockAnalyzerActions> codeBlockActions) 2915private static ImmutableArray<IOperation> GetOperationBlocksToAnalyze( 2920ArrayBuilder<IOperation> operationBlocksToAnalyze = ArrayBuilder<IOperation>.GetInstance(); 2933private static ImmutableArray<IOperation> GetOperationsToAnalyze( 2934ImmutableArray<IOperation> operationBlocks) 2936ArrayBuilder<IOperation> operationsToAnalyze = ArrayBuilder<IOperation>.GetInstance(); 2939foreach (IOperation operationBlock in operationBlocks)
DiagnosticAnalyzer\AnalyzerExecutor.cs (22)
54private Func<IOperation, ControlFlowGraph>? _lazyGetControlFlowGraph; 56private ConcurrentDictionary<IOperation, ControlFlowGraph>? _lazyControlFlowGraphMap; 58private Func<IOperation, ControlFlowGraph> GetControlFlowGraph 663IOperation operation, 732ImmutableArray<IOperation> operationBlocks, 733ImmutableArray<IOperation> operations, 739ExecuteBlockActionsCore<OperationBlockStartAnalyzerAction, OperationBlockAnalyzerAction, OperationAnalyzerAction, IOperation, int>( 783ImmutableArray<IOperation> operationBlocks = executableBlocks[0] is IOperation ? (ImmutableArray<IOperation>)(object)executableBlocks : ImmutableArray<IOperation>.Empty; 858var operationsToAnalyze = (IEnumerable<IOperation>)getNodesToAnalyze(executableBlocks); 877ImmutableArray<IOperation> operationBlocks, 1057IEnumerable<IOperation> operationsToAnalyze, 1082IEnumerable<IOperation> operationsToAnalyze, 1099foreach (var operation in operationsToAnalyze) 1477private bool ShouldExecuteOperation(IOperation operation, DiagnosticAnalyzer analyzer, CancellationToken cancellationToken) 1500private ControlFlowGraph GetControlFlowGraphImpl(IOperation operation) 1506Interlocked.CompareExchange(ref _lazyControlFlowGraphMap, new ConcurrentDictionary<IOperation, ControlFlowGraph>(), null); 1526public void OnOperationBlockActionsExecuted(ImmutableArray<IOperation> operationBlocks) 1535foreach (var operationBlock in operationBlocks) 1537var root = operationBlock.GetRootOperation();
DiagnosticAnalyzer\DiagnosticAnalysisContext.cs (54)
177/// Register an action to be executed at completion of semantic analysis of an <see cref="IOperation"/> with an appropriate Kind. 178/// An operation action can report <see cref="Diagnostic"/>s about <see cref="IOperation"/>s, and can also collect 181/// <param name="action">Action to be executed at completion of semantic analysis of an <see cref="IOperation"/>.</param> 182/// <param name="operationKinds">Action will be executed only if an <see cref="IOperation"/>'s Kind matches one of the operation kind values.</param> 189/// Register an action to be executed at completion of semantic analysis of an <see cref="IOperation"/> with an appropriate Kind. 190/// An operation action can report <see cref="Diagnostic"/>s about <see cref="IOperation"/>s, and can also collect 193/// <param name="action">Action to be executed at completion of semantic analysis of an <see cref="IOperation"/>.</param> 194/// <param name="operationKinds">Action will be executed only if an <see cref="IOperation"/>'s Kind matches one of the operation kind values.</param> 472/// Register an action to be executed at completion of semantic analysis of an <see cref="IOperation"/> with an appropriate Kind. 473/// An operation action can report <see cref="Diagnostic"/>s about <see cref="IOperation"/>s, and can also collect 476/// <param name="action">Action to be executed at completion of semantic analysis of an <see cref="IOperation"/>.</param> 477/// <param name="operationKinds">Action will be executed only if an <see cref="IOperation"/>'s Kind matches one of the operation kind values.</param> 484/// Register an action to be executed at completion of semantic analysis of an <see cref="IOperation"/> with an appropriate Kind. 485/// An operation action can report <see cref="Diagnostic"/>s about <see cref="IOperation"/>s, and can also collect 488/// <param name="action">Action to be executed at completion of semantic analysis of an <see cref="IOperation"/>.</param> 489/// <param name="operationKinds">Action will be executed only if an <see cref="IOperation"/>'s Kind matches one of the operation kind values.</param> 984/// Register an action to be executed at completion of semantic analysis of an <see cref="IOperation"/> with an appropriate Kind. 985/// An operation action can report <see cref="Diagnostic"/>s about <see cref="IOperation"/>s, and can also collect 988/// <param name="action">Action to be executed at completion of semantic analysis of an <see cref="IOperation"/>.</param> 989/// <param name="operationKinds">Action will be executed only if an <see cref="IOperation"/>'s Kind matches one of the operation kind values.</param> 996/// Register an action to be executed at completion of semantic analysis of an <see cref="IOperation"/> with an appropriate Kind. 997/// An operation action can report <see cref="Diagnostic"/>s about <see cref="IOperation"/>s, and can also collect 1000/// <param name="action">Action to be executed at completion of semantic analysis of an <see cref="IOperation"/>.</param> 1001/// <param name="operationKinds">Action will be executed only if an <see cref="IOperation"/>'s Kind matches one of the operation kind values.</param> 1236private readonly ImmutableArray<IOperation> _operationBlocks; 1240private readonly Func<IOperation, ControlFlowGraph>? _getControlFlowGraph; 1249public ImmutableArray<IOperation> OperationBlocks => _operationBlocks; 1290ImmutableArray<IOperation> operationBlocks, 1301ImmutableArray<IOperation> operationBlocks, 1305Func<IOperation, ControlFlowGraph>? getControlFlowGraph, 1331/// An operation action can report <see cref="Diagnostic"/>s about <see cref="IOperation"/>s, and can also collect 1334/// <param name="action">Action to be executed at completion of semantic analysis of an <see cref="IOperation"/>.</param> 1335/// <param name="operationKinds">Action will be executed only if an <see cref="IOperation"/>'s Kind matches one of the operation kind values.</param> 1342/// Register an action to be executed at completion of semantic analysis of an <see cref="IOperation"/> with an appropriate Kind. 1343/// An operation action can report <see cref="Diagnostic"/>s about <see cref="IOperation"/>s, and can also collect 1346/// <param name="action">Action to be executed at completion of semantic analysis of an <see cref="IOperation"/>.</param> 1347/// <param name="operationKinds">Action will be executed only if an <see cref="IOperation"/>'s Kind matches one of the operation kind values.</param> 1354public ControlFlowGraph GetControlFlowGraph(IOperation operationBlock) 1376private readonly ImmutableArray<IOperation> _operationBlocks; 1382private readonly Func<IOperation, ControlFlowGraph>? _getControlFlowGraph; 1391public ImmutableArray<IOperation> OperationBlocks => _operationBlocks; 1432ImmutableArray<IOperation> operationBlocks, 1445ImmutableArray<IOperation> operationBlocks, 1451Func<IOperation, ControlFlowGraph>? getControlFlowGraph, 1487public ControlFlowGraph GetControlFlowGraph(IOperation operationBlock) 1766/// An operation action can use an <see cref="OperationAnalysisContext"/> to report <see cref="Diagnostic"/>s for an <see cref="IOperation"/>. 1770private readonly IOperation _operation; 1776private readonly Func<IOperation, ControlFlowGraph>? _getControlFlowGraph; 1780/// <see cref="IOperation"/> that is the subject of the analysis. 1782public IOperation Operation => _operation; 1790/// <see cref="CodeAnalysis.Compilation"/> containing the <see cref="IOperation"/>. 1823IOperation operation, 1835IOperation operation, 1841Func<IOperation, ControlFlowGraph>? getControlFlowGraph,
DiagnosticAnalyzer\DiagnosticAnalysisContextHelpers.cs (3)
171internal static ControlFlowGraph GetControlFlowGraph(IOperation operation, Func<IOperation, ControlFlowGraph>? getControlFlowGraph, CancellationToken cancellationToken) 173IOperation rootOperation = operation.GetRootOperation();
DiagnosticAnalyzer\DiagnosticStartAnalysisScope.cs (2)
327ImmutableArray<IOperation> operationBlocks, 331Func<IOperation, ControlFlowGraph> getControlFlowGraph,
Generated\FlowAnalysis.Generated.cs (2)
35IOperation Value { get; } 81IOperation Operand { get; }
Generated\OperationKind.Generated.cs (1)
17/// <summary>Indicates an <see cref="IOperation"/> for a construct that is not implemented yet.</summary>
Generated\Operations.Generated.cs (618)
62ImmutableArray<IOperation> Operations { get; } 127IOperation Value { get; } 160IOperation Body { get; } 193IOperation LoopControlVariable { get; } 197IOperation Collection { get; } 202ImmutableArray<IOperation> NextVariables { get; } 227ImmutableArray<IOperation> Before { get; } 237IOperation? Condition { get; } 241ImmutableArray<IOperation> AtLoopBottom { get; } 261IOperation LoopControlVariable { get; } 265IOperation InitialValue { get; } 269IOperation LimitValue { get; } 274IOperation StepValue { get; } 282ImmutableArray<IOperation> NextVariables { get; } 303IOperation? Condition { get; } 319IOperation? IgnoredCondition { get; } 348IOperation? Operation { get; } 424IOperation? ReturnedValue { get; } 449IOperation LockedValue { get; } 453IOperation Body { get; } 515IOperation Resources { get; } 519IOperation Body { get; } 553IOperation Operation { get; } 709IOperation Operand { get; } 785IOperation? Instance { get; } 822IOperation ArrayReference { get; } 826ImmutableArray<IOperation> Indices { get; } 902IOperation? Instance { get; } 1061IOperation Operand { get; } 1111IOperation LeftOperand { get; } 1115IOperation RightOperand { get; } 1170IOperation Condition { get; } 1174IOperation WhenTrue { get; } 1178IOperation? WhenFalse { get; } 1214IOperation Value { get; } 1218IOperation WhenNull { get; } 1341ImmutableArray<IOperation> DimensionSizes { get; } 1397IOperation ValueOperand { get; } 1432IOperation Operation { get; } 1453IOperation Target { get; } 1457IOperation Value { get; } 1557IOperation Operand { get; } 1582IOperation EventReference { get; } 1586IOperation HandlerValue { get; } 1616IOperation Operation { get; } 1620IOperation WhenNotNull { get; } 1693ImmutableArray<IOperation> Initializers { get; } 1724ImmutableArray<IOperation> Initializers { get; } 1755IOperation InitializedMember { get; } 1781ImmutableArray<IOperation> Arguments { get; } 1807IOperation Argument { get; } 1832ImmutableArray<IOperation> Elements { get; } 1835/// Natural type can be different from <see cref="IOperation.Type" /> depending on the 1867ImmutableArray<IOperation> Arguments { get; } 1892IOperation? Instance { get; } 1944IOperation Operation { get; } 1948ImmutableArray<IOperation> Arguments { get; } 1972IOperation Operation { get; } 1976ImmutableArray<IOperation> Arguments { get; } 2006IOperation Operation { get; } 2031IOperation Target { get; } 2124IOperation Reference { get; } 2148IOperation Value { get; } 2194IOperation Target { get; } 2229IOperation? Exception { get; } 2282IOperation Expression { get; } 2327IOperation Value { get; } 2448ImmutableArray<IOperation> ElementValues { get; } 2491ImmutableArray<IOperation> IgnoredArguments { get; } 2538ImmutableArray<IOperation> IgnoredDimensions { get; } 2571IOperation Value { get; } 2608IOperation? ExceptionDeclarationOrExpression { get; } 2620IOperation? Filter { get; } 2653ImmutableArray<IOperation> Body { get; } 2725IOperation? Guard { get; } 2745IOperation MinimumValue { get; } 2749IOperation MaximumValue { get; } 2769IOperation Value { get; } 2794IOperation Value { get; } 2836IOperation Text { get; } 2861IOperation Expression { get; } 2865IOperation? Alignment { get; } 2869IOperation? FormatString { get; } 2917IOperation Value { get; } 2980IOperation LeftOperand { get; } 2984IOperation RightOperand { get; } 3058IOperation? Initializer { get; } 3131IOperation? LeftOperand { get; } 3135IOperation? RightOperand { get; } 3199IOperation Operand { get; } 3203ImmutableArray<IOperation> DimensionSizes { get; } 3283IOperation Value { get; } 3313IOperation? Guard { get; } 3317IOperation Value { get; } 3341IOperation Member { get; } 3356IOperation Group { get; } 3357IOperation Aggregation { get; } 3379IOperation Body { get; } 3432IOperation Pointer { get; } 3452IOperation Body { get; } 3456IOperation Value { get; } 3593IOperation Value { get; } 3617IOperation Operand { get; } 3644IOperation HandlerCreation { get; } 3666IOperation Content { get; } 3685IOperation Left { get; } 3690IOperation Right { get; } 3711IOperation AppendCall { get; } 3752IOperation Target { get; } 3834IOperation Instance { get; } 3838IOperation Argument { get; } 3895IOperation Operation { get; } 3919IOperation Instance { get; } 3923IOperation Argument { get; } 3961ImmutableArray<IOperation> Elements { get; } 3985IOperation Operand { get; } 4001internal BlockOperation(ImmutableArray<IOperation> operations, ImmutableArray<ILocalSymbol> locals, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 4007public ImmutableArray<IOperation> Operations { get; } 4011internal override IOperation GetCurrent(int slot, int index) 4066internal override IOperation GetCurrent(int slot, int index) 4113internal SwitchOperation(ImmutableArray<ILocalSymbol> locals, IOperation value, ImmutableArray<ISwitchCaseOperation> cases, ILabelSymbol exitLabel, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 4122public IOperation Value { get; } 4128internal override IOperation GetCurrent(int slot, int index) 4183protected BaseLoopOperation(IOperation body, ImmutableArray<ILocalSymbol> locals, ILabelSymbol continueLabel, ILabelSymbol exitLabel, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 4192public IOperation Body { get; } 4199internal ForEachLoopOperation(IOperation loopControlVariable, IOperation collection, ImmutableArray<IOperation> nextVariables, ForEachLoopOperationInfo? info, bool isAsynchronous, IOperation body, ImmutableArray<ILocalSymbol> locals, ILabelSymbol continueLabel, ILabelSymbol exitLabel, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 4208public IOperation LoopControlVariable { get; } 4209public IOperation Collection { get; } 4210public ImmutableArray<IOperation> NextVariables { get; } 4218internal override IOperation GetCurrent(int slot, int index) 4289internal ForLoopOperation(ImmutableArray<IOperation> before, ImmutableArray<ILocalSymbol> conditionLocals, IOperation? condition, ImmutableArray<IOperation> atLoopBottom, IOperation body, ImmutableArray<ILocalSymbol> locals, ILabelSymbol continueLabel, ILabelSymbol exitLabel, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 4297public ImmutableArray<IOperation> Before { get; } 4299public IOperation? Condition { get; } 4300public ImmutableArray<IOperation> AtLoopBottom { get; } 4306internal override IOperation GetCurrent(int slot, int index) 4381internal ForToLoopOperation(IOperation loopControlVariable, IOperation initialValue, IOperation limitValue, IOperation stepValue, bool isChecked, ImmutableArray<IOperation> nextVariables, (ILocalSymbol LoopObject, ForToLoopOperationUserDefinedInfo UserDefinedInfo) info, IOperation body, ImmutableArray<ILocalSymbol> locals, ILabelSymbol continueLabel, ILabelSymbol exitLabel, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 4392public IOperation LoopControlVariable { get; } 4393public IOperation InitialValue { get; } 4394public IOperation LimitValue { get; } 4395public IOperation StepValue { get; } 4397public ImmutableArray<IOperation> NextVariables { get; } 4406internal override IOperation GetCurrent(int slot, int index) 4493internal WhileLoopOperation(IOperation? condition, bool conditionIsTop, bool conditionIsUntil, IOperation? ignoredCondition, IOperation body, ImmutableArray<ILocalSymbol> locals, ILabelSymbol continueLabel, ILabelSymbol exitLabel, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 4501public IOperation? Condition { get; } 4504public IOperation? IgnoredCondition { get; } 4517internal LabeledOperation(ILabelSymbol label, IOperation? operation, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 4524public IOperation? Operation { get; } 4527internal override IOperation GetCurrent(int slot, int index) 4579internal override IOperation GetCurrent(int slot, int index) => throw ExceptionUtilities.UnexpectedValue((slot, index)); 4593internal override IOperation GetCurrent(int slot, int index) => throw ExceptionUtilities.UnexpectedValue((slot, index)); 4604internal ReturnOperation(IOperation? returnedValue, OperationKind kind, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 4610public IOperation? ReturnedValue { get; } 4613internal override IOperation GetCurrent(int slot, int index) 4656internal LockOperation(IOperation lockedValue, IOperation body, ILocalSymbol? lockTakenSymbol, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 4663public IOperation LockedValue { get; } 4664public IOperation Body { get; } 4669internal override IOperation GetCurrent(int slot, int index) 4736internal override IOperation GetCurrent(int slot, int index) 4799internal UsingOperation(IOperation resources, IOperation body, ImmutableArray<ILocalSymbol> locals, bool isAsynchronous, DisposeOperationInfo disposeInfo, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 4808public IOperation Resources { get; } 4809public IOperation Body { get; } 4816internal override IOperation GetCurrent(int slot, int index) 4867internal ExpressionStatementOperation(IOperation operation, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 4872public IOperation Operation { get; } 4875internal override IOperation GetCurrent(int slot, int index) 4931internal override IOperation GetCurrent(int slot, int index) 4985internal override IOperation GetCurrent(int slot, int index) => throw ExceptionUtilities.UnexpectedValue((slot, index)); 4999internal override IOperation GetCurrent(int slot, int index) => throw ExceptionUtilities.UnexpectedValue((slot, index)); 5021internal override IOperation GetCurrent(int slot, int index) 5083internal override IOperation GetCurrent(int slot, int index) => throw ExceptionUtilities.UnexpectedValue((slot, index)); 5094internal ConversionOperation(IOperation operand, IConvertibleConversion conversion, bool isTryCast, bool isChecked, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) 5104public IOperation Operand { get; } 5111internal override IOperation GetCurrent(int slot, int index) 5154internal InvocationOperation(IMethodSymbol targetMethod, ITypeSymbol? constrainedToType, IOperation? instance, bool isVirtual, ImmutableArray<IArgumentOperation> arguments, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 5166public IOperation? Instance { get; } 5172internal override IOperation GetCurrent(int slot, int index) 5227internal ArrayElementReferenceOperation(IOperation arrayReference, ImmutableArray<IOperation> indices, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 5234public IOperation ArrayReference { get; } 5235public ImmutableArray<IOperation> Indices { get; } 5239internal override IOperation GetCurrent(int slot, int index) 5305internal override IOperation GetCurrent(int slot, int index) => throw ExceptionUtilities.UnexpectedValue((slot, index)); 5324internal override IOperation GetCurrent(int slot, int index) => throw ExceptionUtilities.UnexpectedValue((slot, index)); 5335protected BaseMemberReferenceOperation(IOperation? instance, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 5340public IOperation? Instance { get; } 5345internal FieldReferenceOperation(IFieldSymbol field, bool isDeclaration, IOperation? instance, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) 5357internal override IOperation GetCurrent(int slot, int index) 5400internal MethodReferenceOperation(IMethodSymbol method, ITypeSymbol? constrainedToType, bool isVirtual, IOperation? instance, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 5413internal override IOperation GetCurrent(int slot, int index) 5456internal PropertyReferenceOperation(IPropertySymbol property, ITypeSymbol? constrainedToType, ImmutableArray<IArgumentOperation> arguments, IOperation? instance, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 5470internal override IOperation GetCurrent(int slot, int index) 5525internal EventReferenceOperation(IEventSymbol @event, ITypeSymbol? constrainedToType, IOperation? instance, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 5536internal override IOperation GetCurrent(int slot, int index) 5579internal UnaryOperation(UnaryOperatorKind operatorKind, IOperation operand, bool isLifted, bool isChecked, IMethodSymbol? operatorMethod, ITypeSymbol? constrainedToType, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) 5592public IOperation Operand { get; } 5599internal override IOperation GetCurrent(int slot, int index) 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) 5658public IOperation LeftOperand { get; } 5659public IOperation RightOperand { get; } 5669internal override IOperation GetCurrent(int slot, int index) 5720internal ConditionalOperation(IOperation condition, IOperation whenTrue, IOperation? whenFalse, bool isRef, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) 5730public IOperation Condition { get; } 5731public IOperation WhenTrue { get; } 5732public IOperation? WhenFalse { get; } 5738internal override IOperation GetCurrent(int slot, int index) 5797internal CoalesceOperation(IOperation value, IOperation whenNull, IConvertibleConversion valueConversion, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) 5806public IOperation Value { get; } 5807public IOperation WhenNull { get; } 5813internal override IOperation GetCurrent(int slot, int index) 5874internal override IOperation GetCurrent(int slot, int index) 5932internal override IOperation GetCurrent(int slot, int index) 5996internal override IOperation GetCurrent(int slot, int index) 6039internal ArrayCreationOperation(ImmutableArray<IOperation> dimensionSizes, IArrayInitializerOperation? initializer, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 6046public ImmutableArray<IOperation> DimensionSizes { get; } 6051internal override IOperation GetCurrent(int slot, int index) 6114internal override IOperation GetCurrent(int slot, int index) => throw ExceptionUtilities.UnexpectedValue((slot, index)); 6125internal IsTypeOperation(IOperation valueOperand, ITypeSymbol typeOperand, bool isNegated, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 6133public IOperation ValueOperand { get; } 6138internal override IOperation GetCurrent(int slot, int index) 6181internal AwaitOperation(IOperation operation, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 6187public IOperation Operation { get; } 6190internal override IOperation GetCurrent(int slot, int index) 6233protected BaseAssignmentOperation(IOperation target, IOperation value, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 6239public IOperation Target { get; } 6240public IOperation Value { get; } 6244internal SimpleAssignmentOperation(bool isRef, IOperation target, IOperation value, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) 6255internal override IOperation GetCurrent(int slot, int index) 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) 6330internal override IOperation GetCurrent(int slot, int index) 6381internal ParenthesizedOperation(IOperation operand, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) 6388public IOperation Operand { get; } 6391internal override IOperation GetCurrent(int slot, int index) 6434internal EventAssignmentOperation(IOperation eventReference, IOperation handlerValue, bool adds, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 6442public IOperation EventReference { get; } 6443public IOperation HandlerValue { get; } 6448internal override IOperation GetCurrent(int slot, int index) 6499internal ConditionalAccessOperation(IOperation operation, IOperation whenNotNull, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 6506public IOperation Operation { get; } 6507public IOperation WhenNotNull { get; } 6511internal override IOperation GetCurrent(int slot, int index) 6568internal override IOperation GetCurrent(int slot, int index) => throw ExceptionUtilities.UnexpectedValue((slot, index)); 6589internal override IOperation GetCurrent(int slot, int index) 6636internal AnonymousObjectCreationOperation(ImmutableArray<IOperation> initializers, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 6642public ImmutableArray<IOperation> Initializers { get; } 6645internal override IOperation GetCurrent(int slot, int index) 6692internal ObjectOrCollectionInitializerOperation(ImmutableArray<IOperation> initializers, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 6698public ImmutableArray<IOperation> Initializers { get; } 6701internal override IOperation GetCurrent(int slot, int index) 6748internal MemberInitializerOperation(IOperation initializedMember, IObjectOrCollectionInitializerOperation initializer, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 6755public IOperation InitializedMember { get; } 6760internal override IOperation GetCurrent(int slot, int index) 6811internal NameOfOperation(IOperation argument, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) 6818public IOperation Argument { get; } 6821internal override IOperation GetCurrent(int slot, int index) 6864internal TupleOperation(ImmutableArray<IOperation> elements, ITypeSymbol? naturalType, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 6871public ImmutableArray<IOperation> Elements { get; } 6875internal override IOperation GetCurrent(int slot, int index) 6922internal DynamicMemberReferenceOperation(IOperation? instance, string memberName, ImmutableArray<ITypeSymbol> typeArguments, ITypeSymbol? containingType, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 6931public IOperation? Instance { get; } 6937internal override IOperation GetCurrent(int slot, int index) 6980internal TranslatedQueryOperation(IOperation operation, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 6986public IOperation Operation { get; } 6989internal override IOperation GetCurrent(int slot, int index) 7032internal DelegateCreationOperation(IOperation target, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 7038public IOperation Target { get; } 7041internal override IOperation GetCurrent(int slot, int index) 7091internal override IOperation GetCurrent(int slot, int index) => throw ExceptionUtilities.UnexpectedValue((slot, index)); 7110internal override IOperation GetCurrent(int slot, int index) => throw ExceptionUtilities.UnexpectedValue((slot, index)); 7130internal override IOperation GetCurrent(int slot, int index) => throw ExceptionUtilities.UnexpectedValue((slot, index)); 7141internal AddressOfOperation(IOperation reference, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 7147public IOperation Reference { get; } 7150internal override IOperation GetCurrent(int slot, int index) 7193internal IsPatternOperation(IOperation value, IPatternOperation pattern, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 7200public IOperation Value { get; } 7205internal override IOperation GetCurrent(int slot, int index) 7256internal IncrementOrDecrementOperation(bool isPostfix, bool isLifted, bool isChecked, IOperation target, IMethodSymbol? operatorMethod, ITypeSymbol? constrainedToType, OperationKind kind, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 7271public IOperation Target { get; } 7276internal override IOperation GetCurrent(int slot, int index) 7319internal ThrowOperation(IOperation? exception, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 7325public IOperation? Exception { get; } 7328internal override IOperation GetCurrent(int slot, int index) 7371internal DeconstructionAssignmentOperation(IOperation target, IOperation value, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 7379internal override IOperation GetCurrent(int slot, int index) 7430internal DeclarationExpressionOperation(IOperation expression, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 7436public IOperation Expression { get; } 7439internal override IOperation GetCurrent(int slot, int index) 7488internal override IOperation GetCurrent(int slot, int index) => throw ExceptionUtilities.UnexpectedValue((slot, index)); 7499protected BaseSymbolInitializerOperation(ImmutableArray<ILocalSymbol> locals, IOperation value, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 7506public IOperation Value { get; } 7510internal FieldInitializerOperation(ImmutableArray<IFieldSymbol> initializedFields, ImmutableArray<ILocalSymbol> locals, IOperation value, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 7518internal override IOperation GetCurrent(int slot, int index) 7561internal VariableInitializerOperation(ImmutableArray<ILocalSymbol> locals, IOperation value, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 7565internal override IOperation GetCurrent(int slot, int index) 7608internal PropertyInitializerOperation(ImmutableArray<IPropertySymbol> initializedProperties, ImmutableArray<ILocalSymbol> locals, IOperation value, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 7616internal override IOperation GetCurrent(int slot, int index) 7659internal ParameterInitializerOperation(IParameterSymbol parameter, ImmutableArray<ILocalSymbol> locals, IOperation value, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 7667internal override IOperation GetCurrent(int slot, int index) 7710internal ArrayInitializerOperation(ImmutableArray<IOperation> elementValues, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 7715public ImmutableArray<IOperation> ElementValues { get; } 7718internal override IOperation GetCurrent(int slot, int index) 7765internal VariableDeclaratorOperation(ILocalSymbol symbol, IVariableInitializerOperation? initializer, ImmutableArray<IOperation> ignoredArguments, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 7774public ImmutableArray<IOperation> IgnoredArguments { get; } 7778internal override IOperation GetCurrent(int slot, int index) 7833internal VariableDeclarationOperation(ImmutableArray<IVariableDeclaratorOperation> declarators, IVariableInitializerOperation? initializer, ImmutableArray<IOperation> ignoredDimensions, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 7842public ImmutableArray<IOperation> IgnoredDimensions { get; } 7847internal override IOperation GetCurrent(int slot, int index) 7914internal ArgumentOperation(ArgumentKind argumentKind, IParameterSymbol? parameter, IOperation value, IConvertibleConversion inConversion, IConvertibleConversion outConversion, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 7925public IOperation Value { get; } 7932internal override IOperation GetCurrent(int slot, int index) 7975internal CatchClauseOperation(IOperation? exceptionDeclarationOrExpression, ITypeSymbol exceptionType, ImmutableArray<ILocalSymbol> locals, IOperation? filter, IBlockOperation handler, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 7984public IOperation? ExceptionDeclarationOrExpression { get; } 7987public IOperation? Filter { get; } 7993internal override IOperation GetCurrent(int slot, int index) 8052internal SwitchCaseOperation(ImmutableArray<ICaseClauseOperation> clauses, ImmutableArray<IOperation> body, ImmutableArray<ILocalSymbol> locals, IOperation? condition, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 8061public ImmutableArray<IOperation> Body { get; } 8063public IOperation? Condition { get; } 8067internal override IOperation GetCurrent(int slot, int index) 8139internal override IOperation GetCurrent(int slot, int index) => throw ExceptionUtilities.UnexpectedValue((slot, index)); 8150internal PatternCaseClauseOperation(ILabelSymbol label, IPatternOperation pattern, IOperation? guard, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 8158public IOperation? Guard { get; } 8162internal override IOperation GetCurrent(int slot, int index) 8213internal RangeCaseClauseOperation(IOperation minimumValue, IOperation maximumValue, ILabelSymbol? label, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 8219public IOperation MinimumValue { get; } 8220public IOperation MaximumValue { get; } 8224internal override IOperation GetCurrent(int slot, int index) 8275internal RelationalCaseClauseOperation(IOperation value, BinaryOperatorKind relation, ILabelSymbol? label, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 8281public IOperation Value { get; } 8285internal override IOperation GetCurrent(int slot, int index) 8328internal SingleValueCaseClauseOperation(IOperation value, ILabelSymbol? label, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 8333public IOperation Value { get; } 8336internal override IOperation GetCurrent(int slot, int index) 8384internal InterpolatedStringTextOperation(IOperation text, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 8389public IOperation Text { get; } 8392internal override IOperation GetCurrent(int slot, int index) 8435internal InterpolationOperation(IOperation expression, IOperation? alignment, IOperation? formatString, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 8442public IOperation Expression { get; } 8443public IOperation? Alignment { get; } 8444public IOperation? FormatString { get; } 8449internal override IOperation GetCurrent(int slot, int index) 8519internal ConstantPatternOperation(IOperation value, ITypeSymbol inputType, ITypeSymbol narrowedType, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 8524public IOperation Value { get; } 8527internal override IOperation GetCurrent(int slot, int index) 8581internal override IOperation GetCurrent(int slot, int index) => throw ExceptionUtilities.UnexpectedValue((slot, index)); 8592internal TupleBinaryOperation(BinaryOperatorKind operatorKind, IOperation leftOperand, IOperation rightOperand, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 8601public IOperation LeftOperand { get; } 8602public IOperation RightOperand { get; } 8606internal override IOperation GetCurrent(int slot, int index) 8673internal override IOperation GetCurrent(int slot, int index) 8724internal ConstructorBodyOperation(ImmutableArray<ILocalSymbol> locals, IOperation? initializer, IBlockOperation? blockBody, IBlockOperation? expressionBody, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 8731public IOperation? Initializer { get; } 8736internal override IOperation GetCurrent(int slot, int index) 8803internal override IOperation GetCurrent(int slot, int index) => throw ExceptionUtilities.UnexpectedValue((slot, index)); 8814internal FlowCaptureOperation(CaptureId id, IOperation value, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 8821public IOperation Value { get; } 8824internal override IOperation GetCurrent(int slot, int index) 8878internal override IOperation GetCurrent(int slot, int index) => throw ExceptionUtilities.UnexpectedValue((slot, index)); 8889internal IsNullOperation(IOperation operand, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) 8896public IOperation Operand { get; } 8899internal override IOperation GetCurrent(int slot, int index) 8948internal override IOperation GetCurrent(int slot, int index) => throw ExceptionUtilities.UnexpectedValue((slot, index)); 8967internal override IOperation GetCurrent(int slot, int index) => throw ExceptionUtilities.UnexpectedValue((slot, index)); 8978internal CoalesceAssignmentOperation(IOperation target, IOperation value, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 8986internal override IOperation GetCurrent(int slot, int index) 9037internal RangeOperation(IOperation? leftOperand, IOperation? rightOperand, bool isLifted, IMethodSymbol? method, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 9046public IOperation? LeftOperand { get; } 9047public IOperation? RightOperand { get; } 9053internal override IOperation GetCurrent(int slot, int index) 9114internal override IOperation GetCurrent(int slot, int index) 9161internal ReDimClauseOperation(IOperation operand, ImmutableArray<IOperation> dimensionSizes, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 9167public IOperation Operand { get; } 9168public ImmutableArray<IOperation> DimensionSizes { get; } 9172internal override IOperation GetCurrent(int slot, int index) 9244internal override IOperation GetCurrent(int slot, int index) 9306internal override IOperation GetCurrent(int slot, int index) => throw ExceptionUtilities.UnexpectedValue((slot, index)); 9317internal SwitchExpressionOperation(IOperation value, ImmutableArray<ISwitchExpressionArmOperation> arms, bool isExhaustive, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 9325public IOperation Value { get; } 9331internal override IOperation GetCurrent(int slot, int index) 9386internal SwitchExpressionArmOperation(IPatternOperation pattern, IOperation? guard, IOperation value, ImmutableArray<ILocalSymbol> locals, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 9395public IOperation? Guard { get; } 9396public IOperation Value { get; } 9402internal override IOperation GetCurrent(int slot, int index) 9461internal PropertySubpatternOperation(IOperation member, IPatternOperation pattern, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 9467public IOperation Member { get; } 9472internal override IOperation GetCurrent(int slot, int index) 9523internal AggregateQueryOperation(IOperation group, IOperation aggregation, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 9530public IOperation Group { get; } 9531public IOperation Aggregation { get; } 9535internal override IOperation GetCurrent(int slot, int index) 9586internal FixedOperation(ImmutableArray<ILocalSymbol> locals, IVariableDeclarationGroupOperation variables, IOperation body, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 9595public IOperation Body { get; } 9599internal override IOperation GetCurrent(int slot, int index) 9659internal override IOperation GetCurrent(int slot, int index) 9710internal override IOperation GetCurrent(int slot, int index) => throw ExceptionUtilities.UnexpectedValue((slot, index)); 9721internal WithStatementOperation(IOperation body, IOperation value, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 9727public IOperation Body { get; } 9728public IOperation Value { get; } 9732internal override IOperation GetCurrent(int slot, int index) 9795internal override IOperation GetCurrent(int slot, int index) 9846internal override IOperation GetCurrent(int slot, int index) 9902internal override IOperation GetCurrent(int slot, int index) 9960internal override IOperation GetCurrent(int slot, int index) => throw ExceptionUtilities.UnexpectedValue((slot, index)); 9971internal RelationalPatternOperation(BinaryOperatorKind operatorKind, IOperation value, ITypeSymbol inputType, ITypeSymbol narrowedType, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 9978public IOperation Value { get; } 9981internal override IOperation GetCurrent(int slot, int index) 10024internal WithOperation(IOperation operand, IMethodSymbol? cloneMethod, IObjectOrCollectionInitializerOperation initializer, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 10032public IOperation Operand { get; } 10038internal override IOperation GetCurrent(int slot, int index) 10089internal InterpolatedStringHandlerCreationOperation(IOperation handlerCreation, bool handlerCreationHasSuccessParameter, bool handlerAppendCallsReturnBool, IOperation content, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 10098public IOperation HandlerCreation { get; } 10101public IOperation Content { get; } 10105internal override IOperation GetCurrent(int slot, int index) 10156internal InterpolatedStringAdditionOperation(IOperation left, IOperation right, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 10162public IOperation Left { get; } 10163public IOperation Right { get; } 10167internal override IOperation GetCurrent(int slot, int index) 10218internal InterpolatedStringAppendOperation(IOperation appendCall, OperationKind kind, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 10224public IOperation AppendCall { get; } 10227internal override IOperation GetCurrent(int slot, int index) 10279internal override IOperation GetCurrent(int slot, int index) => throw ExceptionUtilities.UnexpectedValue((slot, index)); 10290internal FunctionPointerInvocationOperation(IOperation target, ImmutableArray<IArgumentOperation> arguments, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 10297public IOperation Target { get; } 10302internal override IOperation GetCurrent(int slot, int index) 10371internal override IOperation GetCurrent(int slot, int index) 10428internal override IOperation GetCurrent(int slot, int index) 10471internal ImplicitIndexerReferenceOperation(IOperation instance, IOperation argument, ISymbol lengthSymbol, ISymbol indexerSymbol, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 10480public IOperation Instance { get; } 10481public IOperation Argument { get; } 10487internal override IOperation GetCurrent(int slot, int index) 10546internal override IOperation GetCurrent(int slot, int index) => throw ExceptionUtilities.UnexpectedValue((slot, index)); 10557internal AttributeOperation(IOperation operation, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 10562public IOperation Operation { get; } 10565internal override IOperation GetCurrent(int slot, int index) 10608internal InlineArrayAccessOperation(IOperation instance, IOperation argument, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 10615public IOperation Instance { get; } 10616public IOperation Argument { get; } 10620internal override IOperation GetCurrent(int slot, int index) 10671internal CollectionExpressionOperation(IMethodSymbol? constructMethod, ImmutableArray<IOperation> elements, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 10679public ImmutableArray<IOperation> Elements { get; } 10682internal override IOperation GetCurrent(int slot, int index) 10729internal SpreadOperation(IOperation operand, ITypeSymbol? elementType, IConvertibleConversion elementConversion, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 10736public IOperation Operand { get; } 10742internal override IOperation GetCurrent(int slot, int index) 10785internal sealed partial class OperationCloner : OperationVisitor<object?, IOperation> 10789public static T CloneOperation<T>(T operation) where T : IOperation => s_instance.Visit(operation); 10792private T? Visit<T>(T? node) where T : IOperation? => (T?)Visit(node, argument: null); 10793public override IOperation DefaultVisit(IOperation operation, object? argument) => throw ExceptionUtilities.Unreachable(); 10794private ImmutableArray<T> VisitArray<T>(ImmutableArray<T> nodes) where T : IOperation => nodes.SelectAsArray((n, @this) => @this.Visit(n), this)!; 10795private ImmutableArray<(ISymbol, T)> VisitArray<T>(ImmutableArray<(ISymbol, T)> nodes) where T : IOperation => nodes.SelectAsArray((n, @this) => (n.Item1, @this.Visit(n.Item2)), this)!; 10796public override IOperation VisitBlock(IBlockOperation operation, object? argument) 10801public override IOperation VisitVariableDeclarationGroup(IVariableDeclarationGroupOperation operation, object? argument) 10806public override IOperation VisitSwitch(ISwitchOperation operation, object? argument) 10811public override IOperation VisitForEachLoop(IForEachLoopOperation operation, object? argument) 10816public override IOperation VisitForLoop(IForLoopOperation operation, object? argument) 10821public override IOperation VisitForToLoop(IForToLoopOperation operation, object? argument) 10826public override IOperation VisitWhileLoop(IWhileLoopOperation operation, object? argument) 10831public override IOperation VisitLabeled(ILabeledOperation operation, object? argument) 10836public override IOperation VisitBranch(IBranchOperation operation, object? argument) 10841public override IOperation VisitEmpty(IEmptyOperation operation, object? argument) 10846public override IOperation VisitReturn(IReturnOperation operation, object? argument) 10851public override IOperation VisitLock(ILockOperation operation, object? argument) 10856public override IOperation VisitTry(ITryOperation operation, object? argument) 10861public override IOperation VisitUsing(IUsingOperation operation, object? argument) 10866public override IOperation VisitExpressionStatement(IExpressionStatementOperation operation, object? argument) 10871public override IOperation VisitLocalFunction(ILocalFunctionOperation operation, object? argument) 10876public override IOperation VisitStop(IStopOperation operation, object? argument) 10881public override IOperation VisitEnd(IEndOperation operation, object? argument) 10886public override IOperation VisitRaiseEvent(IRaiseEventOperation operation, object? argument) 10891public override IOperation VisitLiteral(ILiteralOperation operation, object? argument) 10896public override IOperation VisitConversion(IConversionOperation operation, object? argument) 10901public override IOperation VisitInvocation(IInvocationOperation operation, object? argument) 10906public override IOperation VisitArrayElementReference(IArrayElementReferenceOperation operation, object? argument) 10911public override IOperation VisitLocalReference(ILocalReferenceOperation operation, object? argument) 10916public override IOperation VisitParameterReference(IParameterReferenceOperation operation, object? argument) 10921public override IOperation VisitFieldReference(IFieldReferenceOperation operation, object? argument) 10926public override IOperation VisitMethodReference(IMethodReferenceOperation operation, object? argument) 10931public override IOperation VisitPropertyReference(IPropertyReferenceOperation operation, object? argument) 10936public override IOperation VisitEventReference(IEventReferenceOperation operation, object? argument) 10941public override IOperation VisitUnaryOperator(IUnaryOperation operation, object? argument) 10946public override IOperation VisitBinaryOperator(IBinaryOperation operation, object? argument) 10951public override IOperation VisitConditional(IConditionalOperation operation, object? argument) 10956public override IOperation VisitCoalesce(ICoalesceOperation operation, object? argument) 10961public override IOperation VisitAnonymousFunction(IAnonymousFunctionOperation operation, object? argument) 10966public override IOperation VisitObjectCreation(IObjectCreationOperation operation, object? argument) 10971public override IOperation VisitTypeParameterObjectCreation(ITypeParameterObjectCreationOperation operation, object? argument) 10976public override IOperation VisitArrayCreation(IArrayCreationOperation operation, object? argument) 10981public override IOperation VisitInstanceReference(IInstanceReferenceOperation operation, object? argument) 10986public override IOperation VisitIsType(IIsTypeOperation operation, object? argument) 10991public override IOperation VisitAwait(IAwaitOperation operation, object? argument) 10996public override IOperation VisitSimpleAssignment(ISimpleAssignmentOperation operation, object? argument) 11001public override IOperation VisitCompoundAssignment(ICompoundAssignmentOperation operation, object? argument) 11006public override IOperation VisitParenthesized(IParenthesizedOperation operation, object? argument) 11011public override IOperation VisitEventAssignment(IEventAssignmentOperation operation, object? argument) 11016public override IOperation VisitConditionalAccess(IConditionalAccessOperation operation, object? argument) 11021public override IOperation VisitConditionalAccessInstance(IConditionalAccessInstanceOperation operation, object? argument) 11026public override IOperation VisitInterpolatedString(IInterpolatedStringOperation operation, object? argument) 11031public override IOperation VisitAnonymousObjectCreation(IAnonymousObjectCreationOperation operation, object? argument) 11036public override IOperation VisitObjectOrCollectionInitializer(IObjectOrCollectionInitializerOperation operation, object? argument) 11041public override IOperation VisitMemberInitializer(IMemberInitializerOperation operation, object? argument) 11046public override IOperation VisitNameOf(INameOfOperation operation, object? argument) 11051public override IOperation VisitTuple(ITupleOperation operation, object? argument) 11056public override IOperation VisitDynamicMemberReference(IDynamicMemberReferenceOperation operation, object? argument) 11061public override IOperation VisitTranslatedQuery(ITranslatedQueryOperation operation, object? argument) 11066public override IOperation VisitDelegateCreation(IDelegateCreationOperation operation, object? argument) 11071public override IOperation VisitDefaultValue(IDefaultValueOperation operation, object? argument) 11076public override IOperation VisitTypeOf(ITypeOfOperation operation, object? argument) 11081public override IOperation VisitSizeOf(ISizeOfOperation operation, object? argument) 11086public override IOperation VisitAddressOf(IAddressOfOperation operation, object? argument) 11091public override IOperation VisitIsPattern(IIsPatternOperation operation, object? argument) 11096public override IOperation VisitIncrementOrDecrement(IIncrementOrDecrementOperation operation, object? argument) 11101public override IOperation VisitThrow(IThrowOperation operation, object? argument) 11106public override IOperation VisitDeconstructionAssignment(IDeconstructionAssignmentOperation operation, object? argument) 11111public override IOperation VisitDeclarationExpression(IDeclarationExpressionOperation operation, object? argument) 11116public override IOperation VisitOmittedArgument(IOmittedArgumentOperation operation, object? argument) 11121public override IOperation VisitFieldInitializer(IFieldInitializerOperation operation, object? argument) 11126public override IOperation VisitVariableInitializer(IVariableInitializerOperation operation, object? argument) 11131public override IOperation VisitPropertyInitializer(IPropertyInitializerOperation operation, object? argument) 11136public override IOperation VisitParameterInitializer(IParameterInitializerOperation operation, object? argument) 11141public override IOperation VisitArrayInitializer(IArrayInitializerOperation operation, object? argument) 11146public override IOperation VisitVariableDeclarator(IVariableDeclaratorOperation operation, object? argument) 11151public override IOperation VisitVariableDeclaration(IVariableDeclarationOperation operation, object? argument) 11156public override IOperation VisitArgument(IArgumentOperation operation, object? argument) 11161public override IOperation VisitCatchClause(ICatchClauseOperation operation, object? argument) 11166public override IOperation VisitSwitchCase(ISwitchCaseOperation operation, object? argument) 11171public override IOperation VisitDefaultCaseClause(IDefaultCaseClauseOperation operation, object? argument) 11176public override IOperation VisitPatternCaseClause(IPatternCaseClauseOperation operation, object? argument) 11181public override IOperation VisitRangeCaseClause(IRangeCaseClauseOperation operation, object? argument) 11186public override IOperation VisitRelationalCaseClause(IRelationalCaseClauseOperation operation, object? argument) 11191public override IOperation VisitSingleValueCaseClause(ISingleValueCaseClauseOperation operation, object? argument) 11196public override IOperation VisitInterpolatedStringText(IInterpolatedStringTextOperation operation, object? argument) 11201public override IOperation VisitInterpolation(IInterpolationOperation operation, object? argument) 11206public override IOperation VisitConstantPattern(IConstantPatternOperation operation, object? argument) 11211public override IOperation VisitDeclarationPattern(IDeclarationPatternOperation operation, object? argument) 11216public override IOperation VisitTupleBinaryOperator(ITupleBinaryOperation operation, object? argument) 11221public override IOperation VisitMethodBodyOperation(IMethodBodyOperation operation, object? argument) 11226public override IOperation VisitConstructorBodyOperation(IConstructorBodyOperation operation, object? argument) 11231public override IOperation VisitDiscardOperation(IDiscardOperation operation, object? argument) 11236public override IOperation VisitFlowCaptureReference(IFlowCaptureReferenceOperation operation, object? argument) 11241public override IOperation VisitCoalesceAssignment(ICoalesceAssignmentOperation operation, object? argument) 11246public override IOperation VisitRangeOperation(IRangeOperation operation, object? argument) 11251public override IOperation VisitReDim(IReDimOperation operation, object? argument) 11256public override IOperation VisitReDimClause(IReDimClauseOperation operation, object? argument) 11261public override IOperation VisitRecursivePattern(IRecursivePatternOperation operation, object? argument) 11266public override IOperation VisitDiscardPattern(IDiscardPatternOperation operation, object? argument) 11271public override IOperation VisitSwitchExpression(ISwitchExpressionOperation operation, object? argument) 11276public override IOperation VisitSwitchExpressionArm(ISwitchExpressionArmOperation operation, object? argument) 11281public override IOperation VisitPropertySubpattern(IPropertySubpatternOperation operation, object? argument) 11286internal override IOperation VisitAggregateQuery(IAggregateQueryOperation operation, object? argument) 11291internal override IOperation VisitFixed(IFixedOperation operation, object? argument) 11296internal override IOperation VisitNoPiaObjectCreation(INoPiaObjectCreationOperation operation, object? argument) 11301internal override IOperation VisitPlaceholder(IPlaceholderOperation operation, object? argument) 11306internal override IOperation VisitWithStatement(IWithStatementOperation operation, object? argument) 11311public override IOperation VisitUsingDeclaration(IUsingDeclarationOperation operation, object? argument) 11316public override IOperation VisitNegatedPattern(INegatedPatternOperation operation, object? argument) 11321public override IOperation VisitBinaryPattern(IBinaryPatternOperation operation, object? argument) 11326public override IOperation VisitTypePattern(ITypePatternOperation operation, object? argument) 11331public override IOperation VisitRelationalPattern(IRelationalPatternOperation operation, object? argument) 11336public override IOperation VisitWith(IWithOperation operation, object? argument) 11341public override IOperation VisitInterpolatedStringHandlerCreation(IInterpolatedStringHandlerCreationOperation operation, object? argument) 11346public override IOperation VisitInterpolatedStringAddition(IInterpolatedStringAdditionOperation operation, object? argument) 11351public override IOperation VisitInterpolatedStringAppend(IInterpolatedStringAppendOperation operation, object? argument) 11356public override IOperation VisitInterpolatedStringHandlerArgumentPlaceholder(IInterpolatedStringHandlerArgumentPlaceholderOperation operation, object? argument) 11361public override IOperation VisitFunctionPointerInvocation(IFunctionPointerInvocationOperation operation, object? argument) 11366public override IOperation VisitListPattern(IListPatternOperation operation, object? argument) 11371public override IOperation VisitSlicePattern(ISlicePatternOperation operation, object? argument) 11376public override IOperation VisitImplicitIndexerReference(IImplicitIndexerReferenceOperation operation, object? argument) 11381public override IOperation VisitUtf8String(IUtf8StringOperation operation, object? argument) 11386public override IOperation VisitAttribute(IAttributeOperation operation, object? argument) 11391public override IOperation VisitInlineArrayAccess(IInlineArrayAccessOperation operation, object? argument) 11396public override IOperation VisitCollectionExpression(ICollectionExpressionOperation operation, object? argument) 11401public override IOperation VisitSpread(ISpreadOperation operation, object? argument) 11412public virtual void Visit(IOperation? operation) => operation?.Accept(this); 11413public virtual void DefaultVisit(IOperation operation) { /* no-op */ } 11414internal virtual void VisitNoneOperation(IOperation operation) { /* no-op */ } 11551public virtual TResult? Visit(IOperation? operation, TArgument argument) => operation is null ? default(TResult) : operation.Accept(this, argument); 11552public virtual TResult? DefaultVisit(IOperation operation, TArgument argument) => default(TResult); 11553internal virtual TResult? VisitNoneOperation(IOperation operation, TArgument argument) => default(TResult);
Operations\BasicBlock.cs (4)
30ImmutableArray<IOperation> operations, 31IOperation? branchValue, 54public ImmutableArray<IOperation> Operations { get; } 63public IOperation? BranchValue { get; }
Operations\ControlFlowGraph.cs (4)
32internal ControlFlowGraph(IOperation originalOperation, 95IOperation? operation = semanticModel.GetOperation(node, cancellationToken); 171internal static ControlFlowGraph CreateCore(IOperation operation, string argumentNameForException, CancellationToken cancellationToken) 200public IOperation OriginalOperation { get; }
Operations\ControlFlowGraphBuilder.BasicBlockBuilder.cs (6)
19private ArrayBuilder<IOperation>? _statements; 27public IOperation? BranchValue; 47public ArrayBuilder<IOperation>? StatementsOpt => _statements; 49public void AddStatement(IOperation operation) 55_statements = ArrayBuilder<IOperation>.GetInstance(); 83_statements?.ToImmutableAndFree() ?? ImmutableArray<IOperation>.Empty,
Operations\ControlFlowGraphBuilder.ConditionalAccessOperationTracker.cs (2)
21public readonly ArrayBuilder<IOperation>? Operations; 28public ConditionalAccessOperationTracker(ArrayBuilder<IOperation> operations, BasicBlockBuilder whenNull)
Operations\ControlFlowGraphBuilder.Context.cs (5)
20public readonly IOperation? ImplicitInstance; 22public readonly ImmutableArray<KeyValuePair<IPropertySymbol, IOperation>> AnonymousTypePropertyValues; 24internal Context(IOperation? implicitInstance, INamedTypeSymbol? anonymousType, ImmutableArray<KeyValuePair<IPropertySymbol, IOperation>> anonymousTypePropertyValues) 38ImmutableArray<KeyValuePair<IPropertySymbol, IOperation>>.Empty);
Operations\ControlFlowGraphBuilder.cs (512)
27internal sealed partial class ControlFlowGraphBuilder : OperationVisitor<int?, IOperation> 40private IOperation? _currentStatement; 41private readonly ArrayBuilder<(EvalStackFrame? frameOpt, IOperation? operationOpt)> _evalStack; 46private IOperation? _currentSwitchOperationExpression; 47private IOperation? _forToLoopBinaryOperatorLeftOperand; 48private IOperation? _forToLoopBinaryOperatorRightOperand; 49private IOperation? _currentAggregationGroup; 70_evalStack = ArrayBuilder<(EvalStackFrame? frameOpt, IOperation? operationOpt)>.GetInstance(); 82private bool IsImplicit(IOperation operation) 87public static ControlFlowGraph Create(IOperation body, ControlFlowGraph? parent = null, ControlFlowRegion? enclosing = null, CaptureIdDispenser? captureIdDispenser = null, in Context context = default) 836IOperation? value = block.BranchValue; 1233private void VisitStatement(IOperation? operation) 1244IOperation? saveCurrentStatement = _currentStatement; 1271IOperation? statement 1352foreach ((EvalStackFrame? frameOpt, IOperation? operationOpt) in _evalStack) 1383public override IOperation? VisitBlock(IBlockOperation operation, int? captureIdForResult) 1393private void StartVisitingStatement(IOperation operation) 1401private IOperation? FinishVisitingStatement(IOperation originalOperation, IOperation? result = null) 1412return result ?? MakeInvalidOperation(originalOperation.Syntax, originalOperation.Type, ImmutableArray<IOperation>.Empty); 1415private void VisitStatements(ImmutableArray<IOperation> statements) 1438private bool VisitStatementsOneOrAll(IOperation? operation, ImmutableArray<IOperation> statements, int startIndex) 1454var savedCurrentStatement = _currentStatement; 1467internal override IOperation? VisitWithStatement(IWithStatementOperation operation, int? captureIdForResult) 1480public override IOperation? VisitConstructorBodyOperation(IConstructorBodyOperation operation, int? captureIdForResult) 1497public override IOperation? VisitMethodBodyOperation(IMethodBodyOperation operation, int? captureIdForResult) 1535public override IOperation? VisitConditional(IConditionalOperation operation, int? captureIdForResult) 1615IOperation result; 1621IOperation? rewrittenThrow = BaseVisitRequired(whenTrueConversion.Operand, null); 1639IOperation rewrittenThrow = BaseVisitRequired(whenFalseConversion.Operand, null); 1667private void VisitAndCapture(IOperation operation, int captureId) 1670IOperation result = BaseVisitRequired(operation, captureId); 1676private IOperation VisitAndCapture(IOperation operation) 1684private void CaptureResultIfNotAlready(SyntaxNode syntax, int captureId, IOperation result) 1740(EvalStackFrame? frameOpt, IOperation? operationOpt) = _evalStack.Pop(); 1834(EvalStackFrame? frameOpt, IOperation? operationOpt) = _evalStack[i]; 1872IOperation? operation = _evalStack[j].operationOpt; 1936(EvalStackFrame? frameOpt, IOperation? operationOpt) = _evalStack[i]; 1950private void PushOperand(IOperation operation) 1960private IOperation PopOperand() 1970(EvalStackFrame? frameOpt, IOperation? operationOpt) = _evalStack.Pop(); 1977private IOperation PeekOperand() 1981(EvalStackFrame? frameOpt, IOperation? operationOpt) = _evalStack.Peek(); 1988private void VisitAndPushArray<T>(ImmutableArray<T> array, Func<T, IOperation>? unwrapper = null) where T : IOperation 1990Debug.Assert(unwrapper != null || typeof(T) == typeof(IOperation)); 1997private ImmutableArray<T> PopArray<T>(ImmutableArray<T> originalArray, Func<IOperation, int, ImmutableArray<T>, T>? wrapper = null) where T : IOperation 1999Debug.Assert(wrapper != null || typeof(T) == typeof(IOperation)); 2011IOperation visitedElement = PopOperand(); 2019private ImmutableArray<T> VisitArray<T>(ImmutableArray<T> originalArray, Func<T, IOperation>? unwrapper = null, Func<IOperation, int, ImmutableArray<T>, T>? wrapper = null) where T : IOperation 2078var argument = arguments[i].Value switch 2090private IArgumentOperation RewriteArgumentFromArray(IOperation visitedArgument, int index, ImmutableArray<IArgumentOperation> args) 2099public override IOperation VisitSimpleAssignment(ISimpleAssignmentOperation operation, int? captureIdForResult) 2103IOperation value = VisitRequired(operation.Value); 2107public override IOperation VisitCompoundAssignment(ICompoundAssignmentOperation operation, int? captureIdForResult) 2112IOperation value = VisitRequired(compoundAssignment.Value); 2119public override IOperation VisitArrayElementReference(IArrayElementReferenceOperation operation, int? captureIdForResult) 2123ImmutableArray<IOperation> visitedIndices = VisitArray(operation.Indices); 2124IOperation visitedArrayReference = PopOperand(); 2130public override IOperation VisitImplicitIndexerReference(IImplicitIndexerReferenceOperation operation, int? captureIdForResult) 2134IOperation argument = VisitRequired(operation.Argument); 2135IOperation instance = PopOperand(); 2141public override IOperation? VisitInlineArrayAccess(IInlineArrayAccessOperation operation, int? captureIdForResult) 2145IOperation argument = VisitRequired(operation.Argument); 2146IOperation instance = PopOperand(); 2164public override IOperation VisitBinaryOperator(IBinaryOperation operation, int? captureIdForResult) 2205IOperation leftOperand; 2228IOperation rightOperand = VisitRequired(operation.RightOperand); 2242public override IOperation VisitTupleBinaryOperator(ITupleBinaryOperation operation, int? captureIdForResult) 2244(IOperation visitedLeft, IOperation visitedRight) = VisitPreservingTupleOperations(operation.LeftOperand, operation.RightOperand); 2249public override IOperation VisitUnaryOperator(IUnaryOperation operation, int? captureIdForResult) 2285private IOperation VisitBinaryConditionalOperator(IBinaryOperation binOp, bool sense, int? captureIdForResult, 2301private IOperation VisitNullableBinaryConditionalOperator(IBinaryOperation binOp, int? captureIdForResult) 2305IOperation left = binOp.LeftOperand; 2306IOperation right = binOp.RightOperand; 2307IOperation condition; 2353IOperation capturedLeft = VisitAndCapture(left); 2371IOperation capturedRight = VisitAndCapture(right); 2398IOperation negateNullable(IOperation operand) 2407private IOperation VisitObjectBinaryConditionalOperator(IBinaryOperation binOp) 2412IOperation left = binOp.LeftOperand; 2413IOperation right = binOp.RightOperand; 2414IOperation condition; 2456private IOperation CreateConversion(IOperation operand, ITypeSymbol type) 2462private IOperation VisitDynamicBinaryConditionalOperator(IBinaryOperation binOp, int? captureIdForResult) 2470IOperation left = binOp.LeftOperand; 2471IOperation right = binOp.RightOperand; 2475IOperation condition; 2484IOperation capturedLeft = VisitAndCapture(left); 2523IOperation resultFromLeft = OperationCloner.CloneOperation(capturedLeft); 2537IOperation visitedRight = VisitRequired(right); 2562private IOperation VisitUserDefinedBinaryConditionalOperator(IBinaryOperation binOp, int? captureIdForResult) 2572IOperation left = binOp.LeftOperand; 2573IOperation right = binOp.RightOperand; 2576IOperation condition; 2581IOperation capturedLeft = VisitAndCapture(left); 2626IOperation visitedRight = VisitRequired(right); 2651private IOperation VisitShortCircuitingOperator(IBinaryOperation condition, bool sense, bool stopSense, bool stopValue, 2679IOperation resultFromRight = VisitConditionalExpression(condition.RightOperand, sense, captureId, fallToTrueOpt, fallToFalseOpt); 2702private IOperation VisitConditionalExpression(IOperation condition, bool sense, int? captureIdForResult, BasicBlockBuilder? fallToTrueOpt, BasicBlockBuilder? fallToFalseOpt) 2758private void VisitConditionalBranch(IOperation condition, [NotNull] ref BasicBlockBuilder? dest, bool jumpIfTrue) 2773private void VisitConditionalBranchCore(IOperation condition, [NotNull] ref BasicBlockBuilder? dest, bool jumpIfTrue) 2780void visitConditionalBranchCore(IOperation condition, [NotNull] ref BasicBlockBuilder? dest, bool jumpIfTrue) 2794var stack = ArrayBuilder<(IOperation? condition, BasicBlockBuilder dest, bool jumpIfTrue)>.GetInstance(); 2799(IOperation? condition, BasicBlockBuilder dest, bool jumpIfTrue) top = stack.Pop(); 2901IOperation convertedTestExpression = NullCheckAndConvertCoalesceValue(coalesce, whenNull); 2927IOperation? rewrittenThrow = BaseVisitRequired(conversion.Operand, null); 2950static IOperation skipParenthesized(IOperation condition) 2962private void ConditionalBranch(IOperation condition, bool jumpIfTrue, BasicBlockBuilder destination) 2981private IOperation NullCheckAndConvertCoalesceValue(ICoalesceOperation operation, BasicBlockBuilder whenNull) 2986IOperation operationValue = operation.Value; 2992IOperation testExpression = PopOperand(); 3000IOperation capturedValue = OperationCloner.CloneOperation(testExpression); 3001IOperation? convertedTestExpression = null; 3005IOperation? possiblyUnwrappedValue; 3040public override IOperation VisitCoalesce(ICoalesceOperation operation, int? captureIdForResult) 3052IOperation convertedTestExpression = NullCheckAndConvertCoalesceValue(operation, whenNull); 3054IOperation result; 3069IOperation? rewrittenThrow = BaseVisitRequired(conversion.Operand, null); 3097public override IOperation? VisitCoalesceAssignment(ICoalesceAssignmentOperation operation, int? captureIdForResult) 3113IOperation locationCapture = PopOperand(); 3122IOperation valueCapture = GetCaptureReference(valueCaptureId, locationCapture); 3214IOperation whenNullValue = VisitRequired(operation.Value); 3266IOperation whenNullValue = VisitRequired(operation.Value); 3267IOperation whenNullAssignment = new SimpleAssignmentOperation(isRef: false, OperationCloner.CloneOperation(locationCapture), whenNullValue, semanticModel: null, 3288private static IOperation MakeInvalidOperation(ITypeSymbol? type, IOperation child) 3290return new InvalidOperation(ImmutableArray.Create<IOperation>(child), 3295private static IOperation MakeInvalidOperation(SyntaxNode syntax, ITypeSymbol? type, IOperation child1, IOperation child2) 3297return MakeInvalidOperation(syntax, type, ImmutableArray.Create<IOperation>(child1, child2)); 3300private static IOperation MakeInvalidOperation(SyntaxNode syntax, ITypeSymbol? type, ImmutableArray<IOperation> children) 3307private IsNullOperation MakeIsNullOperation(IOperation operand) 3312private static IsNullOperation MakeIsNullOperation(IOperation operand, ITypeSymbol booleanType) 3323private IOperation? TryCallNullableMember(IOperation value, SpecialMember nullableMember) 3353private IOperation CallNullableMember(IOperation value, SpecialMember nullableMember) 3360public override IOperation? VisitConditionalAccess(IConditionalAccessOperation operation, int? captureIdForResult) 3369var operations = ArrayBuilder<IOperation>.GetInstance(); 3377IOperation testExpression; 3410IOperation result = VisitRequired(currentConditionalAccess.WhenNotNull); 3432IOperation access = VisitRequired(currentConditionalAccess.WhenNotNull); 3476static bool isConditionalAccessInstancePresentInChildren(IOperation operation) 3507foreach (var child in operation.ChildOperations) 3519public override IOperation VisitConditionalAccessInstance(IConditionalAccessInstanceOperation operation, int? captureIdForResult) 3523IOperation testExpression = _currentConditionalAccessTracker.Operations.Pop(); 3527private IOperation VisitConditionalAccessTestExpression(IOperation testExpression) 3536IOperation spilledTestExpression = PopOperand(); 3544IOperation receiver = OperationCloner.CloneOperation(spilledTestExpression); 3554public override IOperation? VisitExpressionStatement(IExpressionStatementOperation operation, int? captureIdForResult) 3558IOperation? underlying = Visit(operation.Operation); 3573public override IOperation? VisitWhileLoop(IWhileLoopOperation operation, int? captureIdForResult) 3646public override IOperation? VisitTry(ITryOperation operation, int? captureIdForResult) 3690IOperation? exceptionDeclarationOrExpression = catchClause.ExceptionDeclarationOrExpression; 3691IOperation? filter = catchClause.Filter; 3785private void AddExceptionStore(ITypeSymbol exceptionType, IOperation? exceptionDeclarationOrExpression) 3789IOperation exceptionTarget; 3822public override IOperation VisitCatchClause(ICatchClauseOperation operation, int? captureIdForResult) 3827public override IOperation? VisitReturn(IReturnOperation operation, int? captureIdForResult) 3830IOperation? returnedValue = Visit(operation.ReturnedValue); 3855public override IOperation? VisitLabeled(ILabeledOperation operation, int? captureIdForResult) 3899public override IOperation? VisitBranch(IBranchOperation operation, int? captureIdForResult) 3906public override IOperation? VisitEmpty(IEmptyOperation operation, int? captureIdForResult) 3912public override IOperation? VisitThrow(IThrowOperation operation, int? captureIdForResult) 3932return new NoneOperation(children: ImmutableArray<IOperation>.Empty, semanticModel: null, operation.Syntax, constantValue: null, isImplicit: true, type: null); 3936private void LinkThrowStatement(IOperation? exception) 3947public override IOperation? VisitUsing(IUsingOperation operation, int? captureIdForResult) 3955private void HandleUsingOperationParts(IOperation resources, IOperation body, IMethodSymbol? disposeMethod, ImmutableArray<IArgumentOperation> disposeArguments, ImmutableArray<ILocalSymbol> locals, bool isAsynchronous, 3956Func<IOperation, IOperation>? visitResource = null) 3989IOperation resource = visitResource != null ? visitResource(resources) : VisitRequired(resources); 4025bool shouldConvertToIDisposableBeforeTry(IOperation resource) 4030void processResource(IOperation resource, ArrayBuilder<(IVariableDeclarationOperation, IVariableDeclaratorOperation)>? resourceQueueOpt) 4112private void AddDisposingFinally(IOperation resource, bool requiresRuntimeConversion, ITypeSymbol iDisposable, IMethodSymbol? disposeMethod, ImmutableArray<IArgumentOperation> disposeArguments, bool isAsynchronous) 4136IOperation condition = MakeIsNullOperation(OperationCloner.CloneOperation(resource)); 4166IOperation? tryDispose(IOperation value) 4210private IOperation ConvertToIDisposable(IOperation operand, ITypeSymbol iDisposable, bool isTryCast = false) 4218public override IOperation? VisitLock(ILockOperation operation, int? captureIdForResult) 4236var lockObject = VisitRequired(resource); 4256IOperation? underlying = Visit(operation.LockedValue); 4315IOperation lockedValue = VisitRequired(operation.LockedValue); 4362IOperation? lockTaken = null; 4409IOperation condition = new LocalReferenceOperation(lockStatement.LockTakenSymbol, isDeclaration: false, semanticModel: null, lockedValue.Syntax, 4453public override IOperation? VisitForEachLoop(IForEachLoopOperation operation, int? captureIdForResult) 4478foreach (IOperation op in operation.Collection.DescendantsAndSelf()) 4489IOperation enumerator = getEnumerator(); 4559IOperation applyConversion(IConvertibleConversion? conversionOpt, IOperation operand, ITypeSymbol? targetType) 4570IOperation getEnumerator() 4572IOperation result; 4577IOperation? collection = info.GetEnumeratorMethod.IsStatic ? null : Visit(operation.Collection); 4593IOperation invocation = makeInvocation(operation.Collection.Syntax, 4607result = new InvalidOperation(ImmutableArray<IOperation>.Empty, semanticModel: null, operation.Collection.Syntax, 4615IOperation getCondition(IOperation enumeratorRef) 4633IOperation getCurrent(IOperation enumeratorRef) 4637var instance = info.CurrentProperty.IsStatic ? null : enumeratorRef; 4654IOperation getLoopControlVariableAssignment(IOperation current) 4695InvocationOperation makeInvocationDroppingInstanceForStaticMethods(IMethodSymbol method, IOperation instance, ImmutableArray<IArgumentOperation> arguments) 4700InvocationOperation makeInvocation(SyntaxNode syntax, IMethodSymbol method, IOperation? instanceOpt, ImmutableArray<IArgumentOperation> arguments) 4710ImmutableArray<IArgumentOperation> makeArguments(ImmutableArray<IArgumentOperation> arguments, ref IOperation? instance) 4729public override IOperation? VisitForToLoop(IForToLoopOperation operation, int? captureIdForResult) 4778IOperation tryCallObjectForLoopControlHelper(SyntaxNode syntax, WellKnownMember helper) 4793var builder = ArrayBuilder<IOperation>.GetInstance(--parametersCount, fillWithValue: null!); 4822IOperation value = PopOperand(); 4873IOperation condition = tryCallObjectForLoopControlHelper(operation.LoopControlVariable.Syntax, 4890IOperation stepValue = GetCaptureReference(stepValueId, operation.StepValue); 4901IOperation subtraction = VisitRequired(userDefinedInfo.Subtraction); 4918IOperation? stepValueIsNull = null; 4936IOperation isUp; 4956IOperation literal = new LiteralOperation(semanticModel: null, stepValue.Syntax, stepValue.Type, 4988IOperation initialValue = PopOperand(); 5028IOperation condition = tryCallObjectForLoopControlHelper(operation.LimitValue.Syntax, 5047IOperation controlVariableReferenceForCondition = PopOperand(); 5079IOperation limitReference = GetCaptureReference(limitValueId, operation.LimitValue); 5110IOperation condition; 5147IOperation? eitherLimitOrControlVariableIsNull = null; 5186IOperation controlVariableReferenceforCondition = PopOperand(); 5239IOperation negateIfStepNegative(IOperation operand) 5290IOperation controlVariableReferenceForAssignment = visitLoopControlVariableReference(forceImplicit: true); // Yes we are going to evaluate it again 5299IOperation increment = VisitRequired(userDefinedInfo.Addition); 5319IOperation controlVariableReferenceForAssignment; 5333IOperation condition = new BinaryOperation(BinaryOperatorKind.Or, 5375IOperation controlVariableReferenceForIncrement = visitLoopControlVariableReference(forceImplicit: true); // Yes we are going to evaluate it again 5376IOperation stepValueForIncrement = GetCaptureReference(stepValueId, operation.StepValue); 5385IOperation increment = new BinaryOperation(BinaryOperatorKind.Add, 5423IOperation visitLoopControlVariableReference(bool forceImplicit) 5437IOperation result = VisitRequired(operation.LoopControlVariable); 5444private static FlowCaptureReferenceOperation GetCaptureReference(int id, IOperation underlying) 5449internal override IOperation VisitAggregateQuery(IAggregateQueryOperation operation, int? captureIdForResult) 5453IOperation? previousAggregationGroup = _currentAggregationGroup; 5456IOperation result = VisitRequired(operation.Aggregation); 5462public override IOperation? VisitSwitch(ISwitchOperation operation, int? captureIdForResult) 5467IOperation switchValue = VisitAndCapture(operation.Value); 5509IOperation? condition = ((SwitchCaseOperation)section).Condition; 5541IOperation condition; 5551void handleEqualityCheck(IOperation compareWith) 5559IOperation rightOperand = VisitRequired(compareWith); 5560IOperation leftOperand = PopOperand(); 5662private IOperation MakeNullable(IOperation operand, ITypeSymbol type) 5670public override IOperation VisitSwitchCase(ISwitchCaseOperation operation, int? captureIdForResult) 5675public override IOperation VisitSingleValueCaseClause(ISingleValueCaseClauseOperation operation, int? captureIdForResult) 5680public override IOperation VisitDefaultCaseClause(IDefaultCaseClauseOperation operation, int? captureIdForResult) 5685public override IOperation VisitRelationalCaseClause(IRelationalCaseClauseOperation operation, int? captureIdForResult) 5690public override IOperation VisitRangeCaseClause(IRangeCaseClauseOperation operation, int? captureIdForResult) 5695public override IOperation VisitPatternCaseClause(IPatternCaseClauseOperation operation, int? captureIdForResult) 5700public override IOperation? VisitEnd(IEndOperation operation, int? captureIdForResult) 5713public override IOperation? VisitForLoop(IForLoopOperation operation, int? captureIdForResult) 5737ImmutableArray<IOperation> initialization = operation.Before; 5776internal override IOperation? VisitFixed(IFixedOperation operation, int? captureIdForResult) 5789public override IOperation? VisitVariableDeclarationGroup(IVariableDeclarationGroupOperation operation, int? captureIdForResult) 5842IOperation? initializer = null; 5852IOperation operationInitializer = VisitRequired(declaration.Initializer.Value); 5889public override IOperation VisitVariableDeclaration(IVariableDeclarationOperation operation, int? captureIdForResult) 5895public override IOperation VisitVariableDeclarator(IVariableDeclaratorOperation operation, int? captureIdForResult) 5901public override IOperation VisitVariableInitializer(IVariableInitializerOperation operation, int? captureIdForResult) 5907public override IOperation VisitFlowCapture(IFlowCaptureOperation operation, int? captureIdForResult) 5912public override IOperation VisitFlowCaptureReference(IFlowCaptureReferenceOperation operation, int? captureIdForResult) 5917public override IOperation VisitIsNull(IIsNullOperation operation, int? captureIdForResult) 5922public override IOperation VisitCaughtException(ICaughtExceptionOperation operation, int? captureIdForResult) 5927public override IOperation VisitInvocation(IInvocationOperation operation, int? captureIdForResult) 5930IOperation? instance = operation.TargetMethod.IsStatic ? null : operation.Instance; 5931(IOperation? visitedInstance, ImmutableArray<IArgumentOperation> visitedArguments) = VisitInstanceWithArguments(instance, operation.Arguments); 5937public override IOperation? VisitFunctionPointerInvocation(IFunctionPointerInvocationOperation operation, int? argument) 5940var target = operation.Target; 5946(IOperation visitedInstance, ImmutableArray<IArgumentOperation> visitedArguments) handlePointerAndArguments( 5947IOperation targetPointer, ImmutableArray<IArgumentOperation> arguments) 5952IOperation visitedInstance = PopOperand(); 5958private (IOperation? visitedInstance, ImmutableArray<IArgumentOperation> visitedArguments) VisitInstanceWithArguments(IOperation? instance, ImmutableArray<IArgumentOperation> arguments) 5967IOperation? visitedInstance = hasInstance ? PopOperand() : null; 5972internal override IOperation VisitNoPiaObjectCreation(INoPiaObjectCreationOperation operation, int? argument) 5976IOperation initializedInstance = new NoPiaObjectCreationOperation(initializer: null, semanticModel: null, operation.Syntax, operation.Type, IsImplicit(operation)); 5980public override IOperation VisitObjectCreation(IObjectCreationOperation operation, int? captureIdForResult) 5987IOperation initializedInstance = new ObjectCreationOperation(operation.Constructor, initializer: null, visitedArgs, semanticModel: null, 5993public override IOperation VisitTypeParameterObjectCreation(ITypeParameterObjectCreationOperation operation, int? captureIdForResult) 6000public override IOperation VisitDynamicObjectCreation(IDynamicObjectCreationOperation operation, int? captureIdForResult) 6004ImmutableArray<IOperation> visitedArguments = VisitArray(operation.Arguments); 6008IOperation initializedInstance = new DynamicObjectCreationOperation(initializer: null, visitedArguments, hasDynamicArguments.ArgumentNames, 6015private IOperation HandleObjectOrCollectionInitializer(IObjectOrCollectionInitializerOperation? initializer, IOperation objectCreation) 6032void visitInitializer(IObjectOrCollectionInitializerOperation initializerOperation, IOperation initializedInstance) 6037foreach (IOperation innerInitializer in initializerOperation.Initializers) 6045void handleInitializer(IOperation innerInitializer) 6080IOperation result; 6093IOperation right = VisitRequired(assignmentOperation.Value); 6094IOperation left = popTarget(assignmentOperation.Target); 6153IOperation instance = pushSuccess ? popTarget(memberInitializer.InitializedMember) : VisitRequired(memberInitializer.InitializedMember); 6158bool tryPushTarget(IOperation instance) 6225IOperation popTarget(IOperation originalTarget) 6227IOperation? instance; 6249ImmutableArray<IOperation> indices = PopArray(arrayElementReference.Indices); 6255IOperation index = PopOperand(); 6262ImmutableArray<IOperation> arguments = PopArray(dynamicAccess.Arguments); 6299var lhs = memberInitializer.InitializedMember; 6309foreach (var element in array.Initializer.ElementValues) 6326foreach (var index in arrayAccess.Indices) 6333foreach (var argument in dynamicIndexerAccess.Arguments) 6350foreach (var initializer in memberInitializer.Initializer.Initializers) 6357public override IOperation VisitObjectOrCollectionInitializer(IObjectOrCollectionInitializerOperation operation, int? captureIdForResult) 6360return MakeInvalidOperation(operation.Syntax, operation.Type, ImmutableArray<IOperation>.Empty); 6363public override IOperation VisitMemberInitializer(IMemberInitializerOperation operation, int? captureIdForResult) 6366return MakeInvalidOperation(operation.Syntax, operation.Type, ImmutableArray<IOperation>.Empty); 6369public override IOperation VisitAnonymousObjectCreation(IAnonymousObjectCreationOperation operation, int? captureIdForResult) 6373return new AnonymousObjectCreationOperation(initializers: ImmutableArray<IOperation>.Empty, semanticModel: null, 6386var initializerBuilder = ArrayBuilder<IOperation>.GetInstance(operation.Initializers.Length); 6400IOperation visitedTarget = new PropertyReferenceOperation(propertyReference.Property, propertyReference.ConstrainedToType, ImmutableArray<IArgumentOperation>.Empty, visitedPropertyInstance, 6402IOperation visitedValue = visitAndCaptureInitializer(propertyReference.Property, simpleAssignment.Value); 6420IOperation visitAndCaptureInitializer(IPropertySymbol initializedProperty, IOperation initializer) 6424IOperation captured = PeekOperand(); // Keep it on the stack so that we know it is still used. 6436public override IOperation? VisitLocalFunction(ILocalFunctionOperation operation, int? captureIdForResult) 6452private IOperation? VisitLocalFunctionAsRoot(ILocalFunctionOperation operation) 6459public override IOperation VisitAnonymousFunction(IAnonymousFunctionOperation operation, int? captureIdForResult) 6465public override IOperation VisitFlowAnonymousFunction(IFlowAnonymousFunctionOperation operation, int? captureIdForResult) 6470public override IOperation VisitArrayCreation(IArrayCreationOperation operation, int? captureIdForResult) 6489ImmutableArray<IOperation> visitedDimensions = PopArray(operation.DimensionSizes); 6495public override IOperation VisitArrayInitializer(IArrayInitializerOperation operation, int? captureIdForResult) 6503foreach (IOperation elementValue in initializer.ElementValues) 6519var builder = ArrayBuilder<IOperation>.GetInstance(initializer.ElementValues.Length); 6522IOperation elementValue = initializer.ElementValues[i]; 6524IOperation visitedElementValue; 6542public override IOperation? VisitCollectionExpression(ICollectionExpressionOperation operation, int? argument) 6547unwrapper: static (IOperation element) => 6553wrapper: (IOperation operation, int index, ImmutableArray<IOperation> elements) => 6575public override IOperation? VisitSpread(ISpreadOperation operation, int? argument) 6580public override IOperation VisitInstanceReference(IInstanceReferenceOperation operation, int? captureIdForResult) 6596return MakeInvalidOperation(operation.Syntax, operation.Type, ImmutableArray<IOperation>.Empty); 6608public override IOperation VisitDynamicInvocation(IDynamicInvocationOperation operation, int? captureIdForResult) 6614var instance = ((IDynamicMemberReferenceOperation)operation.Operation).Instance; 6625ImmutableArray<IOperation> rewrittenArguments = VisitArray(operation.Arguments); 6627IOperation rewrittenOperation; 6631IOperation? rewrittenInstance = dynamicMemberReference.Instance != null ? PopOperand() : null; 6645public override IOperation VisitDynamicIndexerAccess(IDynamicIndexerAccessOperation operation, int? captureIdForResult) 6649ImmutableArray<IOperation> rewrittenArguments = VisitArray(operation.Arguments); 6650IOperation rewrittenOperation = PopOperand(); 6656public override IOperation VisitDynamicMemberReference(IDynamicMemberReferenceOperation operation, int? captureIdForResult) 6662public override IOperation VisitDeconstructionAssignment(IDeconstructionAssignmentOperation operation, int? captureIdForResult) 6664(IOperation visitedTarget, IOperation visitedValue) = VisitPreservingTupleOperations(operation.Target, operation.Value); 6671private void PushTargetAndUnwrapTupleIfNecessary(IOperation value) 6677foreach (IOperation element in tuple.Elements) 6691private IOperation PopTargetAndWrapTupleIfNecessary(IOperation value) 6697var elementBuilder = ArrayBuilder<IOperation>.GetInstance(numElements); 6711public override IOperation VisitDeclarationExpression(IDeclarationExpressionOperation operation, int? captureIdForResult) 6716private IOperation VisitPreservingTupleOperations(IOperation operation) 6723private (IOperation visitedLeft, IOperation visitedRight) VisitPreservingTupleOperations(IOperation left, IOperation right) 6734IOperation visitedRight = VisitRequired(right); 6735IOperation visitedLeft = PopTargetAndWrapTupleIfNecessary(left); 6740public override IOperation VisitTuple(ITupleOperation operation, int? captureIdForResult) 6745internal override IOperation VisitNoneOperation(IOperation operation, int? captureIdForResult) 6757private IOperation VisitNoneOperationStatement(IOperation operation) 6761return new NoneOperation(ImmutableArray<IOperation>.Empty, semanticModel: null, operation.Syntax, operation.Type, operation.GetConstantValue(), IsImplicit(operation)); 6764private IOperation VisitNoneOperationExpression(IOperation operation) 6770public override IOperation? VisitInterpolatedStringHandlerCreation(IInterpolatedStringHandlerCreationOperation operation, int? captureIdForResult) 6857IOperation visitedAppendCall = VisitRequired(appendCall.AppendCall); 6954public override IOperation? VisitInterpolatedStringAddition(IInterpolatedStringAdditionOperation operation, int? captureIdForResult) 6959public override IOperation? VisitInterpolatedStringAppend(IInterpolatedStringAppendOperation operation, int? captureIdForResult) 6964public override IOperation? VisitInterpolatedStringHandlerArgumentPlaceholder(IInterpolatedStringHandlerArgumentPlaceholderOperation operation, int? captureIdForResult) 6976if (_currentInterpolatedStringHandlerArgumentContext.HasReceiver && tryGetArgumentOrReceiver(-1) is IOperation receiverCapture) 6983return new InvalidOperation(ImmutableArray<IOperation>.Empty, semanticModel: null, operation.Syntax, operation.Type, operation.GetConstantValue(), isImplicit: true); 6989if (tryGetArgumentOrReceiver(operation.ArgumentIndex) is IOperation argumentCapture) 6996return new InvalidOperation(ImmutableArray<IOperation>.Empty, semanticModel: null, operation.Syntax, operation.Type, operation.GetConstantValue(), isImplicit: true); 7003IOperation? tryGetArgumentOrReceiver(int argumentIndex) 7025public override IOperation VisitInterpolatedString(IInterpolatedStringOperation operation, int? captureIdForResult) 7053IOperation? rewrittenFormatString; 7064var rewrittenAlignment = interpolation.Alignment != null ? PopOperand() : null; 7065var rewrittenExpression = PopOperand(); 7070var rewrittenInterpolationText = VisitRequired(interpolatedStringText.Text, argument: null); 7086public override IOperation VisitInterpolatedStringText(IInterpolatedStringTextOperation operation, int? captureIdForResult) 7091public override IOperation VisitInterpolation(IInterpolationOperation operation, int? captureIdForResult) 7096public override IOperation VisitNameOf(INameOfOperation operation, int? captureIdForResult) 7102public override IOperation VisitLiteral(ILiteralOperation operation, int? captureIdForResult) 7107public override IOperation? VisitUtf8String(IUtf8StringOperation operation, int? captureIdForResult) 7112public override IOperation VisitLocalReference(ILocalReferenceOperation operation, int? captureIdForResult) 7118public override IOperation VisitParameterReference(IParameterReferenceOperation operation, int? captureIdForResult) 7124public override IOperation VisitFieldReference(IFieldReferenceOperation operation, int? captureIdForResult) 7126IOperation? visitedInstance = operation.Field.IsStatic ? null : Visit(operation.Instance); 7131public override IOperation VisitMethodReference(IMethodReferenceOperation operation, int? captureIdForResult) 7133IOperation? visitedInstance = operation.Method.IsStatic ? null : Visit(operation.Instance); 7138public override IOperation VisitPropertyReference(IPropertyReferenceOperation operation, int? captureIdForResult) 7147if (_currentImplicitInstance.AnonymousTypePropertyValues.TryGetValue(operation.Property, out IOperation? captured)) 7155return MakeInvalidOperation(operation.Syntax, operation.Type, ImmutableArray<IOperation>.Empty); 7160IOperation? instance = operation.Property.IsStatic ? null : operation.Instance; 7161(IOperation? visitedInstance, ImmutableArray<IArgumentOperation> visitedArguments) = VisitInstanceWithArguments(instance, operation.Arguments); 7167public override IOperation VisitEventReference(IEventReferenceOperation operation, int? captureIdForResult) 7169IOperation? visitedInstance = operation.Event.IsStatic ? null : Visit(operation.Instance); 7174public override IOperation VisitTypeOf(ITypeOfOperation operation, int? captureIdForResult) 7179public override IOperation VisitParenthesized(IParenthesizedOperation operation, int? captureIdForResult) 7184public override IOperation VisitAwait(IAwaitOperation operation, int? captureIdForResult) 7189public override IOperation VisitSizeOf(ISizeOfOperation operation, int? captureIdForResult) 7194public override IOperation VisitStop(IStopOperation operation, int? captureIdForResult) 7199public override IOperation VisitIsType(IIsTypeOperation operation, int? captureIdForResult) 7204public override IOperation? VisitParameterInitializer(IParameterInitializerOperation operation, int? captureIdForResult) 7214public override IOperation? VisitFieldInitializer(IFieldInitializerOperation operation, int? captureIdForResult) 7232public override IOperation? VisitPropertyInitializer(IPropertyInitializerOperation operation, int? captureIdForResult) 7250var value = new InvalidOperation(ImmutableArray<IOperation>.Empty, semanticModel: null, 7266IOperation propertyRef = new PropertyReferenceOperation(propertySymbol, constrainedToType: null, arguments, instance, 7274private void VisitInitializer(IOperation rewrittenTarget, ISymbolInitializerOperation initializer) 7287public override IOperation VisitEventAssignment(IEventAssignmentOperation operation, int? captureIdForResult) 7290IOperation visitedEventReference, visitedHandler; 7298var eventReferenceInstance = eventReference.Event.IsStatic ? null : eventReference.Instance; 7306IOperation? visitedInstance = eventReferenceInstance == null ? null : PopOperand(); 7325IOperation current = operation.EventReference; 7345public override IOperation VisitRaiseEvent(IRaiseEventOperation operation, int? captureIdForResult) 7351(IOperation? visitedInstance, ImmutableArray<IArgumentOperation> visitedArguments) = 7361public override IOperation VisitAddressOf(IAddressOfOperation operation, int? captureIdForResult) 7366public override IOperation VisitIncrementOrDecrement(IIncrementOrDecrementOperation operation, int? captureIdForResult) 7373public override IOperation VisitDiscardOperation(IDiscardOperation operation, int? captureIdForResult) 7378public override IOperation VisitDiscardPattern(IDiscardPatternOperation pat, int? captureIdForResult) 7383public override IOperation VisitOmittedArgument(IOmittedArgumentOperation operation, int? captureIdForResult) 7388internal override IOperation VisitPlaceholder(IPlaceholderOperation operation, int? captureIdForResult) 7422public override IOperation VisitConversion(IConversionOperation operation, int? captureIdForResult) 7427public override IOperation VisitDefaultValue(IDefaultValueOperation operation, int? captureIdForResult) 7432public override IOperation VisitIsPattern(IIsPatternOperation operation, int? captureIdForResult) 7437IOperation visitedValue = PopOperand(); 7443public override IOperation VisitInvalid(IInvalidOperation operation, int? captureIdForResult) 7445var children = ArrayBuilder<IOperation>.GetInstance(); 7460foreach (var argument in children) 7472IOperation initializedInstance = new InvalidOperation(children.ToImmutableAndFree(), semanticModel: null, operation.Syntax, operation.Type, 7480IOperation result; 7492IOperation visitInvalidOperationStatement(IInvalidOperation invalidOperation) 7496return new InvalidOperation(ImmutableArray<IOperation>.Empty, semanticModel: null, invalidOperation.Syntax, invalidOperation.Type, invalidOperation.GetConstantValue(), IsImplicit(invalidOperation)); 7499IOperation visitInvalidOperationExpression(IInvalidOperation invalidOperation) 7507public override IOperation? VisitReDim(IReDimOperation operation, int? argument) 7533var visitedOperand = PopOperand(); 7538public override IOperation VisitReDimClause(IReDimClauseOperation operation, int? argument) 7543public override IOperation VisitTranslatedQuery(ITranslatedQueryOperation operation, int? captureIdForResult) 7548public override IOperation VisitConstantPattern(IConstantPatternOperation operation, int? captureIdForResult) 7554public override IOperation VisitRelationalPattern(IRelationalPatternOperation operation, int? argument) 7566public override IOperation VisitBinaryPattern(IBinaryPatternOperation operation, int? argument) 7607public override IOperation VisitNegatedPattern(INegatedPatternOperation operation, int? argument) 7618public override IOperation VisitTypePattern(ITypePatternOperation operation, int? argument) 7629public override IOperation VisitDeclarationPattern(IDeclarationPatternOperation operation, int? captureIdForResult) 7642public override IOperation VisitSlicePattern(ISlicePatternOperation operation, int? argument) 7654public override IOperation VisitListPattern(IListPatternOperation operation, int? argument) 7668public override IOperation VisitRecursivePattern(IRecursivePatternOperation operation, int? argument) 7683public override IOperation VisitPropertySubpattern(IPropertySubpatternOperation operation, int? argument) 7693public override IOperation VisitDelegateCreation(IDelegateCreationOperation operation, int? captureIdForResult) 7699public override IOperation VisitRangeOperation(IRangeOperation operation, int? argument) 7706IOperation? visitedRightOperand = null; 7712IOperation? visitedLeftOperand = operation.LeftOperand is null ? null : PopOperand(); 7717public override IOperation VisitSwitchExpression(ISwitchExpressionOperation operation, int? captureIdForResult) 7744var capturedInput = VisitAndCapture(operation.Value); 7794var makeException = (matchFailureCtor is null) 7795? MakeInvalidOperation(operation.Syntax, type: _compilation.GetSpecialType(SpecialType.System_Object), ImmutableArray<IOperation>.Empty) 7809private void VisitUsingVariableDeclarationOperation(IUsingDeclarationOperation operation, ReadOnlySpan<IOperation> statements) 7811IOperation? saveCurrentStatement = _currentStatement; 7818ArrayBuilder<IOperation> statementsBuilder = ArrayBuilder<IOperation>.GetInstance(statements.Length); 7819ArrayBuilder<IOperation>? localFunctionsBuilder = null; 7821foreach (var statement in statements) 7825(localFunctionsBuilder ??= ArrayBuilder<IOperation>.GetInstance()).Add(statement); 7854public IOperation? Visit(IOperation? operation) 7863public IOperation? VisitRequired(IOperation? operation, int? argument = null) 7866var result = Visit(operation, argument); 7873public IOperation? BaseVisitRequired(IOperation? operation, int? argument) 7877var result = base.Visit(operation, argument); 7884public override IOperation? Visit(IOperation? operation, int? argument) 7893var result = PopStackFrame(PushStackFrame(), base.Visit(operation, argument)); 7899public override IOperation DefaultVisit(IOperation operation, int? captureIdForResult) 7905public override IOperation VisitArgument(IArgumentOperation operation, int? captureIdForResult) 7910public override IOperation VisitUsingDeclaration(IUsingDeclarationOperation operation, int? captureIdForResult) 7915public override IOperation VisitWith(IWithOperation operation, int? captureIdForResult) 7924IOperation visitedInstance = VisitRequired(operation.Operand); 7925IOperation cloned; 7942IOperation handleAnonymousTypeWithExpression(WithOperation operation, int? captureIdForResult) 7975var explicitProperties = new Dictionary<IPropertySymbol, IOperation>(SymbolEqualityComparer.IgnoreAll); 7976var initializerBuilder = ArrayBuilder<IOperation>.GetInstance(initializers.Length); 7979foreach (IOperation initializer in initializers) 8024if (explicitProperties.TryGetValue(property, out var assignment)) 8056SimpleAssignmentOperation makeAssignment(IPropertySymbol property, IOperation capturedValue, WithOperation operation) 8071static bool setsAllProperties(ImmutableArray<IOperation> initializers, IEnumerable<IPropertySymbol> properties) 8074foreach (var initializer in initializers) 8095public override IOperation VisitAttribute(IAttributeOperation operation, int? captureIdForResult)
Operations\ControlFlowGraphBuilder.ImplicitInstanceInfo.cs (6)
23public IOperation? ImplicitInstance { get; } 33public PooledDictionary<IPropertySymbol, IOperation>? AnonymousTypePropertyValues { get; } 35public ImplicitInstanceInfo(IOperation currentImplicitInstance) 49AnonymousTypePropertyValues = PooledDictionary<IPropertySymbol, IOperation>.GetInstance(); 66AnonymousTypePropertyValues = PooledDictionary<IPropertySymbol, IOperation>.GetInstance(); 68foreach (KeyValuePair<IPropertySymbol, IOperation> pair in context.AnonymousTypePropertyValues)
Operations\ControlFlowGraphBuilder.InterpolatedStringContext.cs (2)
47private void AssertContainingContextIsForThisCreation(IOperation placeholderOperation, bool assertArgumentContext) 52IOperation? operation = placeholderOperation.Parent;
Operations\ControlFlowGraphBuilder.RegionBuilder.cs (9)
311foreach ((IMethodSymbol method, IOperation _) in LocalFunctions) 387foreach (IOperation o in block.StatementsOpt) 399OperationVisitor<(ImmutableDictionary<IFlowAnonymousFunctionOperation, (ControlFlowRegion region, int ordinal)>.Builder map, ControlFlowRegion region), IOperation> 403public override IOperation? VisitFlowAnonymousFunction( 411internal override IOperation? VisitNoneOperation(IOperation operation, (ImmutableDictionary<IFlowAnonymousFunctionOperation, (ControlFlowRegion region, int ordinal)>.Builder map, ControlFlowRegion region) argument) 416public override IOperation? DefaultVisit( 417IOperation operation, 420foreach (IOperation child in ((Operation)operation).ChildOperations)
Operations\IOperation.cs (2)
25IOperation? Parent { get; } 51IEnumerable<IOperation> Children { get; }
Operations\IOperation.OperationList.cs (14)
23public readonly partial struct OperationList : IReadOnlyCollection<IOperation> 36public ImmutableArray<IOperation> ToImmutableArray() 41return ImmutableArray<IOperation>.Empty; 47var builder = ArrayBuilder<IOperation>.GetInstance(Count); 48foreach (var child in this) 56IEnumerator<IOperation> IEnumerable<IOperation>.GetEnumerator() 60return SpecializedCollections.EmptyEnumerator<IOperation>(); 66IEnumerator IEnumerable.GetEnumerator() => ((IEnumerable<IOperation>)this).GetEnumerator(); 70public IOperation First() 83public IOperation Last() 121public IOperation Current 144private sealed class EnumeratorImpl : IEnumerator<IOperation> 153public IOperation Current => _enumerator.Current;
Operations\IOperation.OperationList.Reversed.cs (15)
25public readonly struct Reversed : IReadOnlyCollection<IOperation> 38public ImmutableArray<IOperation> ToImmutableArray() 44return ImmutableArray<IOperation>.Empty; 50var builder = ArrayBuilder<IOperation>.GetInstance(Count); 51foreach (var child in this) 58static ImmutableArray<IOperation> reverseArray(ImmutableArray<IOperation> input) 60var builder = ArrayBuilder<IOperation>.GetInstance(input.Length); 70IEnumerator<IOperation> IEnumerable<IOperation>.GetEnumerator() 74return SpecializedCollections.EmptyEnumerator<IOperation>(); 80IEnumerator IEnumerable.GetEnumerator() => ((IEnumerable<IOperation>)this).GetEnumerator(); 101public IOperation Current 124private sealed class EnumeratorImpl : IEnumerator<IOperation> 133public IOperation Current => _enumerator.Current;
Operations\Loops\ForToLoopOperationInfo.cs (4)
13public readonly IOperation LessThanOrEqual; 14public readonly IOperation GreaterThanOrEqual; 16public ForToLoopOperationUserDefinedInfo(IBinaryOperation addition, IBinaryOperation subtraction, IOperation lessThanOrEqual, IOperation greaterThanOrEqual)
Operations\Operation.cs (19)
20protected static readonly IOperation s_unset = new EmptyOperation(semanticModel: null, syntax: null!, isImplicit: true); 25private IOperation? _parentDoNotAccessDirectly; 48public IOperation? Parent 107IEnumerable<IOperation> IOperation.Children => this.ChildOperations; 110public IOperation.OperationList ChildOperations => new IOperation.OperationList(this); 113internal abstract IOperation GetCurrent(int slot, int index); 123SemanticModel? IOperation.SemanticModel => _owningSemanticModelOpt?.ContainingPublicModelOrSelf; 127/// Note that this may be different than <see cref="IOperation.SemanticModel"/>, which 137protected void SetParentOperation(IOperation? parent) 148public static T? SetParentOperation<T>(T? operation, IOperation? parent) where T : IOperation 156public static ImmutableArray<T> SetParentOperation<T>(ImmutableArray<T> operations, IOperation? parent) where T : IOperation 174internal static void VerifyParentOperation(IOperation? parent, IOperation child) 183internal static void VerifyParentOperation<T>(IOperation? parent, ImmutableArray<T> children) where T : IOperation
Operations\OperationCloner.cs (14)
11internal sealed partial class OperationCloner : OperationVisitor<object?, IOperation> 14public IOperation? Visit(IOperation? operation) 19internal override IOperation VisitNoneOperation(IOperation operation, object? argument) 24public override IOperation VisitFlowAnonymousFunction(IFlowAnonymousFunctionOperation operation, object? argument) 30public override IOperation VisitDynamicObjectCreation(IDynamicObjectCreationOperation operation, object? argument) 35public override IOperation VisitDynamicInvocation(IDynamicInvocationOperation operation, object? argument) 40public override IOperation VisitDynamicIndexerAccess(IDynamicIndexerAccessOperation operation, object? argument) 45public override IOperation VisitInvalid(IInvalidOperation operation, object? argument) 50public override IOperation VisitFlowCapture(IFlowCaptureOperation operation, object? argument) 55public override IOperation VisitIsNull(IIsNullOperation operation, object? argument) 60public override IOperation VisitCaughtException(ICaughtExceptionOperation operation, object? argument) 65public override IOperation VisitStaticLocalInitializationSemaphore(IStaticLocalInitializationSemaphoreOperation operation, object? argument)
Operations\OperationExtensions.cs (15)
28internal static bool HasErrors(this IOperation operation, Compilation compilation, CancellationToken cancellationToken = default(CancellationToken)) 70public static IEnumerable<IOperation> Descendants(this IOperation? operation) 79public static IEnumerable<IOperation> DescendantsAndSelf(this IOperation? operation) 84private static IEnumerable<IOperation> Descendants(IOperation? operation, bool includeSelf) 96var stack = ArrayBuilder<IOperation.OperationList.Enumerator>.GetInstance(); 108var current = iterator.Current; 329/// Gets the root operation for the <see cref="IOperation"/> tree containing the given <paramref name="operation"/>. 332internal static IOperation GetRootOperation(this IOperation operation) 351public static IOperation? GetCorrespondingOperation(this IBranchOperation operation) 373for (IOperation current = operation; current.Parent != null; current = current.Parent) 388internal static ConstantValue? GetConstantValue(this IOperation operation)
Operations\OperationFactory.cs (1)
11public static IInvalidOperation CreateInvalidOperation(SemanticModel semanticModel, SyntaxNode syntax, ImmutableArray<IOperation> children, bool isImplicit)
Operations\OperationMapBuilder.cs (13)
19internal static void AddToMap(IOperation root, Dictionary<SyntaxNode, IOperation> dictionary) 25private sealed class Walker : OperationWalker<Dictionary<SyntaxNode, IOperation>> 29public override object? DefaultVisit(IOperation operation, Dictionary<SyntaxNode, IOperation> argument) 35public override object? VisitBinaryOperator([DisallowNull] IBinaryOperation? operation, Dictionary<SyntaxNode, IOperation> argument) 57public override object? VisitConditional(IConditionalOperation operation, Dictionary<SyntaxNode, IOperation> argument) 78public override object? VisitBinaryPattern(IBinaryPatternOperation operation, Dictionary<SyntaxNode, IOperation> argument) 100internal override object? VisitNoneOperation(IOperation operation, Dictionary<SyntaxNode, IOperation> argument) 107private static void RecordOperation(IOperation operation, Dictionary<SyntaxNode, IOperation> argument) 114$"Duplicate operation node for {operation.Syntax}. Existing node is {(argument.TryGetValue(operation.Syntax, out var original) ? (OperationKind?)original.Kind : null)}, new node is {operation.Kind}.");
Operations\OperationNodes.cs (26)
18public NoneOperation(ImmutableArray<IOperation> children, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) : 26internal ImmutableArray<IOperation> Children { get; } 28internal override IOperation GetCurrent(int slot, int index) 87public InvalidOperation(ImmutableArray<IOperation> children, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, ConstantValue? constantValue, bool isImplicit) : 97internal ImmutableArray<IOperation> Children { get; } 99internal override IOperation GetCurrent(int slot, int index) 163internal override IOperation GetCurrent(int slot, int index) => throw ExceptionUtilities.UnexpectedValue((slot, index)); 235protected HasDynamicArgumentsExpression(ImmutableArray<IOperation> arguments, ImmutableArray<string?> argumentNames, ImmutableArray<RefKind> argumentRefKinds, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) : 246public ImmutableArray<IOperation> Arguments { get; } 252public DynamicObjectCreationOperation(IObjectOrCollectionInitializerOperation? initializer, ImmutableArray<IOperation> arguments, ImmutableArray<string?> argumentNames, ImmutableArray<RefKind> argumentRefKinds, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) : 264internal override IOperation GetCurrent(int slot, int index) 334public DynamicInvocationOperation(IOperation operation, ImmutableArray<IOperation> arguments, ImmutableArray<string?> argumentNames, ImmutableArray<RefKind> argumentRefKinds, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) : 342internal override IOperation GetCurrent(int slot, int index) 400public IOperation Operation { get; } 416public DynamicIndexerAccessOperation(IOperation operation, ImmutableArray<IOperation> arguments, ImmutableArray<string?> argumentNames, ImmutableArray<RefKind> argumentRefKinds, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) : 422public IOperation Operation { get; } 428internal override IOperation GetCurrent(int slot, int index) 513internal override IOperation GetCurrent(int slot, int index) 517IOperation getCurrentSwitchTop() 529IOperation getCurrentSwitchBottom() 649public FlowCaptureOperation(int id, SyntaxNode syntax, IOperation value) : 658public IsNullOperation(SyntaxNode syntax, IOperation operand, ITypeSymbol type, ConstantValue? constantValue) : 688public static BlockOperation CreateTemporaryBlock(ImmutableArray<IOperation> statements, SemanticModel semanticModel, SyntaxNode syntax) 691private BlockOperation(ImmutableArray<IOperation> statements, SemanticModel semanticModel, SyntaxNode syntax)
Operations\OperationVisitor.cs (2)
8/// Represents a <see cref="IOperation"/> visitor that visits only the single IOperation 21/// Represents a <see cref="IOperation"/> visitor that visits only the single IOperation
Operations\OperationWalker.cs (12)
8/// Represents a <see cref="OperationVisitor"/> that descends an entire <see cref="IOperation"/> tree 15private void VisitChildOperations(IOperation operation) 17foreach (var child in ((Operation)operation).ChildOperations) 23public override void Visit(IOperation? operation) 40public override void DefaultVisit(IOperation operation) 45internal override void VisitNoneOperation(IOperation operation) 52/// Represents a <see cref="OperationVisitor{TArgument, TResult}"/> that descends an entire <see cref="IOperation"/> tree 59private void VisitChildrenOperations(IOperation operation, TArgument argument) 61foreach (var child in ((Operation)operation).ChildOperations) 67public override object? Visit(IOperation? operation, TArgument argument) 86public override object? DefaultVisit(IOperation operation, TArgument argument) 92internal override object? VisitNoneOperation(IOperation operation, TArgument argument)
Microsoft.CodeAnalysis.CodeStyle (244)
src\Analyzers\Core\Analyzers\ConvertTypeofToNameof\AbstractConvertTypeOfToNameOfDiagnosticAnalyzer.cs (1)
54private static bool IsValidOperation(IOperation operation)
src\Analyzers\Core\Analyzers\Helpers\HashCodeAnalyzer\HashCodeAnalyzer.cs (10)
58public (bool accessesBase, ImmutableArray<ISymbol> members, ImmutableArray<IOperation> statements) GetHashedMembers(ISymbol? owningSymbol, IOperation? operation) 90IMethodSymbol method, ImmutableArray<IOperation> statements) 113IMethodSymbol method, ImmutableArray<IOperation> statements) 152var initializerValue = declaration.Initializer?.Value ?? declarator.Initializer?.Value; 198var statement = statements[i]; 224private static bool IsLocalReference(IOperation value, ILocalSymbol accumulatorVariable) 230private static bool IsLiteralNumber(IOperation value) 238private static IOperation Unwrap(IOperation value)
src\Analyzers\Core\Analyzers\Helpers\HashCodeAnalyzer\HashCodeAnalyzer.OperationDeconstructor.cs (4)
17/// Breaks down complex <see cref="IOperation"/> trees, looking for particular 45public bool TryAddHashedSymbol(IOperation value, bool seenHash) 152foreach (var element in tupleOperation.Elements) 168private static bool TryGetFieldOrProperty(IOperation operation, [NotNullWhen(true)] out ISymbol? symbol)
src\Analyzers\Core\Analyzers\PopulateSwitch\AbstractPopulateSwitchDiagnosticAnalyzer.cs (3)
17where TSwitchOperation : IOperation 34protected abstract IOperation GetValueOfSwitchOperation(TSwitchOperation operation); 59var value = GetValueOfSwitchOperation(switchOperation);
src\Analyzers\Core\Analyzers\PopulateSwitch\AbstractPopulateSwitchExpressionDiagnosticAnalyzer.cs (1)
23protected override IOperation GetValueOfSwitchOperation(ISwitchExpressionOperation operation)
src\Analyzers\Core\Analyzers\PopulateSwitch\AbstractPopulateSwitchStatementDiagnosticAnalyzer.cs (1)
23protected override IOperation GetValueOfSwitchOperation(ISwitchOperation operation)
src\Analyzers\Core\Analyzers\PopulateSwitch\PopulateSwitchExpressionHelpers.cs (2)
18var switchExpression = operation.Value; 76private static void RemoveIfConstantPatternHasValue(IOperation operation, Dictionary<long, ISymbol> enumMembers)
src\Analyzers\Core\Analyzers\PopulateSwitch\PopulateSwitchStatementHelpers.cs (2)
57var switchExpression = switchStatement.Value; 118var value = ((ISingleValueCaseClauseOperation)clause).Value;
src\Analyzers\Core\Analyzers\QualifyMemberAccess\AbstractQualifyMemberAccessDiagnosticAnalyzer.cs (4)
52protected abstract Location GetLocation(IOperation operation); 77private void AnalyzeOperation(OperationAnalysisContext context, IOperation operation, IOperation? instanceOperation) 138private static bool IsStaticMemberOrIsLocalFunction(IOperation operation)
src\Analyzers\Core\Analyzers\RemoveRedundantEquality\AbstractRemoveRedundantEqualityDiagnosticAnalyzer.cs (3)
80IOperation leftOperand, 81IOperation rightOperand, 119static bool? TryGetLiteralValue(IOperation? operand)
src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\SuppressMessageAttributeState.cs (9)
49out ImmutableArray<(string name, IOperation value)> namedAttributeArguments) 51var operation = (model.GetOperation(attributeSyntax, cancellationToken) as IAttributeOperation)?.Operation; 58using var _ = ArrayBuilder<(string name, IOperation value)>.GetInstance(out var builder); 59foreach (var initializer in initializerOperation.Initializers) 73public static bool HasValidScope(ImmutableArray<(string name, IOperation value)> namedAttributeArguments, out TargetScope targetScope) 91ImmutableArray<(string name, IOperation value)> namedAttributeArguments, 95out IOperation? targetValueOperation, 131ImmutableArray<(string name, IOperation value)> namedAttributeArguments, 134[NotNullWhen(returnValue: true)] out IOperation? argumentValueOperation)
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (4)
231var operation = context.Operation; 296var operation = operationContext.Operation; 412var operation = operationContext.Operation; 443var nameofArgument = ((INameOfOperation)operationContext.Operation).Argument;
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.cs (2)
110protected abstract Location GetDefinitionLocationToFade(IOperation unusedDefinition); 124protected virtual bool ShouldBailOutFromRemovableAssignmentAnalysis(IOperation unusedSymbolWriteOperation)
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.BlockAnalyzer.cs (17)
32/// We use this value in <see cref="ShouldAnalyze(IOperation, ISymbol, ref bool)"/> to determine whether to bail from analysis or not. 45/// We use this value in <see cref="ShouldAnalyze(IOperation, ISymbol, ref bool)"/> to determine whether to bail from analysis or not. 51/// We use this value in <see cref="ShouldAnalyze(IOperation, ISymbol, ref bool)"/> to determine whether to bail from analysis or not. 98var firstBlock = context.OperationBlocks[0]; 138foreach (var operationBlock in context.OperationBlocks) 149foreach (var operationBlock in context.OperationBlocks) 170var value = expressionStatement.Operation; 253/// delegate escape, and corresponding bail out from flow analysis in <see cref="ShouldAnalyze(IOperation, ISymbol, ref bool)"/>. 257private static bool IsHandledDelegateCreationOrAnonymousFunctionTreeShape(IOperation operation) 301/// delegate escape, and corresponding bail out from flow analysis in <see cref="ShouldAnalyze(IOperation, ISymbol, ref bool)"/>. 306private static bool IsHandledLocalOrParameterReferenceTreeShape(IOperation operation) 366private bool ShouldAnalyze(IOperation operationBlock, ISymbol owningSymbol, ref bool hasUnknownOperationNoneDescendant) 377foreach (var operation in operationBlock.Descendants()) 490foreach (var operationBlock in context.OperationBlocks) 590IOperation unreadWriteOperation, 633bool IsRemovableAssignmentWithoutSideEffects(IOperation unusedSymbolWriteOperation) 657static bool IsRemovableAssignmentValueWithoutSideEffects(IOperation assignmentValue)
src\Analyzers\Core\Analyzers\SimplifyInterpolation\AbstractSimplifyInterpolationHelpers.cs (17)
24protected abstract SyntaxNode GetPreservedInterpolationExpressionSyntax(IOperation operation); 39var expression = Unwrap(interpolation.Expression); 54private static IOperation? Unwrap(IOperation? expression, bool towardsParent = false) 76IVirtualCharService virtualCharService, ISyntaxFacts syntaxFacts, IOperation expression, out IOperation unwrapped, 82HasNonImplicitInstance(invocation, out var instance) && 137private static bool IsInvariantCultureReference(IOperation operation) 156private static bool IsInsideFormattableStringInvariant(IOperation operation) 177private static IEnumerable<IOperation> AncestorsAndSelf(IOperation operation) 179for (var current = operation; current is not null; current = current.Parent) 192IOperation expression, out IOperation unwrapped, 197HasNonImplicitInstance(invocation, out var instance)) 208var alignmentOp = invocation.Arguments[0].Value; 235private static bool HasNonImplicitInstance(IInvocationOperation invocation, [NotNullWhen(true)] out IOperation? instance)
src\Analyzers\Core\Analyzers\UseAutoProperty\AbstractUseAutoPropertyAnalyzer.cs (1)
515var operation = semanticModel.GetOperation(expression, cancellationToken);
src\Analyzers\Core\Analyzers\UseConditionalExpression\ForAssignment\AbstractUseConditionalExpressionForAssignmentDiagnosticAnalyzer.cs (2)
31GetSyntaxFacts(), ifOperation, out var isRef, out var trueStatement, out var falseStatement, out var trueAssignment, out var falseAssignment))
src\Analyzers\Core\Analyzers\UseConditionalExpression\ForAssignment\UseConditionalExpressionForAssignmentHelpers.cs (9)
20[NotNullWhen(true)] out IOperation trueStatement, 21[NotNullWhen(true)] out IOperation? falseStatement, 93static bool ReferencesDeclaredVariableInAssignment(IOperation condition, IOperation? trueTarget, IOperation? falseTarget) 98foreach (var operation in condition.DescendantsAndSelf()) 119static bool ContainsLocalReference(HashSet<ILocalSymbol> declaredPatternSymbols, IOperation? target) 123foreach (var operation in target.DescendantsAndSelf()) 138[NotNullWhen(true)] IOperation? statement,
src\Analyzers\Core\Analyzers\UseConditionalExpression\ForReturn\AbstractUseConditionalExpressionForReturnDiagnosticAnalyzer.cs (3)
31GetSyntaxFacts(), ifOperation, containingSymbol, out var isRef, out var trueStatement, out var falseStatement, out var trueReturn, out var falseReturn)) 51protected virtual bool IsStatementSupported(IOperation statement)
src\Analyzers\Core\Analyzers\UseConditionalExpression\ForReturn\UseConditionalExpressionForReturnHelpers.cs (3)
18[NotNullWhen(true)] out IOperation? trueStatement, 19[NotNullWhen(true)] out IOperation? falseStatement, 127private static bool IsReturnExprOrThrow(IOperation? statement)
src\Analyzers\Core\Analyzers\UseConditionalExpression\UseConditionalExpressionHelpers.cs (7)
21IOperation whenTrue, IOperation whenFalse) 59public static IOperation? UnwrapSingleStatementBlock(IOperation? statement) 104public static bool IsBooleanLiteral(IOperation trueValue, bool val) 107public static bool CanSimplify(IOperation trueValue, IOperation falseValue, bool isRef, out bool negate)
src\Analyzers\Core\Analyzers\UseSystemHashCode\UseSystemHashCodeDiagnosticAnalyzer.cs (1)
50var operation = context.OperationBlocks[0];
src\Analyzers\Core\Analyzers\UseThrowExpression\AbstractUseThrowExpressionDiagnosticAnalyzer.cs (4)
214var condition = ifStatement.Condition; 241IOperation operation, 263private static bool IsNull(IOperation operation) 274var containingOperation = semanticModel.GetOperation(throwStatement.GetRequiredParent(), cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\AnalysisContextExtensions.cs (2)
186public static SyntaxNode GetAnalysisRoot(this OperationBlockStartAnalysisContext context, IOperation operationBlock, bool findInTrivia, bool getInnermostNodeForTie = false) 192public static SyntaxNode GetAnalysisRoot(this OperationBlockAnalysisContext context, IOperation operationBlock, bool findInTrivia, bool getInnermostNodeForTie = false)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\BasicBlockExtensions.cs (4)
12public static IEnumerable<IOperation> DescendantOperations(this BasicBlock basicBlock) 14foreach (var statement in basicBlock.Operations) 16foreach (var operation in statement.DescendantsAndSelf()) 24foreach (var operation in basicBlock.BranchValue.DescendantsAndSelf())
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ControlFlowGraphExtensions.cs (2)
27public static IEnumerable<IOperation> DescendantOperations(this ControlFlowGraph cfg) 31where T : IOperation
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (32)
18public static bool IsTargetOfObjectMemberInitializer(this IOperation operation) 27public static ValueUsageInfo GetValueUsageInfo(this IOperation operation, ISymbol containingSymbol) 236public static IMethodSymbol? TryGetContainingAnonymousFunctionOrLocalFunction(this IOperation? operation) 256public static bool IsInLeftOfDeconstructionAssignment(this IOperation operation, [NotNullWhen(true)] out IDeconstructionAssignmentOperation? deconstructionAssignment) 260var previousOperation = operation; 261var current = operation.Parent; 292public static bool IsAnyCompoundAssignment(this IOperation operation) 305public static bool IsInsideCatchRegion(this IOperation operation, ControlFlowGraph cfg) 325foreach (var descendant in block.DescendantOperations()) 338public static bool HasAnyOperationDescendant(this ImmutableArray<IOperation> operationBlocks, Func<IOperation, bool> predicate) 340foreach (var operationBlock in operationBlocks) 351public static bool HasAnyOperationDescendant(this IOperation operationBlock, Func<IOperation, bool> predicate) 354public static bool HasAnyOperationDescendant(this IOperation operationBlock, Func<IOperation, bool> predicate, [NotNullWhen(true)] out IOperation? foundOperation) 358foreach (var descendant in operationBlock.DescendantsAndSelf()) 371public static bool HasAnyOperationDescendant(this ImmutableArray<IOperation> operationBlocks, OperationKind kind) 374public static bool IsNumericLiteral(this IOperation operation) 377public static bool IsNullLiteral(this IOperation operand) 386public static IOperation? WalkDownConversion(this IOperation? operation) 396public static bool IsSingleThrowNotImplementedOperation([NotNullWhen(true)] this IOperation? firstBlock) 412var firstOp = block.Operations.Length == 1 434static IOperation? TryGetSingleExplicitStatement(ImmutableArray<IOperation> operations) 436IOperation? firstOp = null; 437foreach (var operation in operations) 451static bool IsThrowNotImplementedOperation(INamedTypeSymbol notImplementedExceptionType, IOperation? operation) 458public static IOperation? UnwrapImplicitConversion(this IOperation? value)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SemanticEquivalence.cs (3)
87var originalOperation = semanticModel1.GetOperation(node1); 90var currentOperation = semanticModel2.GetOperation(node2); 126private static bool IsInstanceMemberReference(IOperation operation)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SemanticModelExtensions.cs (1)
53public static IOperation GetRequiredOperation(this SemanticModel semanticModel, SyntaxNode node, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.AnalysisData.cs (14)
61protected abstract PooledDictionary<(ISymbol symbol, IOperation operation), bool> SymbolsWriteBuilder { get; } 132public abstract void OnLValueCaptureFound(ISymbol symbol, IOperation operation, CaptureId captureId); 137public abstract void SetTargetsFromSymbolForDelegate(IOperation write, ISymbol symbol); 138public abstract void SetLambdaTargetForDelegate(IOperation write, IFlowAnonymousFunctionOperation lambdaTarget); 139public abstract void SetLocalFunctionTargetForDelegate(IOperation write, IMethodReferenceOperation localFunctionTarget); 140public abstract void SetEmptyInvocationTargetsForDelegate(IOperation write); 141public abstract bool TryGetDelegateInvocationTargets(IOperation write, out ImmutableHashSet<IOperation> targets); 143protected static PooledDictionary<(ISymbol Symbol, IOperation Write), bool> CreateSymbolsWriteMap( 146var symbolsWriteMap = PooledDictionary<(ISymbol Symbol, IOperation Write), bool>.GetInstance(); 150protected static PooledDictionary<(ISymbol Symbol, IOperation Write), bool> UpdateSymbolsWriteMap( 151PooledDictionary<(ISymbol Symbol, IOperation Write), bool> symbolsWriteMap, 158(ISymbol, IOperation) key = (parameter, null); 201public void OnWriteReferenceFound(ISymbol symbol, IOperation operation, bool maybeWritten, bool isRef)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.BasicBlockAnalysisData.cs (9)
30private readonly Dictionary<ISymbol, PooledHashSet<IOperation>> _reachingWrites; 76public void ForEachCurrentWrite<TArg>(ISymbol symbol, Action<IOperation, TArg> action, TArg arg) 88public bool ForEachCurrentWrite<TArg>(ISymbol symbol, Func<IOperation, TArg, bool> action, TArg arg) 92foreach (var value in values) 106public void OnWriteReferenceFound(ISymbol symbol, IOperation operation, bool maybeWritten) 110values = PooledHashSet<IOperation>.GetInstance(); 225private static void AddEntries(Dictionary<ISymbol, PooledHashSet<IOperation>> result, BasicBlockAnalysisData source) 233values = PooledHashSet<IOperation>.GetInstance(); 242foreach (var operation in operations)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.cs (2)
32public static SymbolUsageResult Run(IOperation rootOperation, ISymbol owningSymbol, CancellationToken cancellationToken) 45var localFunctionOperation = rootOperation.Descendants()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.FlowGraphAnalysisData.cs (33)
41private readonly PooledDictionary<CaptureId, PooledHashSet<(ISymbol, IOperation)>> _lValueFlowCapturesMap; 48private readonly PooledDictionary<IOperation, PooledHashSet<IOperation>> _reachingDelegateCreationTargets; 69private readonly PooledDictionary<(int firstBlockOrdinal, int lastBlockOrdinal), PooledHashSet<(ISymbol, IOperation)>> _symbolWritesInsideBlockRangeMap; 77PooledDictionary<(ISymbol symbol, IOperation operation), bool> symbolsWriteMap, 81PooledDictionary<IOperation, PooledHashSet<IOperation>> reachingDelegateCreationTargets, 99_lValueFlowCapturesMap = PooledDictionary<CaptureId, PooledHashSet<(ISymbol, IOperation)>>.GetInstance(); 103_symbolWritesInsideBlockRangeMap = PooledDictionary<(int firstBlockOrdinal, int lastBlockOrdinal), PooledHashSet<(ISymbol, IOperation)>>.GetInstance(); 110protected override PooledDictionary<(ISymbol symbol, IOperation operation), bool> SymbolsWriteBuilder { get; } 134reachingDelegateCreationTargets: PooledDictionary<IOperation, PooledHashSet<IOperation>>.GetInstance(), 189foreach (var operation in cfg.OriginalOperation.Descendants()) 215private PooledHashSet<(ISymbol, IOperation)> GetOrCreateSymbolWritesInBlockRange(int firstBlockOrdinal, int lastBlockOrdinal, CancellationToken cancellationToken) 220var operations = PooledHashSet<IOperation>.GetInstance(); 224writesInBlockRange = PooledHashSet<(ISymbol, IOperation)>.GetInstance(); 241PooledHashSet<IOperation> operationsBuilder, 248foreach (var operation in cfg.Blocks[i].DescendantOperations()) 273void AddDescendantOperationsFromDelegateCreationTargets(PooledHashSet<IOperation> targets) 275foreach (var target in targets) 462public override void OnLValueCaptureFound(ISymbol symbol, IOperation operation, CaptureId captureId) 466captures = PooledHashSet<(ISymbol, IOperation)>.GetInstance(); 514public override void SetTargetsFromSymbolForDelegate(IOperation write, ISymbol symbol) 522var targetsBuilder = PooledHashSet<IOperation>.GetInstance(); 544foreach (var target in targetsBuilderForSymbolWrite) 561public override void SetLambdaTargetForDelegate(IOperation write, IFlowAnonymousFunctionOperation lambdaTarget) 571public override void SetLocalFunctionTargetForDelegate(IOperation write, IMethodReferenceOperation localFunctionTarget) 583public override void SetEmptyInvocationTargetsForDelegate(IOperation write) 586private void SetReachingDelegateTargetCore(IOperation write, IOperation targetOpt) 588var targetsBuilder = PooledHashSet<IOperation>.GetInstance(); 597public override bool TryGetDelegateInvocationTargets(IOperation write, out ImmutableHashSet<IOperation> targets)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.OperationTreeAnalysisData.cs (9)
24PooledDictionary<(ISymbol symbol, IOperation operation), bool> symbolsWriteMap, 37protected override PooledDictionary<(ISymbol symbol, IOperation operation), bool> SymbolsWriteBuilder { get; } 66public override void OnLValueCaptureFound(ISymbol symbol, IOperation operation, CaptureId captureId) 72public override void SetLambdaTargetForDelegate(IOperation write, IFlowAnonymousFunctionOperation lambdaTarget) 74public override void SetLocalFunctionTargetForDelegate(IOperation write, IMethodReferenceOperation localFunctionTarget) 76public override void SetEmptyInvocationTargetsForDelegate(IOperation write) 78public override void SetTargetsFromSymbolForDelegate(IOperation write, ISymbol symbol) 80public override bool TryGetDelegateInvocationTargets(IOperation write, out ImmutableHashSet<IOperation> targets)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.Walker.cs (20)
28private IOperation _currentRootOperation; 30private PooledDictionary<IAssignmentOperation, PooledHashSet<(ISymbol, IOperation)>> _pendingWritesMap; 37IEnumerable<IOperation> operations, 52private void Visit(ISymbol containingSymbol, IEnumerable<IOperation> operations, AnalysisData analysisData, CancellationToken cancellationToken) 59_pendingWritesMap = PooledDictionary<IAssignmentOperation, PooledHashSet<(ISymbol, IOperation)>>.GetInstance(); 66foreach (var operation in operations) 94private void OnWriteReferenceFound(ISymbol symbol, IOperation operation, ValueUsageInfo valueUsageInfo) 102private void OnLValueCaptureFound(ISymbol symbol, IOperation operation, CaptureId captureId) 108private void OnReferenceFound(ISymbol symbol, IOperation operation) 160private bool MakePendingWrite(IOperation operation, ISymbol symbolOpt) 167var set = PooledHashSet<(ISymbol, IOperation)>.GetInstance(); 176set = PooledHashSet<(ISymbol, IOperation)>.GetInstance(); 408private void ProcessPossibleDelegateCreationAssignment(ISymbol symbol, IOperation write) 416IOperation initializerValue = null; 432private void ProcessPossibleDelegateCreation(IOperation creation, IOperation write) 434var currentOperation = creation; 498private void AnalyzePossibleDelegateInvocation(IOperation operation) 535foreach (var target in targets) 550void AnalyzeDelegateInvocation(IOperation target)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageResult.cs (3)
15ImmutableDictionary<(ISymbol symbol, IOperation write), bool> symbolWritesMap, 35public ImmutableDictionary<(ISymbol symbol, IOperation write), bool> SymbolWritesMap { get; } = symbolWritesMap; 49public IEnumerable<(ISymbol Symbol, IOperation WriteOperation)> GetUnreadSymbolWrites()
Microsoft.CodeAnalysis.CodeStyle.Fixes (40)
src\Analyzers\Core\CodeFixes\PopulateSwitch\AbstractPopulateSwitchCodeFixProvider.cs (1)
29where TSwitchOperation : IOperation
src\Analyzers\Core\CodeFixes\UseConditionalExpression\AbstractUseConditionalExpressionCodeFixProvider.cs (7)
86IOperation trueStatement, IOperation falseStatement, 87IOperation trueValue, IOperation falseValue, 128protected virtual TExpressionSyntax WrapReturnExpressionIfNecessary(TExpressionSyntax returnExpression, IOperation returnOperation) 158SyntaxGenerator generator, IOperation statement, IOperation value)
src\Analyzers\Core\CodeFixes\UseConditionalExpression\ForAssignment\AbstractUseConditionalExpressionForAssignmentCodeFixProvider.cs (4)
70out var trueStatement, out var falseStatement, 247private static bool ReferencesLocalVariable(IOperation operation, ILocalSymbol variable) 255foreach (var child in operation.ChildOperations)
src\Analyzers\Core\CodeFixes\UseConditionalExpression\ForReturn\AbstractUseConditionalExpressionForReturnCodeFixProvider.cs (2)
60out var trueStatement, out var falseStatement,
src\Analyzers\Core\CodeFixes\UseSystemHashCode\UseSystemHashCodeCodeFixProvider.cs (1)
57var operation = semanticModel.GetOperation(operationLocation, cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_Negate.cs (8)
150var operation = semanticModel.GetOperation(expressionNode, cancellationToken); 275var operation = semanticModel.GetOperation(isExpression, cancellationToken); 417var rightOperand = RemoveImplicitConversion(binaryOperation.RightOperand); 418var leftOperand = RemoveImplicitConversion(binaryOperation.LeftOperand); 430private static IOperation RemoveImplicitConversion(IOperation operation) 438IOperation variableExpression, ILiteralOperation numericLiteralExpression) 476var operation = semanticModel.GetOperation(expression);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\InitializeParameter\AbstractInitializerParameterService.cs (3)
57var operation = semanticModel.GetOperation( 171var statement = TryFindFieldOrPropertyAssignmentStatement(sibling, blockStatement); 211var operation = semanticModel.GetOperation(accessorBody, cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\InitializeParameter\InitializeParameterHelpersCore.cs (11)
38public static bool IsParameterReference(IOperation? operation, IParameterSymbol parameter) 43IOperation? value, IParameterSymbol parameter) 76public static IOperation? TryFindFieldOrPropertyAssignmentStatement(IParameterSymbol parameter, IBlockOperation? blockStatement) 79private static IOperation? TryFindFieldOrPropertyAssignmentStatement( 85foreach (var statement in blockStatement.Operations) 99var target = targetTuple.Elements[i]; 100var value = valueTuple.Elements[i]; 117IOperation operation, 146IOperation? operation, INamedTypeSymbol containingType, 163public static bool IsFieldOrPropertyAssignment(IOperation statement, INamedTypeSymbol containingType, [NotNullWhen(true)] out IAssignmentOperation? assignmentExpression) 167IOperation statement, INamedTypeSymbol containingType,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\NullableHelpers.cs (3)
54IOperation rootOperation, 62using var _ = ArrayBuilder<IOperation>.GetInstance(out var stack); 142bool IsSymbolReferencedByOperation(IOperation operation)
Microsoft.CodeAnalysis.CSharp (253)
Compilation\CSharpCompilation.cs (1)
2331internal override IConvertibleConversion ClassifyConvertibleConversion(IOperation source, ITypeSymbol? destination, out ConstantValue? constantValue)
Compilation\CSharpSemanticModel.cs (2)
474protected override IOperation GetOperationCore(SyntaxNode node, CancellationToken cancellationToken) 482internal virtual IOperation GetOperationWorker(CSharpSyntaxNode node, CancellationToken cancellationToken)
Compilation\MemberSemanticModel.cs (8)
33private readonly Dictionary<SyntaxNode, IOperation> _guardedIOperationNodeMap = new Dictionary<SyntaxNode, IOperation>(); 1156internal override IOperation? GetOperationWorker(CSharpSyntaxNode node, CancellationToken cancellationToken) 1166IOperation rootOperation = GetRootOperation(); 1178IOperation? guardedGetIOperation() 1181return _guardedIOperationNodeMap.TryGetValue(node, out var operation) ? operation : null; 1185private IOperation GetRootOperation() 1201IOperation operation = _operationFactory.Value.Create(highestBoundNode);
Compilation\SpeculativeSemanticModelWithMemberModel.cs (1)
445internal override IOperation? GetOperationWorker(CSharpSyntaxNode node, CancellationToken cancellationToken)
Compilation\SyntaxTreeSemanticModel.cs (1)
169internal override IOperation GetOperationWorker(CSharpSyntaxNode node, CancellationToken cancellationToken)
Operations\CSharpOperationFactory.cs (227)
28public IOperation? Create(BoundNode? boundNode) 319ImmutableArray<IOperation> children = GetIOperationChildren(boundNode); 337public ImmutableArray<TOperation> CreateFromArray<TBoundNode, TOperation>(ImmutableArray<TBoundNode> boundNodes) where TBoundNode : BoundNode where TOperation : class, IOperation 373internal ImmutableArray<IOperation> GetIOperationChildren(IBoundNodeWithIOperationChildren boundNodeWithChildren) 378return ImmutableArray<IOperation>.Empty; 381var builder = ArrayBuilder<IOperation>.GetInstance(children.Length); 389IOperation operation = Create(childNode); 430IOperation target = Create(boundDeconstructionAssignmentOperator.Left); 433IOperation value = Create(boundDeconstructionAssignmentOperator.Right.Operand); 440private IOperation CreateBoundCallOperation(BoundCall boundCall) 450ImmutableArray<IOperation> children = CreateFromArray<BoundNode, IOperation>(((IBoundInvalidNode)boundCall).InvalidNodeChildren); 456IOperation? receiver = CreateReceiverOperation(boundCall.ReceiverOpt, targetMethod); 472private IOperation CreateBoundFunctionPointerInvocationOperation(BoundFunctionPointerInvocation boundFunctionPointerInvocation) 480ImmutableArray<IOperation> children = CreateFromArray<BoundNode, IOperation>(((IBoundInvalidNode)boundFunctionPointerInvocation).InvalidNodeChildren); 484var pointer = Create(boundFunctionPointerInvocation.InvokedExpression); 489private IOperation CreateBoundUnconvertedAddressOfOperatorOperation(BoundUnconvertedAddressOfOperator boundUnconvertedAddressOf) 499private IOperation CreateBoundAttributeOperation(BoundAttribute boundAttribute) 511var namedArguments = CreateFromArray<BoundAssignmentOperator, IOperation>(boundAttribute.NamedArguments); 520internal ImmutableArray<IOperation> CreateIgnoredDimensions(BoundNode declaration) 528return CreateFromArray<BoundExpression, IOperation>(declaredTypeOpt.BoundDimensionsOpt); 545return CreateFromArray<BoundExpression, IOperation>(dimensions); 552internal IOperation CreateBoundLocalOperation(BoundLocal boundLocal, bool createDeclaration = true) 565IOperation localReference = CreateBoundLocalOperation(boundLocal, createDeclaration: false); 572internal IOperation CreateBoundFieldAccessOperation(BoundFieldAccess boundFieldAccess, bool createDeclaration = true) 586IOperation fieldAccess = CreateBoundFieldAccessOperation(boundFieldAccess, createDeclaration: false); 591IOperation? instance = CreateReceiverOperation(boundFieldAccess.ReceiverOpt, boundFieldAccess.FieldSymbol); 595internal IOperation? CreateBoundPropertyReferenceInstance(BoundNode boundNode) 614IOperation? instance = CreateReceiverOperation(boundPropertyAccess.ReceiverOpt, boundPropertyAccess.PropertySymbol); 624private IOperation CreateBoundIndexerAccessOperation(BoundIndexerAccess boundIndexerAccess) 633var children = CreateFromArray<BoundNode, IOperation>(((IBoundInvalidNode)boundIndexerAccess).InvalidNodeChildren); 638IOperation? instance = CreateReceiverOperation(boundIndexerAccess.ReceiverOpt, boundIndexerAccess.ExpressionSymbol); 646IOperation? instance = CreateReceiverOperation(boundEventAccess.ReceiverOpt, boundEventAccess.EventSymbol); 656IOperation eventReference = CreateBoundEventAccessOperation(boundEventAssignmentOperator); 657IOperation handlerValue = Create(boundEventAssignmentOperator.Argument); 697ImmutableArray<IOperation> initializers = GetAnonymousObjectCreationInitializers(boundAnonymousObjectCreationExpression.Arguments, boundAnonymousObjectCreationExpression.Declarations, syntax, type, isImplicit); 701private IOperation CreateBoundObjectCreationExpressionOperation(BoundObjectCreationExpression boundObjectCreationExpression) 713var children = CreateFromArray<BoundNode, IOperation>(((IBoundInvalidNode)boundObjectCreationExpression).InvalidNodeChildren); 721ImmutableArray<IOperation> initializers = GetAnonymousObjectCreationInitializers( 736private IOperation CreateBoundWithExpressionOperation(BoundWithExpression boundWithExpression) 738IOperation operand = Create(boundWithExpression.Receiver); 750ImmutableArray<IOperation> arguments = CreateFromArray<BoundExpression, IOperation>(boundDynamicObjectCreationExpression.Arguments); 759internal IOperation CreateBoundDynamicInvocationExpressionReceiver(BoundNode receiver) 778IOperation operation = CreateBoundDynamicInvocationExpressionReceiver(boundDynamicInvocation.Expression); 779ImmutableArray<IOperation> arguments = CreateFromArray<BoundExpression, IOperation>(boundDynamicInvocation.Arguments); 788internal IOperation CreateBoundDynamicIndexerAccessExpressionReceiver(BoundExpression indexer) 803internal ImmutableArray<IOperation> CreateBoundDynamicIndexerAccessArguments(BoundExpression indexer) 808return CreateFromArray<BoundExpression, IOperation>(boundDynamicAccess.Arguments); 812return CreateFromArray<BoundExpression, IOperation>(boundObjectInitializerMember.Arguments); 821IOperation operation = CreateBoundDynamicIndexerAccessExpressionReceiver(boundDynamicIndexerAccess); 822ImmutableArray<IOperation> arguments = CreateBoundDynamicIndexerAccessArguments(boundDynamicIndexerAccess); 833ImmutableArray<IOperation> initializers = CreateFromArray<BoundExpression, IOperation>(BoundObjectCreationExpression.GetChildInitializers(boundObjectInitializerExpression)); 842ImmutableArray<IOperation> initializers = CreateFromArray<BoundExpression, IOperation>(BoundObjectCreationExpression.GetChildInitializers(boundCollectionInitializerExpression)); 849private IOperation CreateBoundObjectInitializerMemberOperation(BoundObjectInitializerMember boundObjectInitializerMember, bool isObjectOrCollectionInitializer = false) 860IOperation operation = CreateBoundDynamicIndexerAccessExpressionReceiver(boundObjectInitializerMember); 861ImmutableArray<IOperation> arguments = CreateBoundDynamicIndexerAccessArguments(boundObjectInitializerMember); 889var children = CreateFromArray<BoundNode, IOperation>(((IBoundInvalidNode)boundObjectInitializerMember).InvalidNodeChildren); 905IOperation? createReceiver() => memberSymbol?.IsStatic == true ? 910private IOperation CreateBoundDynamicObjectInitializerMemberOperation(BoundDynamicObjectInitializerMember boundDynamicObjectInitializerMember) 912IOperation instanceReceiver = CreateImplicitReceiver(boundDynamicObjectInitializerMember.Syntax, boundDynamicObjectInitializerMember.ReceiverType); 923private IOperation CreateBoundCollectionElementInitializerOperation(BoundCollectionElementInitializer boundCollectionElementInitializer) 926IOperation? receiver = CreateReceiverOperation(boundCollectionElementInitializer.ImplicitReceiverOpt, addMethod); 935var children = CreateFromArray<BoundNode, IOperation>(((IBoundInvalidNode)boundCollectionElementInitializer).InvalidNodeChildren); 970IOperation? instance = Create(receiver); 976IOperation operation = CreateBoundDynamicInvocationExpressionReceiver(boundCollectionElementInitializer.Expression); 977ImmutableArray<IOperation> arguments = CreateFromArray<BoundExpression, IOperation>(boundCollectionElementInitializer.Arguments); 984private IOperation CreateUnboundLambdaOperation(UnboundLambda unboundLambda) 1015private IOperation CreateBoundConversionOperation(BoundConversion boundConversion, bool forceOperandImplicitLiteral = false) 1045IOperation target = CreateDelegateTargetOperation(boundConversion); 1123IOperation target = CreateDelegateTargetOperation(correctedConversionNode); 1131IOperation operand = forceOperandImplicitLiteral 1141IOperation operand = Create(boundAsOperator.Operand); 1153IOperation target = CreateDelegateTargetOperation(boundDelegateCreationExpression); 1164IOperation? instance = CreateReceiverOperation(boundMethodGroup.ReceiverOpt, methodSymbol); 1173IOperation value = Create(boundIsOperator.Operand); 1206ImmutableArray<IOperation> dimensionSizes = CreateFromArray<BoundExpression, IOperation>(boundArrayCreation.Bounds); 1217ImmutableArray<IOperation> elementValues = CreateFromArray<BoundExpression, IOperation>(boundArrayInitialization.Initializers); 1229ImmutableArray<IOperation> elements = expr.Elements.SelectAsArray((element, expr) => CreateBoundCollectionExpressionElement(expr, element), expr); 1258private IOperation CreateBoundCollectionExpressionElement(BoundCollectionExpression expr, BoundNode element) 1270var collection = Create(element.Expression); 1319private IOperation CreateBoundAssignmentOperatorOrMemberInitializerOperation(BoundAssignmentOperator boundAssignmentOperator) 1322(IOperation)CreateBoundMemberInitializerOperation(boundAssignmentOperator) : 1334IOperation target = Create(boundAssignmentOperator.Left); 1335IOperation value = Create(boundAssignmentOperator.Right); 1347IOperation initializedMember = CreateMemberInitializerInitializedMember(boundAssignmentOperator.Left); 1357IOperation target = Create(boundCompoundAssignmentOperator.Left); 1358IOperation value = Create(boundCompoundAssignmentOperator.Right); 1391IOperation target = Create(boundIncrementOperator.Operand); 1409var children = CreateFromArray<BoundExpression, IOperation>(boundBadExpression.ChildBoundNodes); 1434IOperation operand = Create(boundUnaryOperator.Operand); 1446private IOperation CreateBoundBinaryOperatorBase(BoundBinaryOperatorBase boundBinaryOperatorBase) 1465IOperation? left = null; 1470IOperation right = Create(currentBinary.Right); 1483IBinaryOperation createBoundUserDefinedConditionalLogicalOperator(BoundUserDefinedConditionalLogicalOperator boundBinaryOperator, IOperation left, IOperation right) 1507private IBinaryOperation CreateBoundBinaryOperatorOperation(BoundBinaryOperator boundBinaryOperator, IOperation left, IOperation right) 1536private IOperation CreateBoundInterpolatedStringBinaryOperator(BoundBinaryOperator boundBinaryOperator) 1539Func<BoundInterpolatedString, int, (CSharpOperationFactory, InterpolatedStringHandlerData), IOperation> createInterpolatedString 1542Func<BoundBinaryOperator, IOperation, IOperation, (CSharpOperationFactory, InterpolatedStringHandlerData), IOperation> createBinaryOperator 1555IOperation left, 1556IOperation right, 1563IOperation left = Create(boundTupleBinaryOperator.Left); 1564IOperation right = Create(boundTupleBinaryOperator.Right); 1574IOperation condition = Create(boundConditionalOperator.Condition); 1575IOperation whenTrue = Create(boundConditionalOperator.Consequence); 1576IOperation whenFalse = Create(boundConditionalOperator.Alternative); 1587IOperation value = Create(boundNullCoalescingOperator.LeftOperand); 1588IOperation whenNull = Create(boundNullCoalescingOperator.RightOperand); 1604private IOperation CreateBoundNullCoalescingAssignmentOperatorOperation(BoundNullCoalescingAssignmentOperator boundNode) 1606IOperation target = Create(boundNode.LeftOperand); 1607IOperation value = Create(boundNode.RightOperand); 1617IOperation awaitedValue = Create(boundAwaitExpression.Expression); 1626IOperation arrayReference = Create(boundArrayAccess.Expression); 1627ImmutableArray<IOperation> indices = CreateFromArray<BoundExpression, IOperation>(boundArrayAccess.Indices); 1635private IOperation CreateBoundImplicitIndexerAccessOperation(BoundImplicitIndexerAccess boundIndexerAccess) 1637IOperation instance = Create(boundIndexerAccess.Receiver); 1638IOperation argument = Create(boundIndexerAccess.Argument); 1659IOperation arrayReference = Create(boundInlineArrayAccess.Expression); 1660IOperation argument = Create(boundInlineArrayAccess.Argument); 1670IOperation argument = Create(boundNameOfOperator.Argument); 1680IOperation expression = Create(boundThrowExpression.Expression); 1689IOperation reference = Create(boundAddressOfOperator.Operand); 1707IOperation operation = Create(boundConditionalAccess.Receiver); 1708IOperation whenNotNull = Create(boundConditionalAccess.AccessExpression); 1727IOperation value = Create(boundFieldEqualsValue.Value); 1736IOperation value = Create(boundPropertyEqualsValue.Value); 1745IOperation value = Create(boundParameterEqualsValue.Value); 1753ImmutableArray<IOperation> operations = CreateFromArray<BoundStatement, IOperation>(boundBlock.Statements); 1780IOperation? returnedValue = null; 1806IOperation? whenFalse; 1828IOperation condition = Create(boundIfStatement.Condition); 1829IOperation whenTrue = Create(boundIfStatement.Consequence); 1846IOperation condition = Create(boundWhileStatement.Condition); 1847IOperation body = Create(boundWhileStatement.Body); 1860IOperation condition = Create(boundDoStatement.Condition); 1861IOperation body = Create(boundDoStatement.Body); 1874ImmutableArray<IOperation> before = CreateFromArray<BoundStatement, IOperation>(ToStatements(boundForStatement.Initializer)); 1875IOperation? condition = Create(boundForStatement.Condition); 1876ImmutableArray<IOperation> atLoopBottom = CreateFromArray<BoundStatement, IOperation>(ToStatements(boundForStatement.Increment)); 1877IOperation body = Create(boundForStatement.Body); 1953internal IOperation CreateBoundForEachStatementLoopControlVariable(BoundForEachStatement boundForEachStatement) 1969return new VariableDeclaratorOperation(local.GetPublicSymbol(), initializer: null, ignoredArguments: ImmutableArray<IOperation>.Empty, semanticModel: _semanticModel, syntax: declaratorSyntax, isImplicit: false); 1975IOperation loopControlVariable = CreateBoundForEachStatementLoopControlVariable(boundForEachStatement); 1977IOperation collection = Create(boundForEachStatement.EnumeratorInfoOpt?.InlineArraySpanType is null or WellKnownType.Unknown || 1981var nextVariables = ImmutableArray<IOperation>.Empty; 1982IOperation body = Create(boundForEachStatement.Body); 2007IOperation? exceptionDeclarationOrExpression = CreateVariableDeclarator((BoundLocal?)boundCatchBlock.ExceptionSourceOpt); 2010IOperation? filter = Create(boundCatchBlock.ExceptionFilterOpt); 2022IOperation body = Create(boundFixedStatement.Body); 2033IOperation resources = Create(boundUsingStatement.DeclarationsOpt ?? (BoundNode)boundUsingStatement.ExpressionOpt!); 2034IOperation body = Create(boundUsingStatement.Body); 2049IOperation? thrownObject = Create(boundThrowStatement.ExpressionOpt); 2058IOperation? returnedValue = Create(boundReturnStatement.ExpressionOpt); 2066IOperation returnedValue = Create(boundYieldReturnStatement.Expression); 2081IOperation lockedValue = Create(boundLockStatement.Argument); 2082IOperation body = Create(boundLockStatement.Body); 2095var children = CreateFromArray<BoundNode, IOperation>(boundBadStatement.ChildBoundNodes); 2099private IOperation CreateBoundLocalDeclarationOperation(BoundLocalDeclaration boundLocalDeclaration) 2142ImmutableArray<IOperation> ignoredDimensions = CreateIgnoredDimensions(boundLocalDeclaration); 2150private IOperation CreateBoundMultipleLocalDeclarationsBaseOperation(BoundMultipleLocalDeclarationsBase boundMultipleLocalDeclarations) 2162ImmutableArray<IOperation> ignoredDimensions = CreateIgnoredDimensions(boundMultipleLocalDeclarations); 2200IOperation labeledStatement = Create(boundLabeledStatement.Body); 2216IOperation expression = Create(boundExpressionStatement.Expression); 2226internal IOperation CreateBoundTupleOperation(BoundTupleExpression boundTupleExpression, bool createDeclaration = true) 2237var tupleOperation = CreateBoundTupleOperation(boundTupleExpression, createDeclaration: false); 2250ImmutableArray<IOperation> elements = CreateFromArray<BoundExpression, IOperation>(boundTupleExpression.Arguments); 2352IOperation valueOperation = value switch 2365IOperation valueOperation = Create(value); 2366IOperation? alignmentOperation = Create(alignment); 2367IOperation? formatOperation = Create(format); 2401IOperation expression = Create(boundStringInsert.Value); 2402IOperation? alignment = Create(boundStringInsert.Alignment); 2403IOperation? formatString = Create(boundStringInsert.Format); 2411IOperation text = CreateBoundLiteralOperation(boundNode, @implicit: true); 2422var construction = Create(interpolationData.Construction); 2423var content = createContent(conversion.Operand); 2435IOperation createContent(BoundExpression current) 2440var left = createContent(binaryOperator.Left); 2441var right = createContent(binaryOperator.Right); 2481private IOperation CreateBoundInterpolatedStringArgumentPlaceholder(BoundInterpolatedStringArgumentPlaceholder placeholder) 2489return new InvalidOperation(ImmutableArray<IOperation>.Empty, _semanticModel, syntax, type, placeholder.ConstantValueOpt, isImplicit); 2505private IOperation CreateBoundInterpolatedStringHandlerPlaceholder(BoundInterpolatedStringHandlerPlaceholder placeholder) 2517IOperation value = Create(boundConstantPattern.Value); 2525private IOperation CreateBoundRelationalPatternOperation(BoundRelationalPattern boundRelationalPattern) 2528IOperation value = Create(boundRelationalPattern.Value); 2594private IOperation CreateBoundTypePatternOperation(BoundTypePattern boundTypePattern) 2605private IOperation CreateBoundSlicePatternOperation(BoundSlicePattern boundNode) 2618private IOperation CreateBoundListPatternOperation(BoundListPattern boundNode) 2632private IOperation CreateBoundNegatedPatternOperation(BoundNegatedPattern boundNegatedPattern) 2643private IOperation CreateBoundBinaryPatternOperation(BoundBinaryPattern boundBinaryPattern) 2686IOperation value = Create(boundSwitchStatement.Expression); 2698ImmutableArray<IOperation> body = CreateFromArray<BoundStatement, IOperation>(boundSwitchSection.Statements); 2706IOperation value = Create(boundSwitchExpression.Expression); 2733IOperation? guard = Create(boundSwitchExpressionArm.WhenClause); 2734IOperation value = Create(boundSwitchExpressionArm.Value); 2766IOperation? guard = Create(boundSwitchLabel.WhenClause); 2773IOperation value = Create(boundIsPatternExpression.Expression); 2781private IOperation CreateBoundQueryClauseOperation(BoundQueryClause boundQueryClause) 2789IOperation operation = Create(boundQueryClause.Value); 2796private IOperation CreateBoundRangeVariableOperation(BoundRangeVariable boundRangeVariable) 2802private IOperation CreateBoundDiscardExpressionOperation(BoundDiscardExpression boundNode) 2812private IOperation CreateFromEndIndexExpressionOperation(BoundFromEndIndexExpression boundIndex) 2828private IOperation CreateRangeExpressionOperation(BoundRangeExpression boundRange) 2830IOperation? left = Create(boundRange.LeftOperandOpt); 2831IOperation? right = Create(boundRange.RightOperandOpt); 2842private IOperation CreateBoundDiscardPatternOperation(BoundDiscardPattern boundNode) 2861var reference = OperationFactory.CreateInvalidOperation(_semanticModel, subpatternSyntax, ImmutableArray<IOperation>.Empty, isImplicit: true); 2895IOperation reference; 2915reference = OperationFactory.CreateInvalidOperation(_semanticModel, nameSyntax, ImmutableArray<IOperation>.Empty, isImplicit: false); 2923IOperation? createReceiver()
Operations\CSharpOperationFactory_Methods.cs (13)
39IOperation value = Create(expression is BoundConversion { IsParamsArrayOrCollection: true } conversion ? conversion.Operand : expression); 74IOperation value = Create(boundLocalDeclaration.InitializerOpt); 87ImmutableArray<IOperation> ignoredDimensions = CreateFromArray<BoundExpression, IOperation>(boundLocalDeclaration.ArgumentsOpt); 95return boundLocal == null ? null : new VariableDeclaratorOperation(boundLocal.LocalSymbol.GetPublicSymbol(), initializer: null, ignoredArguments: ImmutableArray<IOperation>.Empty, semanticModel: _semanticModel, syntax: boundLocal.Syntax, isImplicit: false); 98internal IOperation? CreateReceiverOperation(BoundNode? instance, Symbol? symbol) 133IOperation? instance = CreateReceiverOperation(boundEventAssignmentOperator.ReceiverOpt, boundEventAssignmentOperator.Event); 141internal IOperation CreateDelegateTargetOperation(BoundNode delegateNode) 180internal IOperation CreateMemberInitializerInitializedMember(BoundNode initializedMember) 407internal ImmutableArray<IOperation> GetAnonymousObjectCreationInitializers( 417var builder = ArrayBuilder<IOperation>.GetInstance(arguments.Length); 421IOperation value = Create(arguments[i]); 423IOperation target;
Microsoft.CodeAnalysis.CSharp.CodeStyle (59)
src\Analyzers\CSharp\Analyzers\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyAnalyzer.cs (8)
147foreach (var blockOperation in context.OperationBlocks) 219IOperation blockOperation, 224foreach (var operation in blockOperation.DescendantsAndSelf()) 239static bool ReferencesThisInstance(IOperation operation, CancellationToken cancellationToken) 256private static bool IsPotentiallyValueType(IOperation? instance) 267IOperation instanceOperation, 285for (var operation = instanceOperation.Parent; operation != null; operation = operation.Parent) 378IOperation? instance,
src\Analyzers\CSharp\Analyzers\QualifyMemberAccess\CSharpQualifyMemberAccessDiagnosticAnalyzer.cs (1)
67protected override Location GetLocation(IOperation operation) => operation.Syntax.GetLocation();
src\Analyzers\CSharp\Analyzers\RemoveUnusedParametersAndValues\CSharpRemoveUnusedParametersAndValuesDiagnosticAnalyzer.cs (2)
59protected override bool ShouldBailOutFromRemovableAssignmentAnalysis(IOperation unusedSymbolWriteOperation) 81protected override Location GetDefinitionLocationToFade(IOperation unusedDefinition)
src\Analyzers\CSharp\Analyzers\SimplifyInterpolation\CSharpSimplifyInterpolationHelpers.cs (1)
18protected override SyntaxNode GetPreservedInterpolationExpressionSyntax(IOperation operation)
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (1)
137var operation = semanticModel.GetOperation(topMostExpression, cancellationToken);
src\Analyzers\CSharp\Analyzers\UseConditionalExpression\CSharpUseConditionalExpressionForReturnDiagnosticAnalyzer.cs (2)
26protected override bool IsStatementSupported(IOperation statement) 34private static bool IsWrappedByCheckedOrUnsafe(IOperation statement)
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseIndexOperatorDiagnosticAnalyzer.cs (2)
160IOperation? instance, 162IOperation argumentValue,
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseRangeOperatorDiagnosticAnalyzer.cs (7)
78var operation = context.Operation; 126var startOperation = invocation.Arguments[0].Value; 168var startOperation = invocation.Arguments[0].Value; 169var lengthOperation = invocation.Arguments[1].Value; 244var startOperation = invocation.Arguments[0].Value; 283var startOperation = invocation.Arguments[0].Value; 334private static bool IsConstantInt32(IOperation operation, int? value = null)
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseRangeOperatorDiagnosticAnalyzer.Result.cs (4)
32IOperation op1, 33IOperation? op2) 44public readonly IOperation Op1 = op1; 49public readonly IOperation? Op2 = op2;
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\Helpers.cs (3)
44public static bool IsInstanceLengthCheck(IPropertySymbol lengthLikeProperty, IOperation instance, IOperation operation) 54public static bool IsSubtraction(IOperation operation, [NotNullWhen(true)] out IBinaryOperation? subtraction)
src\Analyzers\CSharp\Analyzers\UseIsNullCheck\CSharpUseNullCheckOverTypeCheckDiagnosticAnalyzer.cs (1)
87var operation = context.Operation;
src\Analyzers\CSharp\Analyzers\UsePatternCombinators\AnalyzedPattern.cs (5)
19public readonly IOperation Target; 21private AnalyzedPattern(IOperation target) 77private Type(TypeSyntax type, IOperation target) : base(target) 84internal sealed class Source(PatternSyntax patternSyntax, IOperation target) : AnalyzedPattern(target) 92internal sealed class Constant(ExpressionSyntax expression, IOperation target) : AnalyzedPattern(target)
src\Analyzers\CSharp\Analyzers\UsePatternCombinators\CSharpUsePatternCombinatorsAnalyzer.cs (3)
16public static AnalyzedPattern? Analyze(IOperation operation) 40private static AnalyzedPattern? ParsePattern(IOperation operation) 159private static bool IsConstant(IOperation operation)
src\Analyzers\CSharp\Analyzers\UsePatternCombinators\CSharpUsePatternCombinatorsDiagnosticAnalyzer.cs (1)
73var operation = semanticModel.GetOperation(expression, cancellationToken);
src\Analyzers\CSharp\Analyzers\UsePrimaryConstructor\CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs (3)
502var rightOperation = semanticModel.GetOperation(assignmentExpression.Right.WalkDownSuppressions()); 506foreach (var operation in rightOperation.DescendantsAndSelf()) 549var instance = operation.Instance;
src\Analyzers\CSharp\Analyzers\UseSystemThreadingLock\CSharpUseSystemThreadingLockDiagnosticAnalyzer.cs (1)
245private static bool IsObjectCreationOperation(IOperation value)
src\Analyzers\CSharp\Analyzers\UseUtf8StringLiteral\UseUtf8StringLiteralDiagnosticAnalyzer.cs (4)
118private void ReportParameterArrayDiagnostic(OperationAnalysisContext context, SyntaxNode syntaxNode, ImmutableArray<IOperation> elements, NotificationOption2 notificationOption, ArrayCreationOperationLocation operationLocation) 150internal static bool TryConvertToUtf8String(StringBuilder? builder, ImmutableArray<IOperation> arrayCreationElements) 193private static bool TryGetNextRune(ImmutableArray<IOperation> arrayCreationElements, int startIndex, out Rune rune, out int bytesConsumed) 204var element = arrayCreationElements[startIndex + i];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (10)
87var castExpressionOperation = semanticModel.GetOperation(cast.Expression, cancellationToken); 95var current = castExpressionOperation.Parent.Parent; 203var originalOperation = originalSemanticModel.GetOperation(castNode, cancellationToken); 262var rewrittenOperation = rewrittenSemanticModel.GetOperation(rewrittenExpression.WalkDownParentheses(), cancellationToken); 794var rewrittenOperation = rewrittenSemanticModel.GetOperation(rewrittenBitwiseNotExpression, cancellationToken); 913var operation = semanticModel.GetOperation(parentBinary, cancellationToken); 936private static bool ConvertedHasUserDefinedEquals(BinaryOperatorKind operatorKind, IOperation operation) 975private static bool IsConstantNull(IOperation operation) 1110var operation = semanticModel.GetOperation(expression.WalkDownParentheses(), cancellationToken); 1406var operation = semanticModel.GetOperation(expression, cancellationToken);
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (51)
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordHelpers.cs (44)
46Arguments: [IArgumentOperation { Value: IOperation arg }] 117Operations: [IReturnOperation { ReturnedValue: IOperation returnedValue }] 140Operand: IOperation operand 159LeftOperand: IOperation leftOperand, 160RightOperand: IOperation rightOperand, 380foreach (var assignment in initializer.Initializers) 385Value: IOperation { Syntax: ExpressionSyntax syntax } 421Func<IOperation, T?> captureAssignedSymbol) 433foreach (var operation in body.Operations) 439Target: IOperation assignee, 440Value: IOperation assignment 476private static bool IsSafeAssignment(IOperation operation) 507IEnumerable<IOperation>? statementsToCheck = null; 530if (bodyOps is [IReturnOperation { ReturnedValue: IOperation value }] && 567IOperation? operation, 606private static IParameterSymbol? GetParamFromArgument(IOperation operation) 609private static ISymbol? GetReferencedSymbolObject(IOperation reference) 625private static bool IsDotEqualsInvocation(IOperation operation) 631Instance: IOperation instance, 632Arguments: [IArgumentOperation { Value: IOperation arg }] 655IOperation operation, 699private static bool ReturnsFalseImmediately(IEnumerable<IOperation> operation) 724IOperation condition, 734(_, IUnaryOperation { OperatorKind: UnaryOperatorKind.Not, Operand: IOperation newCondition }) 783IOperation condition, 788IEnumerable<IOperation>? additionalConditions = null) 794(_, IUnaryOperation { OperatorKind: UnaryOperatorKind.Not, Operand: IOperation newCondition }) 805LeftOperand: IOperation leftOperation, 806RightOperand: IOperation rightOperation, 817LeftOperand: IOperation leftOperation, 818RightOperand: IOperation rightOperation, 879IEnumerable<IOperation> statementsToCheck, 895IReturnOperation { ReturnedValue: IOperation value } => TryAddEqualizedFieldsForCondition( 899Condition: IOperation condition, 900WhenTrue: IOperation whenTrue, 956ImmutableArray<IOperation> bodyOps, 961[NotNullWhen(true)] out IEnumerable<IOperation>? statementsToCheck) 969Condition: IOperation condition, 970WhenTrue: IOperation whenTrue, 1050IOperation whenTrue, 1051IOperation? whenFalse, 1052IEnumerable<IOperation> otherOps, 1054out IEnumerable<IOperation> remainingStatements) 1069: ImmutableArray<IOperation>.Empty))
src\Analyzers\CSharp\CodeFixes\MakeLocalFunctionStatic\MakeLocalFunctionStaticCodeFixHelper.cs (1)
152foreach (var descendent in localFunctionBodyOperation.DescendantsAndSelf())
src\Analyzers\CSharp\CodeFixes\UseConditionalExpression\CSharpUseConditionalExpressionForReturnCodeFixProvider.cs (1)
52protected override ExpressionSyntax WrapReturnExpressionIfNecessary(ExpressionSyntax returnExpression, IOperation returnOperation)
src\Analyzers\CSharp\CodeFixes\UseIndexOrRangeOperator\CSharpUseRangeOperatorCodeFixProvider.cs (3)
264private static int GetInt32Value(IOperation operation) 272IPropertySymbol lengthLikeProperty, IOperation instance, ref IOperation rangeOperation)
src\Analyzers\CSharp\CodeFixes\UseUtf8StringLiteral\UseUtf8StringLiteralCodeFixProvider.cs (1)
126static IArrayCreationOperation FindArrayCreationOperationAncestor(IOperation operation)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\InitializeParameter\CSharpInitializeParameterService.cs (1)
102foreach (var operation in blockOperation.Operations)
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (1)
CodeGen\CodeGenLocalFunctionTests.cs (1)
149var objectCreationOperation = model.GetOperation(creation);
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (37)
Attributes\AttributeTests.cs (6)
714var operation = semanticModel.GetOperation(attrSyntax); 756var speculativeOperation = speculativeModel.GetOperation(newAttrSyntax); 821var speculativeOperation = speculativeModel.GetOperation(newAttrSyntax); 862var speculativeOperation = speculativeModel.GetOperation(newAttrSyntax); 903var speculativeOperation = speculativeModel.GetOperation(newAttrSyntax); 942var speculativeOperation = speculativeModel.GetOperation(newAttrSyntax);
Diagnostics\DiagnosticAnalyzerTests.cs (1)
2346private void ReportOperationDiagnostics(IOperation operation, string name, Action<Diagnostic> addDiagnostic)
Diagnostics\GetDiagnosticsTests.cs (1)
988foreach (var operationBlock in blockEndContext.OperationBlocks)
Semantics\CollectionExpressionTests.cs (20)
26723var operation = VerifyOperationTreeForTest<ReturnStatementSyntax>(comp, 26785var operation = VerifyOperationTreeForTest<ReturnStatementSyntax>(comp, 27031(IOperation operation, _) = GetOperationAndSyntaxForTest<SpreadElementSyntax>(comp); 27054(IOperation operation, _) = GetOperationAndSyntaxForTest<SpreadElementSyntax>(comp); 27076IOperation ISpreadOperation.Operand => throw null; 27082IOperation IOperation.Parent => throw null; 27084OperationKind IOperation.Kind => throw null; 27086SyntaxNode IOperation.Syntax => throw null; 27088ITypeSymbol IOperation.Type => throw null; 27090Optional<object> IOperation.ConstantValue => throw null; 27092IEnumerable<IOperation> IOperation.Children => throw null; 27094IOperation.OperationList IOperation.ChildOperations => throw null; 27096string IOperation.Language => ""; 27098bool IOperation.IsImplicit => throw null; 27100SemanticModel IOperation.SemanticModel => throw null; 27102void IOperation.Accept(OperationVisitor visitor) { } 27104TResult IOperation.Accept<TArgument, TResult>(OperationVisitor<TArgument, TResult> visitor, TArgument argument) where TResult : default => throw null;
Semantics\OutVarTests.cs (5)
3514var initializerOperation = model.GetOperation(initializer); 35998IOperation initializerOperation = model.GetOperation(initializerSyntax); 36021IOperation blockBodyOperation = model.GetOperation(blockBodySyntax); 36142IOperation expressionBodyOperation = model.GetOperation(expressionBodySyntax); 36167IOperation blockBodyOperation = model.GetOperation(blockBodySyntax);
Semantics\PatternMatchingTests.cs (2)
11412var operation = model.GetOperation(syntax); 11469var operation = model.GetOperation(syntax);
Semantics\PrimaryConstructorTests.cs (1)
1110var operation = model.GetOperation(baseWithargs);
Semantics\RecordTests.cs (1)
21227var operation = model.GetOperation(baseWithargs);
Microsoft.CodeAnalysis.CSharp.EndToEnd.UnitTests (1)
EndToEndTests.cs (1)
882var operation = model.GetOperation(isPattern);
Microsoft.CodeAnalysis.CSharp.Features (109)
ConvertIfToSwitch\CSharpConvertIfToSwitchCodeRefactoringProvider.Analyzer.cs (1)
18public override bool HasUnreachableEndPoint(IOperation operation)
ConvertIfToSwitch\CSharpConvertIfToSwitchCodeRefactoringProvider.Rewriting.cs (2)
60private static ExpressionSyntax AsExpressionSyntax(IOperation operation) 108public override IEnumerable<SyntaxNode> AsSwitchSectionStatements(IOperation operation)
ConvertLinq\CSharpConvertLinqQueryToForEachProvider.cs (1)
908private static bool IsLocalOrParameterSymbol(IOperation operation)
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.cs (1)
1095var methodOperation = semanticModel.GetOperation(node, cancellationToken);
ImplementInterface\CSharpImplementExplicitlyCodeRefactoringProvider.cs (2)
104var operation = semanticModel.GetOperation(node, cancellationToken); 105var instance = operation switch
InitializeParameter\CSharpInitializeMemberFromPrimaryConstructorParameterCodeRefactoringProvider.cs (3)
270private static (IOperation? initializer, ISymbol? fieldOrProperty) TryFindFieldOrPropertyInitializerValue( 286var operation = semanticModel.GetOperation(propertyInitializer, cancellationToken); 296var operation = semanticModel.GetOperation(fieldInitializer, cancellationToken);
src\Analyzers\CSharp\Analyzers\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyAnalyzer.cs (8)
147foreach (var blockOperation in context.OperationBlocks) 219IOperation blockOperation, 224foreach (var operation in blockOperation.DescendantsAndSelf()) 239static bool ReferencesThisInstance(IOperation operation, CancellationToken cancellationToken) 256private static bool IsPotentiallyValueType(IOperation? instance) 267IOperation instanceOperation, 285for (var operation = instanceOperation.Parent; operation != null; operation = operation.Parent) 378IOperation? instance,
src\Analyzers\CSharp\Analyzers\QualifyMemberAccess\CSharpQualifyMemberAccessDiagnosticAnalyzer.cs (1)
67protected override Location GetLocation(IOperation operation) => operation.Syntax.GetLocation();
src\Analyzers\CSharp\Analyzers\RemoveUnusedParametersAndValues\CSharpRemoveUnusedParametersAndValuesDiagnosticAnalyzer.cs (2)
59protected override bool ShouldBailOutFromRemovableAssignmentAnalysis(IOperation unusedSymbolWriteOperation) 81protected override Location GetDefinitionLocationToFade(IOperation unusedDefinition)
src\Analyzers\CSharp\Analyzers\SimplifyInterpolation\CSharpSimplifyInterpolationHelpers.cs (1)
18protected override SyntaxNode GetPreservedInterpolationExpressionSyntax(IOperation operation)
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (1)
137var operation = semanticModel.GetOperation(topMostExpression, cancellationToken);
src\Analyzers\CSharp\Analyzers\UseConditionalExpression\CSharpUseConditionalExpressionForReturnDiagnosticAnalyzer.cs (2)
26protected override bool IsStatementSupported(IOperation statement) 34private static bool IsWrappedByCheckedOrUnsafe(IOperation statement)
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseIndexOperatorDiagnosticAnalyzer.cs (2)
160IOperation? instance, 162IOperation argumentValue,
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseRangeOperatorDiagnosticAnalyzer.cs (7)
78var operation = context.Operation; 126var startOperation = invocation.Arguments[0].Value; 168var startOperation = invocation.Arguments[0].Value; 169var lengthOperation = invocation.Arguments[1].Value; 244var startOperation = invocation.Arguments[0].Value; 283var startOperation = invocation.Arguments[0].Value; 334private static bool IsConstantInt32(IOperation operation, int? value = null)
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseRangeOperatorDiagnosticAnalyzer.Result.cs (4)
32IOperation op1, 33IOperation? op2) 44public readonly IOperation Op1 = op1; 49public readonly IOperation? Op2 = op2;
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\Helpers.cs (3)
44public static bool IsInstanceLengthCheck(IPropertySymbol lengthLikeProperty, IOperation instance, IOperation operation) 54public static bool IsSubtraction(IOperation operation, [NotNullWhen(true)] out IBinaryOperation? subtraction)
src\Analyzers\CSharp\Analyzers\UseIsNullCheck\CSharpUseNullCheckOverTypeCheckDiagnosticAnalyzer.cs (1)
87var operation = context.Operation;
src\Analyzers\CSharp\Analyzers\UsePatternCombinators\AnalyzedPattern.cs (5)
19public readonly IOperation Target; 21private AnalyzedPattern(IOperation target) 77private Type(TypeSyntax type, IOperation target) : base(target) 84internal sealed class Source(PatternSyntax patternSyntax, IOperation target) : AnalyzedPattern(target) 92internal sealed class Constant(ExpressionSyntax expression, IOperation target) : AnalyzedPattern(target)
src\Analyzers\CSharp\Analyzers\UsePatternCombinators\CSharpUsePatternCombinatorsAnalyzer.cs (3)
16public static AnalyzedPattern? Analyze(IOperation operation) 40private static AnalyzedPattern? ParsePattern(IOperation operation) 159private static bool IsConstant(IOperation operation)
src\Analyzers\CSharp\Analyzers\UsePatternCombinators\CSharpUsePatternCombinatorsDiagnosticAnalyzer.cs (1)
73var operation = semanticModel.GetOperation(expression, cancellationToken);
src\Analyzers\CSharp\Analyzers\UsePrimaryConstructor\CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs (3)
502var rightOperation = semanticModel.GetOperation(assignmentExpression.Right.WalkDownSuppressions()); 506foreach (var operation in rightOperation.DescendantsAndSelf()) 549var instance = operation.Instance;
src\Analyzers\CSharp\Analyzers\UseSystemThreadingLock\CSharpUseSystemThreadingLockDiagnosticAnalyzer.cs (1)
245private static bool IsObjectCreationOperation(IOperation value)
src\Analyzers\CSharp\Analyzers\UseUtf8StringLiteral\UseUtf8StringLiteralDiagnosticAnalyzer.cs (4)
118private void ReportParameterArrayDiagnostic(OperationAnalysisContext context, SyntaxNode syntaxNode, ImmutableArray<IOperation> elements, NotificationOption2 notificationOption, ArrayCreationOperationLocation operationLocation) 150internal static bool TryConvertToUtf8String(StringBuilder? builder, ImmutableArray<IOperation> arrayCreationElements) 193private static bool TryGetNextRune(ImmutableArray<IOperation> arrayCreationElements, int startIndex, out Rune rune, out int bytesConsumed) 204var element = arrayCreationElements[startIndex + i];
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordHelpers.cs (44)
46Arguments: [IArgumentOperation { Value: IOperation arg }] 117Operations: [IReturnOperation { ReturnedValue: IOperation returnedValue }] 140Operand: IOperation operand 159LeftOperand: IOperation leftOperand, 160RightOperand: IOperation rightOperand, 380foreach (var assignment in initializer.Initializers) 385Value: IOperation { Syntax: ExpressionSyntax syntax } 421Func<IOperation, T?> captureAssignedSymbol) 433foreach (var operation in body.Operations) 439Target: IOperation assignee, 440Value: IOperation assignment 476private static bool IsSafeAssignment(IOperation operation) 507IEnumerable<IOperation>? statementsToCheck = null; 530if (bodyOps is [IReturnOperation { ReturnedValue: IOperation value }] && 567IOperation? operation, 606private static IParameterSymbol? GetParamFromArgument(IOperation operation) 609private static ISymbol? GetReferencedSymbolObject(IOperation reference) 625private static bool IsDotEqualsInvocation(IOperation operation) 631Instance: IOperation instance, 632Arguments: [IArgumentOperation { Value: IOperation arg }] 655IOperation operation, 699private static bool ReturnsFalseImmediately(IEnumerable<IOperation> operation) 724IOperation condition, 734(_, IUnaryOperation { OperatorKind: UnaryOperatorKind.Not, Operand: IOperation newCondition }) 783IOperation condition, 788IEnumerable<IOperation>? additionalConditions = null) 794(_, IUnaryOperation { OperatorKind: UnaryOperatorKind.Not, Operand: IOperation newCondition }) 805LeftOperand: IOperation leftOperation, 806RightOperand: IOperation rightOperation, 817LeftOperand: IOperation leftOperation, 818RightOperand: IOperation rightOperation, 879IEnumerable<IOperation> statementsToCheck, 895IReturnOperation { ReturnedValue: IOperation value } => TryAddEqualizedFieldsForCondition( 899Condition: IOperation condition, 900WhenTrue: IOperation whenTrue, 956ImmutableArray<IOperation> bodyOps, 961[NotNullWhen(true)] out IEnumerable<IOperation>? statementsToCheck) 969Condition: IOperation condition, 970WhenTrue: IOperation whenTrue, 1050IOperation whenTrue, 1051IOperation? whenFalse, 1052IEnumerable<IOperation> otherOps, 1054out IEnumerable<IOperation> remainingStatements) 1069: ImmutableArray<IOperation>.Empty))
src\Analyzers\CSharp\CodeFixes\MakeLocalFunctionStatic\MakeLocalFunctionStaticCodeFixHelper.cs (1)
152foreach (var descendent in localFunctionBodyOperation.DescendantsAndSelf())
src\Analyzers\CSharp\CodeFixes\UseConditionalExpression\CSharpUseConditionalExpressionForReturnCodeFixProvider.cs (1)
52protected override ExpressionSyntax WrapReturnExpressionIfNecessary(ExpressionSyntax returnExpression, IOperation returnOperation)
src\Analyzers\CSharp\CodeFixes\UseIndexOrRangeOperator\CSharpUseRangeOperatorCodeFixProvider.cs (3)
264private static int GetInt32Value(IOperation operation) 272IPropertySymbol lengthLikeProperty, IOperation instance, ref IOperation rangeOperation)
src\Analyzers\CSharp\CodeFixes\UseUtf8StringLiteral\UseUtf8StringLiteralCodeFixProvider.cs (1)
126static IArrayCreationOperation FindArrayCreationOperationAncestor(IOperation operation)
Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests (48)
IOperation\IOperationTests.cs (9)
465IOperation operation1 = model.GetOperation(assignments[0]); 471IOperation operation2 = model.GetOperation(assignments[1]); 477IOperation operation3 = model.GetOperation(assignments[2]); 511var operation = model.GetOperation(statement); 560var operation = model.GetOperation(expr); 591IOperation operation = model.GetOperation(literal); 626IOperation operation = speculativeModel.GetOperation(localDecl); 670var blockOperation = semanticModel.GetOperation(exceptionBlock); 676IOperation operation,
IOperation\IOperationTests_IAnonymousFunctionExpression.cs (2)
413var variableTreeLambdaOperation = ((IDelegateCreationOperation)variableDeclarationGroupOperation.Declarations.Single().Declarators.Single().Initializer.Value).Target; 421var variableTreeLambdaOperationSecondRequest = ((IDelegateCreationOperation)variableDeclarationGroupOperationSecondRequest.Declarations.Single().Declarators.Single().Initializer.Value).Target;
IOperation\IOperationTests_IArgument.cs (2)
4095var operation = VerifyOperationTreeForTest<StatementSyntax>(comp, expectedOperationTree); 4143public static void Verify(IOperation operation, Compilation compilation, SyntaxNode syntaxNode)
IOperation\IOperationTests_IBranchOperation.Extensions.cs (4)
373private (IOperation outer, IOperation corresponding) GetOuterOperationAndCorrespondingInnerOperation<TOuterSyntax, TInnerSyntax>(string source) 379var outer = GetOperationAndSyntaxForTest<TOuterSyntax>(compilation).operation; 381var correspondingOfInner = inner?.GetCorrespondingOperation();
IOperation\IOperationTests_ICompoundAssignmentOperation.cs (2)
45(IOperation operation, _) = GetOperationAndSyntaxForTest<AssignmentExpressionSyntax>(compilation); 81(IOperation operation, SyntaxNode node) = GetOperationAndSyntaxForTest<AssignmentExpressionSyntax>(compilation);
IOperation\IOperationTests_IConversionExpression.cs (22)
182var initializerOperation = ((IVariableDeclaratorOperation)operation).Initializer.Value; 380var initializer = ((IVariableDeclaratorOperation)operation).Initializer.Value; 5334public static IOperation IVariableDeclarationStatementSelector(IOperation operation) => 5337public static IOperation IVariableDeclarationSelector(IOperation operation) => 5340public static IOperation IVariableDeclaratorSelector(IOperation operation) => 5343public static IOperation IReturnDeclarationStatementSelector(IOperation operation) => 5346public static IOperation NestedConversionChildSelector(IOperation operation) => 5349private static IOperation ConversionOrDelegateChildSelector(IOperation operation) 5361public Func<IOperation, IConversionOperation> OperationSelector { get; set; } 5363public Func<IOperation, IOperation> ConversionChildSelector { get; set; } = ConversionOrDelegateChildSelector; 5377public void Verify(IOperation variableDeclaration, Compilation compilation, SyntaxNode syntaxNode) 5383var initializer = GetAndInvokeOperationSelector(variableDeclaration); 5385var conversion = initializer; 5412private IOperation GetAndInvokeOperationSelector(IOperation operation)
IOperation\IOperationTests_IFieldReferenceExpression.cs (1)
712var methodBlockOperation = model.GetOperation(methodDecl);
IOperation\IOperationTests_IVariableDeclaration.cs (6)
611(var operation, _) = GetOperationAndSyntaxForTest<VariableDeclaratorSyntax>(compilation); 633(var operation, _) = GetOperationAndSyntaxForTest<VariableDeclaratorSyntax>(compilation); 654(var operation, _) = GetOperationAndSyntaxForTest<VariableDeclaratorSyntax>(compilation); 675(var operation, _) = GetOperationAndSyntaxForTest<VariableDeclaratorSyntax>(compilation); 849(var operation, _) = GetOperationAndSyntaxForTest<VariableDeclarationSyntax>(compilation); 871(var operation, _) = GetOperationAndSyntaxForTest<VariableDeclarationSyntax>(compilation);
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (19)
Semantics\ConstantTests.cs (1)
3522var literalOperation = model.GetOperation(initializer);
Semantics\DelegateTypeTests.cs (1)
14756var value = ((IConversionOperation)operation.Initializer!.Value).Operand;
Semantics\OperatorTests.cs (3)
11424foreach (var initializerOp in fieldInitializerOperations) 11431void enumerateChildren(IOperation iop) 11435foreach (var child in iop.ChildOperations)
Semantics\RecordStructTests.cs (2)
6929var operation = model.GetOperation(with); 8812var operation = model.GetOperation(withExpr);
Semantics\StackAllocInitializerTests.cs (1)
2718var operation = model.GetOperation(tree.GetRoot());
Semantics\StructConstructorTests.cs (3)
1051var operation = model.GetOperation(syntax); 1146var operation = model.GetOperation(syntax); 1243var operation = model.GetOperation(syntax);
Semantics\TopLevelStatementsTests.cs (8)
200var operation1 = model1.GetOperation(localRef.Parent); 243var operation2 = model1.GetOperation(localDecl); 328var operation1 = model1.GetOperation(localRef.Parent); 366var operation2 = model2.GetOperation(localDecl); 488var operation1 = model1.GetOperation(localDecl); 508var operation2 = model2.GetOperation(localRef); 580var operation1 = model1.GetOperation(localDecl); 597var operation2 = model1.GetOperation(localRef);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (2)
Symbols\Source\NullablePublicAPITests.cs (1)
4967var operation = model.GetOperation(ternary);
Symbols\SymbolEqualityTests.cs (1)
963var operation = model.GetOperation(syntaxNode);
Microsoft.CodeAnalysis.CSharp.Test.Utilities (14)
CompilationTestUtils.cs (3)
356var iop = getOperation(model, expression); 392static IOperation getOperation(SemanticModel model, SyntaxNode expression) 419static void assertTypeInfoNull(IOperation iop, TypeInfo typeInfo)
CSharpTestBase.cs (11)
2037protected static (IOperation operation, SyntaxNode node) GetOperationAndSyntaxForTest<TSyntaxNode>(CSharpCompilation compilation) 2048var operation = model.GetOperation(syntaxNode); 2063protected static string GetOperationTreeForTest(CSharpCompilation compilation, IOperation operation) 2080protected static IOperation VerifyOperationTreeForTest<TSyntaxNode>(CSharpCompilation compilation, string expectedOperationTree, Action<IOperation, Compilation, SyntaxNode> additionalOperationTreeVerifier = null) 2096protected static void VerifyOperationTree(CSharpCompilation compilation, IOperation operation, string expectedOperationTree) 2135Action<IOperation, Compilation, SyntaxNode> additionalOperationTreeVerifier = null) 2161Action<IOperation, Compilation, SyntaxNode> additionalOperationTreeVerifier = null, 2182Action<IOperation, Compilation, SyntaxNode> additionalOperationTreeVerifier = null) 2200Action<IOperation, Compilation, SyntaxNode> additionalOperationTreeVerifier = null, 2258Action<IOperation, Compilation, SyntaxNode> additionalOperationTreeVerifier = null,
Microsoft.CodeAnalysis.CSharp.Workspaces (11)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (10)
87var castExpressionOperation = semanticModel.GetOperation(cast.Expression, cancellationToken); 95var current = castExpressionOperation.Parent.Parent; 203var originalOperation = originalSemanticModel.GetOperation(castNode, cancellationToken); 262var rewrittenOperation = rewrittenSemanticModel.GetOperation(rewrittenExpression.WalkDownParentheses(), cancellationToken); 794var rewrittenOperation = rewrittenSemanticModel.GetOperation(rewrittenBitwiseNotExpression, cancellationToken); 913var operation = semanticModel.GetOperation(parentBinary, cancellationToken); 936private static bool ConvertedHasUserDefinedEquals(BinaryOperatorKind operatorKind, IOperation operation) 975private static bool IsConstantNull(IOperation operation) 1110var operation = semanticModel.GetOperation(expression.WalkDownParentheses(), cancellationToken); 1406var operation = semanticModel.GetOperation(expression, cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\InitializeParameter\CSharpInitializeParameterService.cs (1)
102foreach (var operation in blockOperation.Operations)
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (4)
Diagnostics\DiagnosticServiceTests.vb (4)
2499Public AnalyzedOperations As List(Of IOperation) = New List(Of IOperation)() 2501Public AnalyzedOperationsInsideOperationBlock As List(Of IOperation) = New List(Of IOperation)()
Microsoft.CodeAnalysis.Features (197)
ConvertForEachToFor\AbstractConvertForEachToForCodeRefactoringProvider.cs (5)
173var foreachCollection = RemoveImplicitConversion(operation.Collection); 193SemanticModel model, ILocalSymbol foreachVariable, IOperation foreachCollection, 361private static bool CheckRequireCollectionStatement(IOperation operation) 387private static IOperation RemoveImplicitConversion(IOperation collection)
ConvertIfToSwitch\AbstractConvertIfToSwitchCodeRefactoringProvider.AnalyzedNodes.cs (2)
24internal sealed class AnalyzedSwitchSection(ImmutableArray<AnalyzedSwitchLabel> labels, IOperation body, SyntaxNode syntaxToRemove) 27public readonly IOperation Body = body;
ConvertIfToSwitch\AbstractConvertIfToSwitchCodeRefactoringProvider.Analyzer.cs (20)
50public abstract bool HasUnreachableEndPoint(IOperation operation); 71public (ImmutableArray<AnalyzedSwitchSection>, SyntaxNode TargetExpression) AnalyzeIfStatementSequence(ReadOnlySpan<IOperation> operations) 74if (!ParseIfStatementSequence(operations, sections, topLevel: true, out var defaultBodyOpt)) 96ReadOnlySpan<IOperation> operations, 99out IOperation? defaultBodyOpt) 132var nextStatement = operations[current]; 152private bool ParseIfStatement(IOperation operation, ArrayBuilder<AnalyzedSwitchSection> sections, out IOperation? defaultBodyOpt) 181private bool ParseIfStatementOrBlock(IOperation op, ArrayBuilder<AnalyzedSwitchSection> sections, out IOperation? defaultBodyOpt) 205private bool ParseSwitchLabels(IOperation operation, ArrayBuilder<AnalyzedSwitchLabel> labels) 227private AnalyzedSwitchLabel? ParseSwitchLabel(IOperation operation) 276private AnalyzedPattern? ParsePattern(IOperation operation, ArrayBuilder<TExpressionSyntax> guards) 391bool CheckTargetExpression(IOperation left, IOperation right) 395private static (BoundKind Kind, IOperation Expression, IOperation Value) GetRangeBound(IBinaryOperation op) 441private static bool IsConstant(IOperation operation) 449private bool CheckTargetExpression(IOperation operation) 468private bool CheckConstantType(IOperation operation)
ConvertIfToSwitch\AbstractConvertIfToSwitchCodeRefactoringProvider.cs (2)
86var ifOperation = semanticModel.GetOperation(ifStatement); 138static OperationKind GetSwitchArmKind(IOperation op)
ConvertIfToSwitch\AbstractConvertIfToSwitchCodeRefactoringProvider.Rewriting.cs (1)
24public abstract IEnumerable<SyntaxNode> AsSwitchSectionStatements(IOperation operation);
ExtractMethod\MethodExtractor.Analyzer.cs (1)
435var selectionOperation = this.SemanticModel.GetOperation(containingScope);
InitializeParameter\AbstractAddParameterCheckCodeRefactoringProvider.cs (13)
188IOperation statement, IParameterSymbol parameter, 197var operation = semanticModel.GetOperation(coalesceNode, cancellationToken); 211private static bool IsIfNullCheck(IOperation statement, IParameterSymbol parameter) 215var condition = ifStatement.Condition; 277foreach (var statement in blockStatementOpt.Operations) 294private static bool IsStringCheck(IOperation condition, IParameterSymbol parameter) 308private static bool IsNullCheck(IOperation operand1, IOperation operand2, IParameterSymbol parameter) 423var checkStatement = TryFindParameterCheckStatement( 433var checkStatement = TryFindParameterCheckStatement( 453private static IOperation? TryFindParameterCheckStatement( 461foreach (var statement in blockStatement.Operations) 510foreach (var statement in blockStatement.Operations)
InitializeParameter\AbstractInitializeMemberFromParameterCodeRefactoringProviderMemberCreation.cs (6)
76var assignmentStatement = InitializeParameterHelpersCore.TryFindFieldOrPropertyAssignmentStatement(parameter, blockStatement); 226var assignmentOp = InitializeParameterHelpersCore.TryFindFieldOrPropertyAssignmentStatement(parameter, blockStatement); 545var statement = TryFindFieldOrPropertyAssignmentStatement( 573private static IOperation? TryFindFieldOrPropertyAssignmentStatement( 579foreach (var statement in blockStatement.Operations) 672foreach (var statement in blockStatement.Operations)
InitializeParameter\AbstractInitializeParameterCodeRefactoringProvider.cs (3)
157var operation = semanticModel.GetOperation( 181IOperation condition, 187var childOperation = semanticModel.GetOperation(child, cancellationToken);
InlineMethod\AbstractInlineMethodRefactoringProvider.InlineContext.cs (2)
395var operation = semanticModel.GetOperation(methodDeclarationSyntax, cancellationToken); 401public override void Visit(IOperation? operation)
InlineMethod\AbstractInlineMethodRefactoringProvider.MethodParametersInfo.cs (1)
501var argumentExpressionOperation = argumentOperation.Value;
IntroduceUsingStatement\AbstractIntroduceUsingStatementCodeRefactoringProvider.cs (1)
123var initializer = (localDeclaration.Initializer ?? declarator.Initializer)?.Value;
IntroduceVariable\AbstractIntroduceVariableService.cs (3)
349var originalOperation = originalSemanticModel.GetOperation(expressionInOriginal, cancellationToken); 352var currentOperation = currentSemanticModel.GetOperation(nodeInCurrent, cancellationToken); 370static bool IsInstanceMemberReference(IOperation operation)
src\Analyzers\Core\Analyzers\ConvertTypeofToNameof\AbstractConvertTypeOfToNameOfDiagnosticAnalyzer.cs (1)
54private static bool IsValidOperation(IOperation operation)
src\Analyzers\Core\Analyzers\Helpers\HashCodeAnalyzer\HashCodeAnalyzer.cs (10)
58public (bool accessesBase, ImmutableArray<ISymbol> members, ImmutableArray<IOperation> statements) GetHashedMembers(ISymbol? owningSymbol, IOperation? operation) 90IMethodSymbol method, ImmutableArray<IOperation> statements) 113IMethodSymbol method, ImmutableArray<IOperation> statements) 152var initializerValue = declaration.Initializer?.Value ?? declarator.Initializer?.Value; 198var statement = statements[i]; 224private static bool IsLocalReference(IOperation value, ILocalSymbol accumulatorVariable) 230private static bool IsLiteralNumber(IOperation value) 238private static IOperation Unwrap(IOperation value)
src\Analyzers\Core\Analyzers\Helpers\HashCodeAnalyzer\HashCodeAnalyzer.OperationDeconstructor.cs (4)
17/// Breaks down complex <see cref="IOperation"/> trees, looking for particular 45public bool TryAddHashedSymbol(IOperation value, bool seenHash) 152foreach (var element in tupleOperation.Elements) 168private static bool TryGetFieldOrProperty(IOperation operation, [NotNullWhen(true)] out ISymbol? symbol)
src\Analyzers\Core\Analyzers\PopulateSwitch\AbstractPopulateSwitchDiagnosticAnalyzer.cs (3)
17where TSwitchOperation : IOperation 34protected abstract IOperation GetValueOfSwitchOperation(TSwitchOperation operation); 59var value = GetValueOfSwitchOperation(switchOperation);
src\Analyzers\Core\Analyzers\PopulateSwitch\AbstractPopulateSwitchExpressionDiagnosticAnalyzer.cs (1)
23protected override IOperation GetValueOfSwitchOperation(ISwitchExpressionOperation operation)
src\Analyzers\Core\Analyzers\PopulateSwitch\AbstractPopulateSwitchStatementDiagnosticAnalyzer.cs (1)
23protected override IOperation GetValueOfSwitchOperation(ISwitchOperation operation)
src\Analyzers\Core\Analyzers\PopulateSwitch\PopulateSwitchExpressionHelpers.cs (2)
18var switchExpression = operation.Value; 76private static void RemoveIfConstantPatternHasValue(IOperation operation, Dictionary<long, ISymbol> enumMembers)
src\Analyzers\Core\Analyzers\PopulateSwitch\PopulateSwitchStatementHelpers.cs (2)
57var switchExpression = switchStatement.Value; 118var value = ((ISingleValueCaseClauseOperation)clause).Value;
src\Analyzers\Core\Analyzers\QualifyMemberAccess\AbstractQualifyMemberAccessDiagnosticAnalyzer.cs (4)
52protected abstract Location GetLocation(IOperation operation); 77private void AnalyzeOperation(OperationAnalysisContext context, IOperation operation, IOperation? instanceOperation) 138private static bool IsStaticMemberOrIsLocalFunction(IOperation operation)
src\Analyzers\Core\Analyzers\RemoveRedundantEquality\AbstractRemoveRedundantEqualityDiagnosticAnalyzer.cs (3)
80IOperation leftOperand, 81IOperation rightOperand, 119static bool? TryGetLiteralValue(IOperation? operand)
src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\SuppressMessageAttributeState.cs (9)
49out ImmutableArray<(string name, IOperation value)> namedAttributeArguments) 51var operation = (model.GetOperation(attributeSyntax, cancellationToken) as IAttributeOperation)?.Operation; 58using var _ = ArrayBuilder<(string name, IOperation value)>.GetInstance(out var builder); 59foreach (var initializer in initializerOperation.Initializers) 73public static bool HasValidScope(ImmutableArray<(string name, IOperation value)> namedAttributeArguments, out TargetScope targetScope) 91ImmutableArray<(string name, IOperation value)> namedAttributeArguments, 95out IOperation? targetValueOperation, 131ImmutableArray<(string name, IOperation value)> namedAttributeArguments, 134[NotNullWhen(returnValue: true)] out IOperation? argumentValueOperation)
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (4)
231var operation = context.Operation; 296var operation = operationContext.Operation; 412var operation = operationContext.Operation; 443var nameofArgument = ((INameOfOperation)operationContext.Operation).Argument;
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.cs (2)
110protected abstract Location GetDefinitionLocationToFade(IOperation unusedDefinition); 124protected virtual bool ShouldBailOutFromRemovableAssignmentAnalysis(IOperation unusedSymbolWriteOperation)
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.BlockAnalyzer.cs (17)
32/// We use this value in <see cref="ShouldAnalyze(IOperation, ISymbol, ref bool)"/> to determine whether to bail from analysis or not. 45/// We use this value in <see cref="ShouldAnalyze(IOperation, ISymbol, ref bool)"/> to determine whether to bail from analysis or not. 51/// We use this value in <see cref="ShouldAnalyze(IOperation, ISymbol, ref bool)"/> to determine whether to bail from analysis or not. 98var firstBlock = context.OperationBlocks[0]; 138foreach (var operationBlock in context.OperationBlocks) 149foreach (var operationBlock in context.OperationBlocks) 170var value = expressionStatement.Operation; 253/// delegate escape, and corresponding bail out from flow analysis in <see cref="ShouldAnalyze(IOperation, ISymbol, ref bool)"/>. 257private static bool IsHandledDelegateCreationOrAnonymousFunctionTreeShape(IOperation operation) 301/// delegate escape, and corresponding bail out from flow analysis in <see cref="ShouldAnalyze(IOperation, ISymbol, ref bool)"/>. 306private static bool IsHandledLocalOrParameterReferenceTreeShape(IOperation operation) 366private bool ShouldAnalyze(IOperation operationBlock, ISymbol owningSymbol, ref bool hasUnknownOperationNoneDescendant) 377foreach (var operation in operationBlock.Descendants()) 490foreach (var operationBlock in context.OperationBlocks) 590IOperation unreadWriteOperation, 633bool IsRemovableAssignmentWithoutSideEffects(IOperation unusedSymbolWriteOperation) 657static bool IsRemovableAssignmentValueWithoutSideEffects(IOperation assignmentValue)
src\Analyzers\Core\Analyzers\SimplifyInterpolation\AbstractSimplifyInterpolationHelpers.cs (17)
24protected abstract SyntaxNode GetPreservedInterpolationExpressionSyntax(IOperation operation); 39var expression = Unwrap(interpolation.Expression); 54private static IOperation? Unwrap(IOperation? expression, bool towardsParent = false) 76IVirtualCharService virtualCharService, ISyntaxFacts syntaxFacts, IOperation expression, out IOperation unwrapped, 82HasNonImplicitInstance(invocation, out var instance) && 137private static bool IsInvariantCultureReference(IOperation operation) 156private static bool IsInsideFormattableStringInvariant(IOperation operation) 177private static IEnumerable<IOperation> AncestorsAndSelf(IOperation operation) 179for (var current = operation; current is not null; current = current.Parent) 192IOperation expression, out IOperation unwrapped, 197HasNonImplicitInstance(invocation, out var instance)) 208var alignmentOp = invocation.Arguments[0].Value; 235private static bool HasNonImplicitInstance(IInvocationOperation invocation, [NotNullWhen(true)] out IOperation? instance)
src\Analyzers\Core\Analyzers\UseAutoProperty\AbstractUseAutoPropertyAnalyzer.cs (1)
515var operation = semanticModel.GetOperation(expression, cancellationToken);
src\Analyzers\Core\Analyzers\UseConditionalExpression\ForAssignment\AbstractUseConditionalExpressionForAssignmentDiagnosticAnalyzer.cs (2)
31GetSyntaxFacts(), ifOperation, out var isRef, out var trueStatement, out var falseStatement, out var trueAssignment, out var falseAssignment))
src\Analyzers\Core\Analyzers\UseConditionalExpression\ForAssignment\UseConditionalExpressionForAssignmentHelpers.cs (9)
20[NotNullWhen(true)] out IOperation trueStatement, 21[NotNullWhen(true)] out IOperation? falseStatement, 93static bool ReferencesDeclaredVariableInAssignment(IOperation condition, IOperation? trueTarget, IOperation? falseTarget) 98foreach (var operation in condition.DescendantsAndSelf()) 119static bool ContainsLocalReference(HashSet<ILocalSymbol> declaredPatternSymbols, IOperation? target) 123foreach (var operation in target.DescendantsAndSelf()) 138[NotNullWhen(true)] IOperation? statement,
src\Analyzers\Core\Analyzers\UseConditionalExpression\ForReturn\AbstractUseConditionalExpressionForReturnDiagnosticAnalyzer.cs (3)
31GetSyntaxFacts(), ifOperation, containingSymbol, out var isRef, out var trueStatement, out var falseStatement, out var trueReturn, out var falseReturn)) 51protected virtual bool IsStatementSupported(IOperation statement)
src\Analyzers\Core\Analyzers\UseConditionalExpression\ForReturn\UseConditionalExpressionForReturnHelpers.cs (3)
18[NotNullWhen(true)] out IOperation? trueStatement, 19[NotNullWhen(true)] out IOperation? falseStatement, 127private static bool IsReturnExprOrThrow(IOperation? statement)
src\Analyzers\Core\Analyzers\UseConditionalExpression\UseConditionalExpressionHelpers.cs (7)
21IOperation whenTrue, IOperation whenFalse) 59public static IOperation? UnwrapSingleStatementBlock(IOperation? statement) 104public static bool IsBooleanLiteral(IOperation trueValue, bool val) 107public static bool CanSimplify(IOperation trueValue, IOperation falseValue, bool isRef, out bool negate)
src\Analyzers\Core\Analyzers\UseSystemHashCode\UseSystemHashCodeDiagnosticAnalyzer.cs (1)
50var operation = context.OperationBlocks[0];
src\Analyzers\Core\Analyzers\UseThrowExpression\AbstractUseThrowExpressionDiagnosticAnalyzer.cs (4)
214var condition = ifStatement.Condition; 241IOperation operation, 263private static bool IsNull(IOperation operation) 274var containingOperation = semanticModel.GetOperation(throwStatement.GetRequiredParent(), cancellationToken);
src\Analyzers\Core\CodeFixes\PopulateSwitch\AbstractPopulateSwitchCodeFixProvider.cs (1)
29where TSwitchOperation : IOperation
src\Analyzers\Core\CodeFixes\UseConditionalExpression\AbstractUseConditionalExpressionCodeFixProvider.cs (7)
86IOperation trueStatement, IOperation falseStatement, 87IOperation trueValue, IOperation falseValue, 128protected virtual TExpressionSyntax WrapReturnExpressionIfNecessary(TExpressionSyntax returnExpression, IOperation returnOperation) 158SyntaxGenerator generator, IOperation statement, IOperation value)
src\Analyzers\Core\CodeFixes\UseConditionalExpression\ForAssignment\AbstractUseConditionalExpressionForAssignmentCodeFixProvider.cs (4)
70out var trueStatement, out var falseStatement, 247private static bool ReferencesLocalVariable(IOperation operation, ILocalSymbol variable) 255foreach (var child in operation.ChildOperations)
src\Analyzers\Core\CodeFixes\UseConditionalExpression\ForReturn\AbstractUseConditionalExpressionForReturnCodeFixProvider.cs (2)
60out var trueStatement, out var falseStatement,
ValueTracking\ValueTracker.OperationCollector.cs (13)
24public Task VisitAsync(IOperation operation, CancellationToken cancellationToken) 45private async Task VisitReturnDescendentsAsync(IOperation operation, bool allowImplicit, CancellationToken cancellationToken) 48foreach (var returnOperation in returnOperations) 55private async Task VisitDefaultAsync(IOperation operation, CancellationToken cancellationToken) 88private async Task<bool> TryVisitChildrenAsync(IOperation operation, CancellationToken cancellationToken) 90foreach (var child in operation.ChildOperations) 110private Task VisitReferenceAsync(IOperation operation, CancellationToken cancellationToken) 141Task AddReferenceAsync(IOperation operation, CancellationToken cancellationToken) 172private async Task AddOperationAsync(IOperation operation, ISymbol symbol, CancellationToken cancellationToken) 276private static bool IsContainedIn<TContainingOperation>(IOperation? operation) where TContainingOperation : IOperation 279private static bool IsContainedIn<TContainingOperation>(IOperation? operation, [NotNullWhen(returnValue: true)] out TContainingOperation? containingOperation) where TContainingOperation : IOperation
Microsoft.CodeAnalysis.Test.Utilities (151)
CommonTestBase.cs (20)
595private static Dictionary<IOperation, IOperation> GetParentOperationsMap(SemanticModel model) 598var topOperations = new HashSet<IOperation>(); 604var map = new Dictionary<IOperation, IOperation>(); 605foreach (var topOperation in topOperations) 616private static void CollectParentOperations(IOperation operation, Dictionary<IOperation, IOperation> map) 619foreach (var child in operation.ChildOperations) 627private static void CollectTopOperations(SemanticModel model, SyntaxNode node, HashSet<IOperation> topOperations) 631var operation = model.GetOperation(child); 650var operation = model.GetOperation(node); 670var originalSet = new HashSet<IOperation>(operation.DescendantsAndSelf()); 671var clonedSet = new HashSet<IOperation>(clonedOperation.DescendantsAndSelf()); 678private static void VerifyOperationTreeContracts(IOperation root) 681var set = new HashSet<IOperation>(root.DescendantsAndSelf()); 683foreach (var child in root.DescendantsAndSelf()) 695SemanticModel semanticModel, HashSet<IOperation> set, SyntaxNode node) 699var operation = semanticModel.GetOperation(node);
Compilation\CompilationExtensions.cs (5)
277var roots = ArrayBuilder<(IOperation operation, ISymbol associatedSymbol)>.GetInstance(); 296var operation = semanticModel.GetOperation(node); 320var explicitNodeMap = new Dictionary<SyntaxNode, IOperation>(); 325foreach (var operation in root.DescendantsAndSelf()) 361void checkControlFlowGraph(IOperation root, ISymbol associatedSymbol)
Compilation\ControlFlowGraphVerifier.cs (19)
30IOperation operationRoot = model.GetOperation(syntaxNode); 235foreach (var statement in statements) 262IOperation value = block.BranchValue; 301IOperation value = block.ConditionKind == ControlFlowConditionKind.None ? block.BranchValue : null; 412var operation = block.Operations[j]; 485IOperation lastOperation = null; 681bool isAggregateGroupCapture(IOperation operation, ControlFlowRegion region, BasicBlock block, CaptureId id) 770PooledHashSet<CaptureId> state, IOperation operation, BasicBlock block, int operationIndex, 896IOperation containingArgument = reference; 1038bool isConditionalAccessCaptureUsedAfterNullCheck(IOperation operation, ControlFlowRegion region, BasicBlock block, CaptureId id) 1324foreach (IOperation operation in block.Operations) 1628void validateRoot(IOperation root) 1636foreach (var operation in root.Descendants()) 1651foreach (IOperation operation in block.Operations) 1695void recordReferences(IOperation operation) 1697foreach (IOperation node in operation.DescendantsAndSelf()) 1779string getOperationTree(IOperation operation) 1805Compilation compilation, IOperation root, int initialIndent, ISymbol associatedSymbol) : 1833private static bool CanBeInControlFlowGraph(IOperation n)
Compilation\OperationTreeVerifier.cs (16)
26protected readonly IOperation _root; 28private readonly Dictionary<SyntaxNode, IOperation> _explicitNodeMap; 36public OperationTreeVerifier(Compilation compilation, IOperation root, int initialIndent) 45_explicitNodeMap = new Dictionary<SyntaxNode, IOperation>(); 49public static string GetOperationTree(Compilation compilation, IOperation operation, int initialIndent = 0) 55foreach (var op in operation.DescendantsAndSelf()) 92private void LogCommonPropertiesAndNewLine(IOperation operation) 98private void LogCommonProperties(IOperation operation) 178private static bool ShouldLogType(IOperation operation) 298public override void Visit(IOperation operation) 337private void Visit(IOperation operation, string header) 395private void VisitChildren(IOperation operation) 407where T : IOperation 427private void VisitInstance(IOperation instance) 432internal override void VisitNoneOperation(IOperation operation) 1456foreach (var initializer in operation.Initializers)
Compilation\SemanticModelExtensions.cs (1)
22IOperation operation = model.GetOperation(node);
Compilation\TestOperationVisitor.cs (41)
29public override void DefaultVisit(IOperation operation) 34internal override void VisitNoneOperation(IOperation operation) 42public override void Visit(IOperation operation) 66var builder = count == 0 ? null : ArrayBuilder<IOperation>.GetInstance(count); 67foreach (IOperation child in operation.ChildOperations) 82var first = forwards.Current; 89var last = reversed.Current; 100foreach (IOperation child in operation.ChildOperations.Reverse()) 135IEnumerable<IOperation> children = operation.IgnoredArguments; 149IEnumerable<IOperation> children = operation.IgnoredDimensions.Concat(operation.Declarators); 177internal static void VerifySubTree(IOperation root, bool hasNonNullParent = false) 192var explicitNodeMap = new Dictionary<SyntaxNode, IOperation>(); 194foreach (IOperation descendant in root.DescendantsAndSelf()) 258IEnumerable<IOperation> children; 295IEnumerable<IOperation> children = operation.Before; 323IEnumerable<IOperation> children; 334IEnumerable<IOperation> children = new[] { operation.Collection, operation.LoopControlVariable, operation.Body }.Concat(operation.NextVariables); 428IEnumerable<IOperation> children = new[] { operation.Body }; 445IEnumerable<IOperation> children = Array.Empty<IOperation>(); 541IEnumerable<IOperation> children; 567IEnumerable<IOperation> children = new[] { operation.Target }.Concat(operation.Arguments); 649VisitMemberReference(operation, Array.Empty<IOperation>()); 652private void VisitMemberReference(IMemberReferenceOperation operation, IEnumerable<IOperation> additionalChildren) 657IEnumerable<IOperation> children; 1036IEnumerable<IOperation> children = operation.Arguments; 1049foreach (var initializer in operation.Initializers) 1063IEnumerable<IOperation> children = operation.Arguments; 1140IEnumerable<IOperation> children = operation.DimensionSizes; 1300IEnumerable<IOperation> children = new[] { operation.Expression }; 1321IEnumerable<IOperation> children = new[] { operation.HandlerCreation, operation.Content }; 1473IEnumerable<IOperation> children = operation.Patterns.Cast<IOperation>(); 1515IEnumerable<IOperation> children = operation.DeconstructionSubpatterns.Cast<IOperation>(); 1524var children = new IOperation[] { operation.Member, operation.Pattern }; 1553var children = operation.Arms.Cast<IOperation>().Prepend(operation.Value); 1620AssertEx.Equal(new IOperation[] { operation.EventReference }.Concat(operation.Arguments), operation.ChildOperations); 1636var builder = ArrayBuilder<IOperation>.GetInstance(); 1765IOperation[] children = operation.ChildOperations.ToArray(); 1820IEnumerable<IOperation> children = SpecializedCollections.SingletonEnumerable(operation.Operand).Concat(operation.Initializer);
Diagnostics\BoxingOperationAnalyzer.cs (1)
43IOperation operation = operationContext.Operation;
Diagnostics\CommonDiagnosticAnalyzers.cs (9)
1230private readonly ConcurrentDictionary<IOperation, (ControlFlowGraph Graph, ISymbol AssociatedSymbol)> _controlFlowGraphMapOpt; 1252_controlFlowGraphMapOpt = verifyGetControlFlowGraph ? new ConcurrentDictionary<IOperation, (ControlFlowGraph, ISymbol)>() : null; 1267private void CacheAndVerifyControlFlowGraph(ImmutableArray<IOperation> operationBlocks, Func<IOperation, (ControlFlowGraph Graph, ISymbol AssociatedSymbol)> getControlFlowGraph) 1271foreach (var operationBlock in operationBlocks) 1390foreach (var operationRoot in c.OperationBlocks) 1423foreach (var operationBlock in operationBlockAnalysisContext.OperationBlocks) 2987public readonly List<IOperation> AnalyzedOperations = new(); 2989public readonly List<IOperation> AnalyzedOperationsInsideOperationBlock = new();
Diagnostics\CouldHaveMoreSpecificTypeAnalyzer.cs (5)
232private static void AssignTo(IOperation target, Dictionary<ILocalSymbol, HashSet<INamedTypeSymbol>> localsSourceTypes, Dictionary<IFieldSymbol, HashSet<INamedTypeSymbol>> fieldsSourceTypes, IOperation sourceValue) 237private static void AssignTo(IOperation target, Dictionary<ILocalSymbol, HashSet<INamedTypeSymbol>> localsSourceTypes, Dictionary<IFieldSymbol, HashSet<INamedTypeSymbol>> fieldsSourceTypes, ITypeSymbol sourceType) 252private static void AssignTo<SymbolType>(SymbolType target, ITypeSymbol targetType, Dictionary<SymbolType, HashSet<INamedTypeSymbol>> sourceTypes, IOperation sourceValue) 279private static ITypeSymbol OriginalType(IOperation value)
Diagnostics\FieldCouldBeReadOnlyAnalyzer.cs (1)
111private static void AssignTo(IOperation target, bool inConstructor, ITypeSymbol staticConstructorType, HashSet<IFieldSymbol> assignedToFields, HashSet<IFieldSymbol> mightBecomeReadOnlyFields)
Diagnostics\LocalCouldBeConstAnalyzer.cs (1)
114private static void AssignTo(IOperation target, HashSet<ILocalSymbol> assignedToLocals, HashSet<ILocalSymbol> mightBecomeConstLocals)
Diagnostics\OperationTestAnalyzer.cs (31)
150IOperation forCondition = forLoop.Condition; 155IOperation conditionLeft = condition.LeftOperand; 156IOperation conditionRight = condition.RightOperand; 169IOperation setup = forLoop.Before[0]; 184IOperation advance = forLoop.AtLoopBottom[0]; 187IOperation advanceExpression = ((IExpressionStatementOperation)advance).Operation; 228ILocalSymbol testVariable, IOperation advanceExpression, 354IOperation singleValueExpression = singleValueClause.Value; 373IOperation rangeMinExpression = rangeClause.MinimumValue; 374IOperation rangeMaxExpression = rangeClause.MaximumValue; 397IOperation relationalValueExpression = relationalClause.Value; 572foreach (IOperation element in initializer.ElementValues) 584private static void TestAscendingArgument(OperationAnalysisContext operationContext, IOperation argument, ref long priorArgumentValue) 715var initializer = operationContext.Operation; 1326foreach (var statement in block.Operations) 1378var operation = operationContext.Operation; 1380IOperation receiver; 1609var left = binary.LeftOperand; 1610var right = binary.RightOperand; 1641var operand = unary.Operand; 1693var nullList = new List<IOperation>(); 1694var paramsList = new List<IOperation>(); 1698foreach (var nullSyntaxOperation in nullList) 1703foreach (var paramsarrayArgumentOperation in paramsList) 1718private readonly List<IOperation> _nullList; 1719private readonly List<IOperation> _paramsList; 1721public Walker(List<IOperation> nullList, List<IOperation> paramsList) 1727public override void Visit(IOperation operation) 1785var operation = operationContext.Operation; 1930var forCondition = forLoop.LimitValue;
Extensions\OperationExtensions.cs (1)
11public static bool MustHaveNullType(this IOperation operation)
Microsoft.CodeAnalysis.UnitTests (13)
Diagnostics\OperationTests.cs (13)
26private static void TestCore(Func<ImmutableArray<IOperation>, ImmutableArray<string>, ImmutableArray<RefKind>, HasDynamicArgumentsExpression> createDynamicExpression) 29ImmutableArray<IOperation> arguments = ImmutableArray<IOperation>.Empty; 37arguments = ImmutableArray.Create((IOperation)null); 45arguments = ImmutableArray.Create((IOperation)null); 55arguments = ImmutableArray.Create((IOperation)null); 80Func<ImmutableArray<IOperation>, ImmutableArray<string>, ImmutableArray<RefKind>, HasDynamicArgumentsExpression> createDynamicExpression = 95Func<ImmutableArray<IOperation>, ImmutableArray<string>, ImmutableArray<RefKind>, HasDynamicArgumentsExpression> createDynamicExpression = 110Func<ImmutableArray<IOperation>, ImmutableArray<string>, ImmutableArray<RefKind>, HasDynamicArgumentsExpression> createDynamicExpression = 132IOperation parent = new BlockOperation(ImmutableArray<IOperation>.Empty, ImmutableArray<ILocalSymbol>.Empty, 145private void TestGetFlowGraphInvalidArgumentCore(string argumentExceptionMessage, IOperation parent) 151ImmutableArray<IOperation>.Empty, ImmutableArray<ILocalSymbol>.Empty,
Microsoft.CodeAnalysis.VisualBasic (172)
Binding\MemberSemanticModel.vb (4)
839Friend Overrides Function GetOperationWorker(node As VisualBasicSyntaxNode, cancellationToken As CancellationToken) As IOperation 841Dim result As IOperation = Nothing 853Dim rootOperation As IOperation = _operationFactory.Value.Create(rootNode) 1210Private ReadOnly _guardedIOperationNodeMap As New Dictionary(Of SyntaxNode, IOperation)
Compilation\SemanticModel.vb (2)
140Protected Overrides Function GetOperationCore(node As SyntaxNode, cancellationToken As CancellationToken) As IOperation 147Friend Overridable Function GetOperationWorker(node As VisualBasicSyntaxNode, cancellationToken As CancellationToken) As IOperation
Compilation\SpeculativeSemanticModelWithMemberModel.vb (1)
233Friend Overrides Function GetOperationWorker(node As VisualBasicSyntaxNode, cancellationToken As CancellationToken) As IOperation
Compilation\SyntaxTreeSemanticModel.vb (1)
355Friend Overrides Function GetOperationWorker(node As VisualBasicSyntaxNode, cancellationToken As CancellationToken) As IOperation
Compilation\VisualBasicCompilation.vb (1)
1898Friend Overrides Function ClassifyConvertibleConversion(source As IOperation, destination As ITypeSymbol, ByRef constantValue As ConstantValue) As IConvertibleConversion
Operations\VisualBasicOperationFactory.vb (141)
55Public Function Create(boundNode As BoundNode) As IOperation 321Dim children As ImmutableArray(Of IOperation) = GetIOperationChildren(boundNode) 331Public Function CreateFromArray(Of TBoundNode As BoundNode, TOperation As {Class, IOperation})(nodeArray As ImmutableArray(Of TBoundNode)) As ImmutableArray(Of TOperation) 340Friend Function GetIOperationChildren(boundNode As BoundNode) As ImmutableArray(Of IOperation) 343Return ImmutableArray(Of IOperation).Empty 346Dim builder = ArrayBuilder(Of IOperation).GetInstance(boundNodeWithChildren.Children.Length) 359Private Function CreateBoundAssignmentOperatorOperation(boundAssignmentOperator As BoundAssignmentOperator) As IOperation 365Dim children As ImmutableArray(Of IOperation) = GetIOperationChildren(boundAssignmentOperator) 370Dim target As IOperation = Create(boundAssignmentOperator.Left) 371Dim value As IOperation = Create(boundAssignmentOperator.Right) 414Dim awaitedValue As IOperation = Create(boundAwaitOperator.Operand) 422Dim argument As IOperation = Create(boundNameOfOperator.Argument) 448Dim receiver as IOperation = CreateReceiverOperation(boundReceiver, targetMethod) 465Dim operand As IOperation = Create(boundParenthesized.Expression) 474Dim arrayReference as IOperation = Create(boundArrayAccess.Expression) 475Dim indices = CreateFromArray(Of BoundExpression, IOperation)(boundArrayAccess.Indices) 482Friend Function CreateBoundUnaryOperatorChild(boundOperator As BoundExpression) As IOperation 499Dim operand As IOperation = CreateBoundUnaryOperatorChild(boundUnaryOperator) 512Dim operand As IOperation = CreateBoundUnaryOperatorChild(boundUserDefinedUnaryOperator) 528Friend Function CreateBoundBinaryOperatorChild(binaryOperator As BoundExpression, isLeft As Boolean) As IOperation 549Private Function CreateBoundBinaryOperatorOperation(boundBinaryOperator As BoundBinaryOperator) As IOperation 561Dim left As IOperation = Nothing 565Dim right As IOperation = Create(currentBinary.Right) 584Dim left As IOperation = CreateBoundBinaryOperatorChild(boundUserDefinedBinaryOperator, isLeft:=True) 585Dim right As IOperation = CreateBoundBinaryOperatorChild(boundUserDefinedBinaryOperator, isLeft:=False) 597Dim value As IOperation = Create(boundBinaryConditionalExpression.TestExpression) 598Dim whenFalse As IOperation = Create(boundBinaryConditionalExpression.ElseExpression) 622Dim left As IOperation = CreateBoundBinaryOperatorChild(boundUserDefinedShortCircuitingOperator, isLeft:=True) 623Dim right As IOperation = CreateBoundBinaryOperatorChild(boundUserDefinedShortCircuitingOperator, isLeft:=False) 656Dim children = CreateFromArray(Of BoundExpression, IOperation)(boundBadExpression.ChildBoundNodes) 671Dim children As ImmutableArray(Of IOperation) = ImmutableArray(Of IOperation).Empty 685Dim namedArguments = CreateFromArray(Of BoundExpression, IOperation)(boundAttribute.NamedArguments) 693Private Function CreateBoundTryCastOperation(boundTryCast As BoundTryCast) As IOperation 697Private Function CreateBoundDirectCastOperation(boundDirectCast As BoundDirectCast) As IOperation 701Private Function CreateBoundConversionOperation(boundConversion As BoundConversion) As IOperation 719Private Function CreateBoundConversionOrCastOperation(boundConversionOrCast As BoundConversionOrCast, isTryCast As Boolean) As IOperation 749Dim target As IOperation = CreateBoundDelegateCreationExpressionChildOperation(boundDelegateCreationExpression) 765Dim receiverOpt As IOperation = CreateReceiverOperation( 778Dim condition As IOperation = Create(boundTernaryConditionalExpression.Condition) 779Dim whenTrue As IOperation = Create(boundTernaryConditionalExpression.WhenTrue) 780Dim whenFalse As IOperation = Create(boundTernaryConditionalExpression.WhenFalse) 807Private Function CreateBoundLateInvocationOperation(boundLateInvocation As BoundLateInvocation) As IOperation 808Dim operation As IOperation = Create(boundLateInvocation.Member) 809Dim arguments As ImmutableArray(Of IOperation) = CreateFromArray(Of BoundExpression, IOperation)(boundLateInvocation.ArgumentsOpt) 832Dim initializers As ImmutableArray(Of IOperation) = CreateFromArray(Of BoundExpression, IOperation)(boundObjectInitializerExpression.Initializers) 840Dim initializers As ImmutableArray(Of IOperation) = CreateFromArray(Of BoundExpression, IOperation)(boundCollectionInitializerExpression.Initializers) 864Dim dimensionSizes As ImmutableArray(Of IOperation) = CreateFromArray(Of BoundExpression, IOperation)(boundArrayCreation.Bounds) 873Dim elementValues As ImmutableArray(Of IOperation) = CreateFromArray(Of BoundExpression, IOperation)(boundArrayInitialization.Initializers) 881Dim instance As IOperation = CreateReceiverOperation( 910Dim instance As IOperation = CreateReceiverOperation(boundEventAccess.ReceiverOpt, [event]) 921Dim instance As IOperation = CreateReceiverOperation(boundFieldAccess.ReceiverOpt, field) 932Dim operation As IOperation = Create(boundConditionalAccess.Receiver) 933Dim whenNotNull As IOperation = Create(boundConditionalAccess.AccessExpression) 955Private Function CreateBoundLocalOperation(boundLocal As BoundLocal) As IOperation 968Dim instance As IOperation = Create(boundLateMemberAccess.ReceiverOpt) 992Dim value As IOperation = Create(boundFieldInitializer.InitialValue) 1000Dim value As IOperation = Create(boundPropertyInitializer.InitialValue) 1008Dim value As IOperation = Create(boundParameterEqualsValue.Value) 1014Private Function CreateBoundLValueToRValueWrapper(boundNode As BoundLValueToRValueWrapper) As IOperation 1021Private Function CreateBoundRValuePlaceholderOperation(boundRValuePlaceholder As BoundRValuePlaceholder) As IOperation 1061Dim condition as IOperation = Create(boundIfStatement.Condition) 1062Dim whenTrue as IOperation = Create(boundIfStatement.Consequence) 1063Dim whenFalse as IOperation = Create(boundIfStatement.AlternativeOpt) 1074Dim value As IOperation = Create(boundSelectStatement.ExpressionStatement.Expression) 1098Friend Function CreateBoundCaseBlockBody(boundCaseBlock As BoundCaseBlock) As ImmutableArray(Of IOperation) 1102Friend Function CreateBoundCaseBlockCondition(boundCaseBlock As BoundCaseBlock) As IOperation 1108Dim body As ImmutableArray(Of IOperation) = ImmutableArray.Create(Create(boundCaseBlock.Body)) 1109Dim condition As IOperation = CreateBoundCaseBlockCondition(boundCaseBlock) 1117Dim clauseValue As IOperation = Create(GetSingleValueCaseClauseValue(boundSimpleCaseClause)) 1124Dim minimumValue As IOperation = Create(GetCaseClauseValue(boundRangeCaseClause.LowerBoundOpt, boundRangeCaseClause.LowerBoundConditionOpt)) 1125Dim maximumValue As IOperation = Create(GetCaseClauseValue(boundRangeCaseClause.UpperBoundOpt, boundRangeCaseClause.UpperBoundConditionOpt)) 1133Dim valueExpression As IOperation = Create(GetSingleValueCaseClauseValue(boundRelationalCaseClause)) 1141Dim condition As IOperation = Create(boundDoLoopStatement.ConditionOpt) 1142Dim body As IOperation = Create(boundDoLoopStatement.Body) 1143Dim ignoredCondition As IOperation = If(boundDoLoopStatement.TopConditionOpt IsNot Nothing AndAlso boundDoLoopStatement.BottomConditionOpt IsNot Nothing, 1156Dim loopControlVariable As IOperation = CreateBoundControlVariableOperation(boundForToStatement) 1157Dim initialValue As IOperation = Create(boundForToStatement.InitialValue) 1158Dim limitValue As IOperation = Create(boundForToStatement.LimitValue) 1159Dim stepValue As IOperation = Create(boundForToStatement.StepValue) 1160Dim body As IOperation = Create(boundForToStatement.Body) 1161Dim nextVariables As ImmutableArray(Of IOperation) = If(boundForToStatement.NextVariablesOpt.IsDefault, 1162ImmutableArray(Of IOperation).Empty, 1163CreateFromArray(Of BoundExpression, IOperation)(boundForToStatement.NextVariablesOpt)) 1239Dim controlVariable As IOperation = CreateBoundControlVariableOperation(boundForEachStatement) 1240Dim collection As IOperation = Create(boundForEachStatement.Collection) 1242ImmutableArray(Of IOperation).Empty, 1243CreateFromArray(Of BoundExpression, IOperation)(boundForEachStatement.NextVariablesOpt)) 1244Dim body As IOperation = Create(boundForEachStatement.Body) 1255Friend Function CreateBoundControlVariableOperation(boundForStatement As BoundForStatement) As IOperation 1259New VariableDeclaratorOperation(localOpt, initializer:=Nothing, ignoredArguments:=ImmutableArray(Of IOperation).Empty, semanticModel:=_semanticModel, syntax:=controlVariable.Syntax, isImplicit:=boundForStatement.WasCompilerGenerated), 1273Friend Function CreateBoundCatchBlockExceptionDeclarationOrExpression(boundCatchBlock As BoundCatchBlock) As IOperation 1277Return New VariableDeclaratorOperation(boundCatchBlock.LocalOpt, initializer:=Nothing, ignoredArguments:=ImmutableArray(Of IOperation).Empty, semanticModel:=_semanticModel, syntax:=boundCatchBlock.ExceptionSourceOpt.Syntax, isImplicit:=False) 1284Dim exceptionDeclarationOrExpression as IOperation = CreateBoundCatchBlockExceptionDeclarationOrExpression(boundCatchBlock) 1285Dim filter As IOperation = Create(boundCatchBlock.ExceptionFilterOpt) 1297Dim operations As ImmutableArray(Of IOperation) = CreateFromArray(Of BoundStatement, IOperation)(boundBlock.Statements) 1318Dim children = CreateFromArray(Of BoundNode, IOperation)(boundBadStatement.ChildBoundNodes) 1324Dim returnedValue As IOperation = Create(boundReturnStatement.ExpressionOpt) 1336Dim thrownObject As IOperation = Create(boundThrowStatement.ExpressionOpt) 1344Dim condition As IOperation = Create(boundWhileStatement.Condition) 1345Dim body As IOperation = Create(boundWhileStatement.Body) 1346Dim ignoredCondition As IOperation = Nothing 1374Dim returnedValue As IOperation = Create(boundYieldStatement.Expression) 1382Dim statement As IOperation = Nothing 1420Dim lockedValue as IOperation = Create(boundSyncLockStatement.LockExpression) 1421Dim body as IOperation = Create(boundSyncLockStatement.Body) 1448Dim value As IOperation = Create(boundWithStatement.OriginalExpression) 1449Dim body As IOperation = Create(boundWithStatement.Body) 1455Friend Function CreateBoundUsingStatementResources(boundUsingStatement As BoundUsingStatement) As IOperation 1464Dim resources As IOperation = CreateBoundUsingStatementResources(boundUsingStatement) 1465Dim body As IOperation = Create(boundUsingStatement.Body) 1473Dim expression As IOperation = Create(boundExpressionStatement.Expression) 1508Private Function CreateBoundRaiseEventStatementOperation(boundRaiseEventStatement As BoundRaiseEventStatement) As IOperation 1518Dim children = CreateFromArray(Of BoundNode, IOperation)(DirectCast(boundRaiseEventStatement, IBoundInvalidNode).InvalidNodeChildren) 1529Dim expression As IOperation = GetAddRemoveHandlerStatementExpression(boundAddHandlerStatement) 1536Dim expression As IOperation = GetAddRemoveHandlerStatementExpression(boundRemoveHandlerStatement) 1553Dim elements As ImmutableArray(Of IOperation) = CreateFromArray(Of BoundExpression, IOperation)(boundTupleExpression.Arguments) 1582Dim expression As IOperation = Create(boundInterpolation.Expression) 1583Dim alignment As IOperation = Create(boundInterpolation.AlignmentOpt) 1584Dim formatString As IOperation = Create(boundInterpolation.FormatStringOpt) 1591Dim text As IOperation = CreateBoundLiteralOperation(boundLiteral, implicit:=True) 1598Dim initializers As ImmutableArray(Of IOperation) = GetAnonymousTypeCreationInitializers(boundAnonymousTypeCreationExpression) 1611Dim instance As IOperation = CreateAnonymousTypePropertyAccessImplicitReceiverOperation([property], boundAnonymousTypePropertyAccess.Syntax.FirstAncestorOrSelf(Of AnonymousObjectCreationExpressionSyntax)) 1630Private Function CreateBoundQueryExpressionOperation(boundQueryExpression As BoundQueryExpression) As IOperation 1631Dim operation As IOperation = Create(boundQueryExpression.LastOperator) 1638Private Function CreateBoundAggregateClauseOperation(boundAggregateClause As BoundAggregateClause) As IOperation 1647Dim group As IOperation = Create(boundAggregateClause.CapturedGroupOpt) 1648Dim aggregation As IOperation = Create(boundAggregateClause.UnderlyingExpression) 1655Private Function CreateBoundNullableIsTrueOperator(boundNullableIsTrueOperator As BoundNullableIsTrueOperator) As IOperation 1667Dim receiver as IOperation = CreateReceiverOperation(boundNullableIsTrueOperator.Operand, method) 1677Dim children = CreateFromArray(Of BoundNode, IOperation)(DirectCast(boundNullableIsTrueOperator, IBoundInvalidNode).InvalidNodeChildren) 1696Dim operand As IOperation = Create(boundRedimClause.Operand) 1697Dim dimensionSizes As ImmutableArray(Of IOperation) = CreateFromArray(Of BoundExpression, IOperation)(boundRedimClause.Indices)
Operations\VisualBasicOperationFactory_Methods.vb (22)
26Friend Function CreateCompoundAssignmentRightOperand(boundAssignment As BoundAssignmentOperator) As IOperation 88Dim target As IOperation = Create(boundAssignment.Left) 89Dim value As IOperation = CreateCompoundAssignmentRightOperand(boundAssignment) 147Private Function GetUserDefinedBinaryOperatorChild([operator] As BoundUserDefinedBinaryOperator, child As BoundExpression) As IOperation 152Return OperationFactory.CreateInvalidOperation(_semanticModel, [operator].UnderlyingExpression.Syntax, ImmutableArray(Of IOperation).Empty, isImplicit) 275Friend Function CreateReceiverOperation(node As BoundNode, symbol As ISymbol) As IOperation 292Private Function GetChildOfBadExpression(parent As BoundNode, index As Integer) As IOperation 298Return OperationFactory.CreateInvalidOperation(_semanticModel, parent.Syntax, ImmutableArray(Of IOperation).Empty, isImplicit) 310Friend Function GetAnonymousTypeCreationInitializers(expression As BoundAnonymousTypeCreationExpression) As ImmutableArray(Of IOperation) 317Dim builder = ArrayBuilder(Of IOperation).GetInstance(expression.Arguments.Length) 321Dim value As IOperation = Create(expression.Arguments(i)) 323Dim target As IOperation 438Dim initializerValue As IOperation = Create(asNewDeclarations.Initializer) 446ImmutableArray(Of IOperation).Empty, 459Dim initializerValue As IOperation = Create(boundLocalDeclaration.IdentifierInitializerOpt) 463Dim ignoredArguments = ImmutableArray(Of IOperation).Empty 476Friend Function GetAddRemoveHandlerStatementExpression(statement As BoundAddRemoveHandlerStatement) As IOperation 477Dim eventReference As IOperation = Create(statement.EventAccess) 478Dim handlerValue As IOperation = Create(statement.Handler) 490) As (Operation As IOperation, Conversion As Conversion, IsDelegateCreation As Boolean) 510) As (Operation As IOperation, Conversion As Conversion, IsDelegateCreation As Boolean) 560Private Function CreateDelegateCreationConversionOperand(operand As BoundExpression) As IOperation
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (3)
src\Analyzers\VisualBasic\Analyzers\QualifyMemberAccess\VisualBasicQualifyMemberAccessDiagnosticAnalyzer.vb (1)
40Protected Overrides Function GetLocation(operation As IOperation) As Location
src\Analyzers\VisualBasic\Analyzers\RemoveUnusedParametersAndValues\VisualBasicRemoveUnusedParametersAndValuesDiagnosticAnalyzer.vb (1)
74Protected Overrides Function GetDefinitionLocationToFade(unusedDefinition As IOperation) As Location
src\Analyzers\VisualBasic\Analyzers\SimplifyInterpolation\VisualBasicSimplifyInterpolationHelpers.vb (1)
18Protected Overrides Function GetPreservedInterpolationExpressionSyntax(operation As IOperation) As SyntaxNode
Microsoft.CodeAnalysis.VisualBasic.Features (5)
ConvertIfToSwitch\VisualBasicConvertIfToSwitchCodeRefactoringProvider.Analyzer.vb (1)
18Public Overrides Function HasUnreachableEndPoint(operation As IOperation) As Boolean
ConvertIfToSwitch\VisualBasicConvertIfToSwitchCodeRefactoringProvider.Rewriting.vb (1)
30Public Overrides Function AsSwitchSectionStatements(operation As IOperation) As IEnumerable(Of SyntaxNode)
src\Analyzers\VisualBasic\Analyzers\QualifyMemberAccess\VisualBasicQualifyMemberAccessDiagnosticAnalyzer.vb (1)
40Protected Overrides Function GetLocation(operation As IOperation) As Location
src\Analyzers\VisualBasic\Analyzers\RemoveUnusedParametersAndValues\VisualBasicRemoveUnusedParametersAndValuesDiagnosticAnalyzer.vb (1)
74Protected Overrides Function GetDefinitionLocationToFade(unusedDefinition As IOperation) As Location
src\Analyzers\VisualBasic\Analyzers\SimplifyInterpolation\VisualBasicSimplifyInterpolationHelpers.vb (1)
18Protected Overrides Function GetPreservedInterpolationExpressionSyntax(operation As IOperation) As SyntaxNode
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (1)
Semantics\BinaryOperators.vb (1)
1518Private Sub EnumerateChildren(iop As IOperation, ByRef numChildren as Integer)
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (7)
BasicTestBase.vb (7)
794Friend Shared Function GetOperationTreeForTest(Of TSyntaxNode As SyntaxNode)(compilation As VisualBasicCompilation, fileName As String, Optional which As Integer = 0) As (tree As String, syntax As SyntaxNode, operation As IOperation) 816Optional useLatestFrameworkReferences As Boolean = False) As (tree As String, syntax As SyntaxNode, operation As IOperation, compilation As Compilation) 827Friend Shared Sub VerifyOperationTreeForTest(Of TSyntaxNode As SyntaxNode)(compilation As VisualBasicCompilation, fileName As String, expectedOperationTree As String, Optional which As Integer = 0, Optional additionalOperationTreeVerifier As Action(Of IOperation, Compilation, SyntaxNode) = Nothing) 853Optional additionalOperationTreeVerifier As Action(Of IOperation, Compilation, SyntaxNode) = Nothing, 874Friend Shared Sub VerifyOperationTreeAndDiagnosticsForTest(Of TSyntaxNode As SyntaxNode)(compilation As VisualBasicCompilation, fileName As String, expectedOperationTree As String, expectedDiagnostics As String, Optional which As Integer = 0, Optional additionalOperationTreeVerifier As Action(Of IOperation, Compilation, SyntaxNode) = Nothing) 892Optional additionalOperationTreeVerifier As Action(Of IOperation, Compilation, SyntaxNode) = Nothing, 928Friend Shared Function GetOperationAndSyntaxForTest(Of TSyntaxNode As SyntaxNode)(compilation As Compilation, fileName As String, Optional which As Integer = 0) As (operation As IOperation, syntaxNode As SyntaxNode)
Microsoft.CodeAnalysis.Workspaces (163)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\AnalysisContextExtensions.cs (2)
186public static SyntaxNode GetAnalysisRoot(this OperationBlockStartAnalysisContext context, IOperation operationBlock, bool findInTrivia, bool getInnermostNodeForTie = false) 192public static SyntaxNode GetAnalysisRoot(this OperationBlockAnalysisContext context, IOperation operationBlock, bool findInTrivia, bool getInnermostNodeForTie = false)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\BasicBlockExtensions.cs (4)
12public static IEnumerable<IOperation> DescendantOperations(this BasicBlock basicBlock) 14foreach (var statement in basicBlock.Operations) 16foreach (var operation in statement.DescendantsAndSelf()) 24foreach (var operation in basicBlock.BranchValue.DescendantsAndSelf())
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ControlFlowGraphExtensions.cs (2)
27public static IEnumerable<IOperation> DescendantOperations(this ControlFlowGraph cfg) 31where T : IOperation
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (32)
18public static bool IsTargetOfObjectMemberInitializer(this IOperation operation) 27public static ValueUsageInfo GetValueUsageInfo(this IOperation operation, ISymbol containingSymbol) 236public static IMethodSymbol? TryGetContainingAnonymousFunctionOrLocalFunction(this IOperation? operation) 256public static bool IsInLeftOfDeconstructionAssignment(this IOperation operation, [NotNullWhen(true)] out IDeconstructionAssignmentOperation? deconstructionAssignment) 260var previousOperation = operation; 261var current = operation.Parent; 292public static bool IsAnyCompoundAssignment(this IOperation operation) 305public static bool IsInsideCatchRegion(this IOperation operation, ControlFlowGraph cfg) 325foreach (var descendant in block.DescendantOperations()) 338public static bool HasAnyOperationDescendant(this ImmutableArray<IOperation> operationBlocks, Func<IOperation, bool> predicate) 340foreach (var operationBlock in operationBlocks) 351public static bool HasAnyOperationDescendant(this IOperation operationBlock, Func<IOperation, bool> predicate) 354public static bool HasAnyOperationDescendant(this IOperation operationBlock, Func<IOperation, bool> predicate, [NotNullWhen(true)] out IOperation? foundOperation) 358foreach (var descendant in operationBlock.DescendantsAndSelf()) 371public static bool HasAnyOperationDescendant(this ImmutableArray<IOperation> operationBlocks, OperationKind kind) 374public static bool IsNumericLiteral(this IOperation operation) 377public static bool IsNullLiteral(this IOperation operand) 386public static IOperation? WalkDownConversion(this IOperation? operation) 396public static bool IsSingleThrowNotImplementedOperation([NotNullWhen(true)] this IOperation? firstBlock) 412var firstOp = block.Operations.Length == 1 434static IOperation? TryGetSingleExplicitStatement(ImmutableArray<IOperation> operations) 436IOperation? firstOp = null; 437foreach (var operation in operations) 451static bool IsThrowNotImplementedOperation(INamedTypeSymbol notImplementedExceptionType, IOperation? operation) 458public static IOperation? UnwrapImplicitConversion(this IOperation? value)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SemanticEquivalence.cs (3)
87var originalOperation = semanticModel1.GetOperation(node1); 90var currentOperation = semanticModel2.GetOperation(node2); 126private static bool IsInstanceMemberReference(IOperation operation)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SemanticModelExtensions.cs (1)
53public static IOperation GetRequiredOperation(this SemanticModel semanticModel, SyntaxNode node, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.AnalysisData.cs (14)
61protected abstract PooledDictionary<(ISymbol symbol, IOperation operation), bool> SymbolsWriteBuilder { get; } 132public abstract void OnLValueCaptureFound(ISymbol symbol, IOperation operation, CaptureId captureId); 137public abstract void SetTargetsFromSymbolForDelegate(IOperation write, ISymbol symbol); 138public abstract void SetLambdaTargetForDelegate(IOperation write, IFlowAnonymousFunctionOperation lambdaTarget); 139public abstract void SetLocalFunctionTargetForDelegate(IOperation write, IMethodReferenceOperation localFunctionTarget); 140public abstract void SetEmptyInvocationTargetsForDelegate(IOperation write); 141public abstract bool TryGetDelegateInvocationTargets(IOperation write, out ImmutableHashSet<IOperation> targets); 143protected static PooledDictionary<(ISymbol Symbol, IOperation Write), bool> CreateSymbolsWriteMap( 146var symbolsWriteMap = PooledDictionary<(ISymbol Symbol, IOperation Write), bool>.GetInstance(); 150protected static PooledDictionary<(ISymbol Symbol, IOperation Write), bool> UpdateSymbolsWriteMap( 151PooledDictionary<(ISymbol Symbol, IOperation Write), bool> symbolsWriteMap, 158(ISymbol, IOperation) key = (parameter, null); 201public void OnWriteReferenceFound(ISymbol symbol, IOperation operation, bool maybeWritten, bool isRef)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.BasicBlockAnalysisData.cs (9)
30private readonly Dictionary<ISymbol, PooledHashSet<IOperation>> _reachingWrites; 76public void ForEachCurrentWrite<TArg>(ISymbol symbol, Action<IOperation, TArg> action, TArg arg) 88public bool ForEachCurrentWrite<TArg>(ISymbol symbol, Func<IOperation, TArg, bool> action, TArg arg) 92foreach (var value in values) 106public void OnWriteReferenceFound(ISymbol symbol, IOperation operation, bool maybeWritten) 110values = PooledHashSet<IOperation>.GetInstance(); 225private static void AddEntries(Dictionary<ISymbol, PooledHashSet<IOperation>> result, BasicBlockAnalysisData source) 233values = PooledHashSet<IOperation>.GetInstance(); 242foreach (var operation in operations)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.cs (2)
32public static SymbolUsageResult Run(IOperation rootOperation, ISymbol owningSymbol, CancellationToken cancellationToken) 45var localFunctionOperation = rootOperation.Descendants()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.FlowGraphAnalysisData.cs (33)
41private readonly PooledDictionary<CaptureId, PooledHashSet<(ISymbol, IOperation)>> _lValueFlowCapturesMap; 48private readonly PooledDictionary<IOperation, PooledHashSet<IOperation>> _reachingDelegateCreationTargets; 69private readonly PooledDictionary<(int firstBlockOrdinal, int lastBlockOrdinal), PooledHashSet<(ISymbol, IOperation)>> _symbolWritesInsideBlockRangeMap; 77PooledDictionary<(ISymbol symbol, IOperation operation), bool> symbolsWriteMap, 81PooledDictionary<IOperation, PooledHashSet<IOperation>> reachingDelegateCreationTargets, 99_lValueFlowCapturesMap = PooledDictionary<CaptureId, PooledHashSet<(ISymbol, IOperation)>>.GetInstance(); 103_symbolWritesInsideBlockRangeMap = PooledDictionary<(int firstBlockOrdinal, int lastBlockOrdinal), PooledHashSet<(ISymbol, IOperation)>>.GetInstance(); 110protected override PooledDictionary<(ISymbol symbol, IOperation operation), bool> SymbolsWriteBuilder { get; } 134reachingDelegateCreationTargets: PooledDictionary<IOperation, PooledHashSet<IOperation>>.GetInstance(), 189foreach (var operation in cfg.OriginalOperation.Descendants()) 215private PooledHashSet<(ISymbol, IOperation)> GetOrCreateSymbolWritesInBlockRange(int firstBlockOrdinal, int lastBlockOrdinal, CancellationToken cancellationToken) 220var operations = PooledHashSet<IOperation>.GetInstance(); 224writesInBlockRange = PooledHashSet<(ISymbol, IOperation)>.GetInstance(); 241PooledHashSet<IOperation> operationsBuilder, 248foreach (var operation in cfg.Blocks[i].DescendantOperations()) 273void AddDescendantOperationsFromDelegateCreationTargets(PooledHashSet<IOperation> targets) 275foreach (var target in targets) 462public override void OnLValueCaptureFound(ISymbol symbol, IOperation operation, CaptureId captureId) 466captures = PooledHashSet<(ISymbol, IOperation)>.GetInstance(); 514public override void SetTargetsFromSymbolForDelegate(IOperation write, ISymbol symbol) 522var targetsBuilder = PooledHashSet<IOperation>.GetInstance(); 544foreach (var target in targetsBuilderForSymbolWrite) 561public override void SetLambdaTargetForDelegate(IOperation write, IFlowAnonymousFunctionOperation lambdaTarget) 571public override void SetLocalFunctionTargetForDelegate(IOperation write, IMethodReferenceOperation localFunctionTarget) 583public override void SetEmptyInvocationTargetsForDelegate(IOperation write) 586private void SetReachingDelegateTargetCore(IOperation write, IOperation targetOpt) 588var targetsBuilder = PooledHashSet<IOperation>.GetInstance(); 597public override bool TryGetDelegateInvocationTargets(IOperation write, out ImmutableHashSet<IOperation> targets)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.OperationTreeAnalysisData.cs (9)
24PooledDictionary<(ISymbol symbol, IOperation operation), bool> symbolsWriteMap, 37protected override PooledDictionary<(ISymbol symbol, IOperation operation), bool> SymbolsWriteBuilder { get; } 66public override void OnLValueCaptureFound(ISymbol symbol, IOperation operation, CaptureId captureId) 72public override void SetLambdaTargetForDelegate(IOperation write, IFlowAnonymousFunctionOperation lambdaTarget) 74public override void SetLocalFunctionTargetForDelegate(IOperation write, IMethodReferenceOperation localFunctionTarget) 76public override void SetEmptyInvocationTargetsForDelegate(IOperation write) 78public override void SetTargetsFromSymbolForDelegate(IOperation write, ISymbol symbol) 80public override bool TryGetDelegateInvocationTargets(IOperation write, out ImmutableHashSet<IOperation> targets)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.Walker.cs (20)
28private IOperation _currentRootOperation; 30private PooledDictionary<IAssignmentOperation, PooledHashSet<(ISymbol, IOperation)>> _pendingWritesMap; 37IEnumerable<IOperation> operations, 52private void Visit(ISymbol containingSymbol, IEnumerable<IOperation> operations, AnalysisData analysisData, CancellationToken cancellationToken) 59_pendingWritesMap = PooledDictionary<IAssignmentOperation, PooledHashSet<(ISymbol, IOperation)>>.GetInstance(); 66foreach (var operation in operations) 94private void OnWriteReferenceFound(ISymbol symbol, IOperation operation, ValueUsageInfo valueUsageInfo) 102private void OnLValueCaptureFound(ISymbol symbol, IOperation operation, CaptureId captureId) 108private void OnReferenceFound(ISymbol symbol, IOperation operation) 160private bool MakePendingWrite(IOperation operation, ISymbol symbolOpt) 167var set = PooledHashSet<(ISymbol, IOperation)>.GetInstance(); 176set = PooledHashSet<(ISymbol, IOperation)>.GetInstance(); 408private void ProcessPossibleDelegateCreationAssignment(ISymbol symbol, IOperation write) 416IOperation initializerValue = null; 432private void ProcessPossibleDelegateCreation(IOperation creation, IOperation write) 434var currentOperation = creation; 498private void AnalyzePossibleDelegateInvocation(IOperation operation) 535foreach (var target in targets) 550void AnalyzeDelegateInvocation(IOperation target)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageResult.cs (3)
15ImmutableDictionary<(ISymbol symbol, IOperation write), bool> symbolWritesMap, 35public ImmutableDictionary<(ISymbol symbol, IOperation write), bool> SymbolWritesMap { get; } = symbolWritesMap; 49public IEnumerable<(ISymbol Symbol, IOperation WriteOperation)> GetUnreadSymbolWrites()
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_Negate.cs (8)
150var operation = semanticModel.GetOperation(expressionNode, cancellationToken); 275var operation = semanticModel.GetOperation(isExpression, cancellationToken); 417var rightOperand = RemoveImplicitConversion(binaryOperation.RightOperand); 418var leftOperand = RemoveImplicitConversion(binaryOperation.LeftOperand); 430private static IOperation RemoveImplicitConversion(IOperation operation) 438IOperation variableExpression, ILiteralOperation numericLiteralExpression) 476var operation = semanticModel.GetOperation(expression);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\InitializeParameter\AbstractInitializerParameterService.cs (3)
57var operation = semanticModel.GetOperation( 171var statement = TryFindFieldOrPropertyAssignmentStatement(sibling, blockStatement); 211var operation = semanticModel.GetOperation(accessorBody, cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\InitializeParameter\InitializeParameterHelpersCore.cs (11)
38public static bool IsParameterReference(IOperation? operation, IParameterSymbol parameter) 43IOperation? value, IParameterSymbol parameter) 76public static IOperation? TryFindFieldOrPropertyAssignmentStatement(IParameterSymbol parameter, IBlockOperation? blockStatement) 79private static IOperation? TryFindFieldOrPropertyAssignmentStatement( 85foreach (var statement in blockStatement.Operations) 99var target = targetTuple.Elements[i]; 100var value = valueTuple.Elements[i]; 117IOperation operation, 146IOperation? operation, INamedTypeSymbol containingType, 163public static bool IsFieldOrPropertyAssignment(IOperation statement, INamedTypeSymbol containingType, [NotNullWhen(true)] out IAssignmentOperation? assignmentExpression) 167IOperation statement, INamedTypeSymbol containingType,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\NullableHelpers.cs (7)
30var declaredOperation = semanticModel.GetRequiredOperation(declarationSyntax, cancellationToken); 32var rootOperation = declaredOperation; 54IOperation rootOperation, 62using var _ = ArrayBuilder<IOperation>.GetInstance(out var stack); 65while (stack.TryPop(out var operation)) 128foreach (var childOperation in operation.ChildOperations.Reverse()) 142bool IsSymbolReferencedByOperation(IOperation operation)
Microsoft.Interop.ComInterfaceGenerator (4)
Analyzers\RuntimeComApiUsageWithSourceGeneratedComAnalyzer.cs (3)
145IOperation operand = operation.Operand; 173IOperation operand = operation.Operand; 203IOperation op => (op.Type, op.Syntax.GetLocation())
src\libraries\System.Runtime.InteropServices\gen\Common\OperationExtensions.cs (1)
45public static bool IsNullLiteralOperation(this IOperation operation)
Microsoft.Interop.LibraryImportGenerator (1)
src\libraries\System.Runtime.InteropServices\gen\Common\OperationExtensions.cs (1)
45public static bool IsNullLiteralOperation(this IOperation operation)
Microsoft.Interop.LibraryImportGenerator.Downlevel (1)
src\libraries\System.Runtime.InteropServices\gen\Common\OperationExtensions.cs (1)
45public static bool IsNullLiteralOperation(this IOperation operation)
Microsoft.VisualStudio.LanguageServices (1)
PullMemberUp\SymbolDependentsBuilder.cs (1)
69public override void Visit(IOperation operation)
System.Private.CoreLib.Generators (3)
IntrinsicsInSystemPrivateCoreLibAnalyzer.cs (3)
190private static ISymbol? GetOperationSymbol(IOperation operation) 451private static void AnalyzeOperation(IOperation operation, IMethodSymbol methodSymbol, OperationAnalysisContext context, IntrinsicsAnalyzerOnLoadData onLoadData) 490IOperation operationSearch = operation;
System.Text.RegularExpressions.Generator (1)
UpgradeToGeneratedRegexCodeFixer.cs (1)
95IOperation? operation = semanticModel.GetOperation(nodeToFix, cancellationToken);