1486 references to OperationKind
Aspire.Hosting.Analyzers (1)
AppHostAnalyzer.cs (1)
43context.RegisterOperationAction(c => DoOperationAnalysis(c, modelNameOperations), OperationKind.Invocation);
ILLink.RoslynAnalyzer (23)
COMAnalyzer.cs (1)
57 }, OperationKind.Invocation);
DataFlow\CapturedReferenceValue.cs (10)
18 case OperationKind.PropertyReference: 19 case OperationKind.EventReference: 20 case OperationKind.LocalReference: 21 case OperationKind.FieldReference: 22 case OperationKind.ParameterReference: 23 case OperationKind.ArrayElementReference: 24 case OperationKind.InlineArrayAccess: 25 case OperationKind.ImplicitIndexerReference: 27 case OperationKind.InstanceReference: 28 case OperationKind.Invocation:
DataFlow\ControlFlowGraphExtensions.cs (1)
32 public static IEnumerable<T> DescendantOperations<T> (this ControlFlowGraph cfg, OperationKind operationKind)
DataFlow\LValueFlowCaptureProvider.cs (1)
63 foreach (var flowCaptureReference in cfg.DescendantOperations<IFlowCaptureReferenceOperation> (OperationKind.FlowCaptureReference)) {
DataFlow\UnexpectedOperationHandler.cs (3)
22 if (operation.Kind is OperationKind.None) 25 if (operation.Kind is OperationKind.Invalid) 38 if (descendant.Kind is OperationKind.Invalid)
IOperationExtensions.cs (6)
186 case OperationKind.AnonymousFunction: 189 case OperationKind.LocalFunction: 208 case OperationKind.DeconstructionAssignment: 212 case OperationKind.Tuple: 213 case OperationKind.Conversion: 214 case OperationKind.Parenthesized:
TrimAnalysis\HandleCallAction.cs (1)
39 _isNewObj = operation.Kind == OperationKind.ObjectCreation;
Microsoft.Analyzers.Extra (24)
AsyncCallInsideUsingBlockAnalyzer.cs (8)
55}, OperationKind.UsingDeclaration); 69}, OperationKind.Using); 89case OperationKind.Await: 93case OperationKind.Invocation: 97case OperationKind.PropertyReference: 101case OperationKind.VariableDeclarator: 105case OperationKind.SimpleAssignment: 112case OperationKind.AnonymousFunction:
CallAnalysis\CallAnalyzer.cs (3)
45compilationStartContext.RegisterOperationAction(handlers.HandleInvocation, OperationKind.Invocation); 46compilationStartContext.RegisterOperationAction(handlers.HandleObjectCreation, OperationKind.ObjectCreation); 47compilationStartContext.RegisterOperationAction(handlers.HandlePropertyReference, OperationKind.PropertyReference);
CallAnalysis\Fixers\LegacyLoggingFixer.cs (1)
368if (invocationOp.Parent?.Kind == OperationKind.ConditionalAccess)
CallAnalysis\Fixers\LegacyLoggingFixer.FixDetails.cs (2)
106var op = invocationOp.Arguments[LogLevelParamIndex].Descendants().SingleOrDefault(x => x.Kind == OperationKind.Literal || x.Kind == OperationKind.FieldReference);
CoalesceAnalyzer.cs (4)
39if (op.Target.Kind == OperationKind.ParameterReference) 55}, OperationKind.CoalesceAssignment); 66if (op.Value.Kind == OperationKind.ParameterReference) 82}, OperationKind.Coalesce);
ConditionalAccessAnalyzer.cs (5)
39case OperationKind.PropertyReference: 52case OperationKind.FieldReference: 64case OperationKind.Invocation: 98if (op.Operation.Kind == OperationKind.ParameterReference) 115}, OperationKind.ConditionalAccess);
UsingToStringInLoggersAnalyzer.cs (1)
33operationBlockContext.RegisterOperationAction(AnalyzeInvocation, OperationKind.Invocation);
Microsoft.Analyzers.Local (4)
CallAnalysis\CallAnalyzer.cs (4)
36compilationStartContext.RegisterOperationAction(handlers.HandleInvocation, OperationKind.Invocation); 37compilationStartContext.RegisterOperationAction(handlers.HandleObjectCreation, OperationKind.ObjectCreation); 38compilationStartContext.RegisterOperationAction(handlers.HandlePropertyReference, OperationKind.PropertyReference); 39compilationStartContext.RegisterOperationAction(handlers.HandleThrow, OperationKind.Throw);
Microsoft.AspNetCore.Analyzers (3)
MiddlewareAnalyzer.cs (1)
40}, OperationKind.Invocation);
OptionsAnalyzer.cs (1)
36}, OperationKind.SimpleAssignment);
ServicesAnalyzer.cs (1)
35}, OperationKind.Invocation);
Microsoft.AspNetCore.App.Analyzers (12)
Authorization\AddAuthorizationBuilderAnalyzer.cs (1)
65}, OperationKind.Invocation);
Http\HeaderDictionaryAddAnalyzer.cs (1)
41}, OperationKind.Invocation);
Http\HeaderDictionaryIndexerAnalyzer.cs (1)
45}, OperationKind.PropertyReference);
Http\RequestDelegateReturnTypeAnalyzer.cs (4)
32parent.Kind == OperationKind.DelegateCreation && 43}, OperationKind.MethodReference); 48parent.Kind == OperationKind.DelegateCreation && 72}, OperationKind.AnonymousFunction);
RenderTreeBuilder\RenderTreeBuilderAnalyzer.cs (1)
55}, OperationKind.Invocation);
RouteHandlers\RouteHandlerAnalyzer.cs (3)
56context.RegisterOperationAction(c => DoOperationAnalysis(c, mapOperations), OperationKind.Invocation); 105if (delegateCreation.Target.Kind == OperationKind.AnonymousFunction) 115else if (delegateCreation.Target.Kind == OperationKind.MethodReference)
WebApplicationBuilder\WebApplicationBuilderAnalyzer.cs (1)
307}, OperationKind.Invocation);
Microsoft.AspNetCore.Components.Analyzers (12)
ComponentParameterUsageAnalyzer.cs (6)
59if (leftHandSide.Kind != OperationKind.PropertyReference) 109}, OperationKind.SimpleAssignment, OperationKind.CompoundAssignment, OperationKind.CoalesceAssignment, OperationKind.Increment, OperationKind.Decrement);
InternalUsageAnalyzer.cs (6)
42OperationKind.ObjectCreation, 43OperationKind.Invocation, 44OperationKind.FieldReference, 45OperationKind.MethodReference, 46OperationKind.PropertyReference, 47OperationKind.EventReference);
Microsoft.AspNetCore.Components.SdkAnalyzers (12)
ComponentParameterUsageAnalyzer.cs (6)
59if (leftHandSide.Kind != OperationKind.PropertyReference) 109}, OperationKind.SimpleAssignment, OperationKind.CompoundAssignment, OperationKind.CoalesceAssignment, OperationKind.Increment, OperationKind.Decrement);
InternalUsageAnalyzer.cs (6)
42OperationKind.ObjectCreation, 43OperationKind.Invocation, 44OperationKind.FieldReference, 45OperationKind.MethodReference, 46OperationKind.PropertyReference, 47OperationKind.EventReference);
Microsoft.AspNetCore.Mvc.Analyzers (6)
AvoidHtmlPartialAnalyzer.cs (1)
43}, OperationKind.Invocation);
TagHelpersInCodeBlocksAnalyzer.cs (5)
48if (awaitOperation.Operation.Kind != OperationKind.Invocation) 90}, OperationKind.Await); 115if (operation.Kind == OperationKind.LocalFunction) 120if (operation.Kind == OperationKind.MethodBody) 125if (operation.Kind == OperationKind.AnonymousFunction)
Microsoft.AspNetCore.Mvc.Api.Analyzers (11)
ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzer.cs (10)
58if (parent.Kind == OperationKind.Block && parent.Parent != null) 63if (parent.Kind != OperationKind.MethodBodyOperation) 70if (trueStatement.Kind != OperationKind.Return) 126}, OperationKind.Conditional); 133case OperationKind.UnaryOperator: 137case OperationKind.BinaryOperator: 164if (operation.Kind != OperationKind.Literal) 182if (operation.Kind != OperationKind.PropertyReference) 198if (propertyReference.Instance?.Kind != OperationKind.PropertyReference) 205if (modelStatePropertyReference.Instance?.Kind != OperationKind.InstanceReference)
ApiConventionAnalyzer.cs (1)
92}, OperationKind.MethodBody);
Microsoft.CodeAnalysis (529)
DiagnosticAnalyzer\AnalyzerDriver.cs (5)
2955case OperationKind.MethodBody: 2956case OperationKind.ConstructorBody: 2961case OperationKind.ExpressionStatement: 2964Debug.Assert(operationBlock.Kind is OperationKind.Invocation or OperationKind.Invalid);
DiagnosticAnalyzer\AnalyzerDriver.GroupedAnalyzerActions.cs (1)
16/// <see cref="AnalyzerActions"/> grouped by <see cref="DiagnosticAnalyzer"/>, and possibly other entities, such as <see cref="OperationKind"/>, <see cref="SymbolKind"/>, etc.
DiagnosticAnalyzer\AnalyzerDriver.GroupedAnalyzerActionsForAnalyzer.cs (3)
20private ImmutableSegmentedDictionary<OperationKind, ImmutableArray<OperationAnalyzerAction>> _lazyOperationActionsByKind; 87public ImmutableSegmentedDictionary<OperationKind, ImmutableArray<OperationAnalyzerAction>> OperationActionsByAnalyzerAndKind 97ImmutableSegmentedDictionary<OperationKind, ImmutableArray<OperationAnalyzerAction>>.Empty;
DiagnosticAnalyzer\AnalyzerExecutor.cs (5)
1025internal static ImmutableSegmentedDictionary<OperationKind, ImmutableArray<OperationAnalyzerAction>> GetOperationActionsByKind(IEnumerable<OperationAnalyzerAction> operationActions) 1029var operationActionsByKind = PooledDictionary<OperationKind, ArrayBuilder<OperationAnalyzerAction>>.GetInstance(); 1032foreach (var kind in operationAction.Kinds) 1058ImmutableSegmentedDictionary<OperationKind, ImmutableArray<OperationAnalyzerAction>> operationActionsByKind, 1083ImmutableSegmentedDictionary<OperationKind, ImmutableArray<OperationAnalyzerAction>> operationActionsByKind,
DiagnosticAnalyzer\DiagnosticAnalysisContext.cs (8)
183public void RegisterOperationAction(Action<OperationAnalysisContext> action, params OperationKind[] operationKinds) 195public virtual void RegisterOperationAction(Action<OperationAnalysisContext> action, ImmutableArray<OperationKind> operationKinds) 478public void RegisterOperationAction(Action<OperationAnalysisContext> action, params OperationKind[] operationKinds) 490public virtual void RegisterOperationAction(Action<OperationAnalysisContext> action, ImmutableArray<OperationKind> operationKinds) 990public void RegisterOperationAction(Action<OperationAnalysisContext> action, params OperationKind[] operationKinds) 1002public abstract void RegisterOperationAction(Action<OperationAnalysisContext> action, ImmutableArray<OperationKind> operationKinds); 1336public void RegisterOperationAction(Action<OperationAnalysisContext> action, params OperationKind[] operationKinds) 1348public abstract void RegisterOperationAction(Action<OperationAnalysisContext> action, ImmutableArray<OperationKind> operationKinds);
DiagnosticAnalyzer\DiagnosticAnalysisContextHelpers.cs (2)
37internal static void VerifyArguments<TContext>(Action<TContext> action, ImmutableArray<OperationKind> operationKinds) 144private static void VerifyOperationKinds(ImmutableArray<OperationKind> operationKinds)
DiagnosticAnalyzer\DiagnosticAnalyzerAction.cs (2)
96public ImmutableArray<OperationKind> Kinds { get; } 98public OperationAnalyzerAction(Action<OperationAnalysisContext> action, ImmutableArray<OperationKind> kinds, DiagnosticAnalyzer analyzer)
DiagnosticAnalyzer\DiagnosticStartAnalysisScope.cs (4)
90public override void RegisterOperationAction(Action<OperationAnalysisContext> action, ImmutableArray<OperationKind> operationKinds) 207public override void RegisterOperationAction(Action<OperationAnalysisContext> action, ImmutableArray<OperationKind> operationKinds) 277public override void RegisterOperationAction(Action<OperationAnalysisContext> action, ImmutableArray<OperationKind> operationKinds) 347public override void RegisterOperationAction(Action<OperationAnalysisContext> action, ImmutableArray<OperationKind> operationKinds)
Generated\FlowAnalysis.Generated.cs (6)
21/// <item><description><see cref="OperationKind.FlowCapture"/></description></item> 45/// <item><description><see cref="OperationKind.FlowCaptureReference"/></description></item> 71/// <item><description><see cref="OperationKind.IsNull"/></description></item> 90/// <item><description><see cref="OperationKind.CaughtException"/></description></item> 107/// <item><description><see cref="OperationKind.StaticLocalInitializationSemaphore"/></description></item> 134/// <item><description><see cref="OperationKind.FlowAnonymousFunction"/></description></item>
Generated\Operations.Generated.cs (376)
31/// <item><description><see cref="OperationKind.Invalid"/></description></item> 52/// <item><description><see cref="OperationKind.Block"/></description></item> 85/// <item><description><see cref="OperationKind.VariableDeclarationGroup"/></description></item> 113/// <item><description><see cref="OperationKind.Switch"/></description></item> 334/// <item><description><see cref="OperationKind.Labeled"/></description></item> 363/// <item><description><see cref="OperationKind.Branch"/></description></item> 391/// <item><description><see cref="OperationKind.Empty"/></description></item> 412/// <item><description><see cref="OperationKind.Return"/></description></item> 413/// <item><description><see cref="OperationKind.YieldBreak"/></description></item> 414/// <item><description><see cref="OperationKind.YieldReturn"/></description></item> 439/// <item><description><see cref="OperationKind.Lock"/></description></item> 468/// <item><description><see cref="OperationKind.Try"/></description></item> 505/// <item><description><see cref="OperationKind.Using"/></description></item> 543/// <item><description><see cref="OperationKind.ExpressionStatement"/></description></item> 567/// <item><description><see cref="OperationKind.LocalFunction"/></description></item> 605/// <item><description><see cref="OperationKind.Stop"/></description></item> 625/// <item><description><see cref="OperationKind.End"/></description></item> 645/// <item><description><see cref="OperationKind.RaiseEvent"/></description></item> 678/// <item><description><see cref="OperationKind.Literal"/></description></item> 699/// <item><description><see cref="OperationKind.Conversion"/></description></item> 766/// <item><description><see cref="OperationKind.Invocation"/></description></item> 812/// <item><description><see cref="OperationKind.ArrayElementReference"/></description></item> 841/// <item><description><see cref="OperationKind.LocalReference"/></description></item> 871/// <item><description><see cref="OperationKind.ParameterReference"/></description></item> 926/// <item><description><see cref="OperationKind.FieldReference"/></description></item> 959/// <item><description><see cref="OperationKind.MethodReference"/></description></item> 988/// <item><description><see cref="OperationKind.PropertyReference"/></description></item> 1021/// <item><description><see cref="OperationKind.EventReference"/></description></item> 1046/// <item><description><see cref="OperationKind.Unary"/></description></item> 1047/// <item><description><see cref="OperationKind.UnaryOperator"/></description></item> 1096/// <item><description><see cref="OperationKind.Binary"/></description></item> 1097/// <item><description><see cref="OperationKind.BinaryOperator"/></description></item> 1160/// <item><description><see cref="OperationKind.Conditional"/></description></item> 1204/// <item><description><see cref="OperationKind.Coalesce"/></description></item> 1240/// <item><description><see cref="OperationKind.AnonymousFunction"/></description></item> 1269/// <item><description><see cref="OperationKind.ObjectCreation"/></description></item> 1306/// <item><description><see cref="OperationKind.TypeParameterObjectCreation"/></description></item> 1331/// <item><description><see cref="OperationKind.ArrayCreation"/></description></item> 1362/// <item><description><see cref="OperationKind.InstanceReference"/></description></item> 1387/// <item><description><see cref="OperationKind.IsType"/></description></item> 1422/// <item><description><see cref="OperationKind.Await"/></description></item> 1472/// <item><description><see cref="OperationKind.SimpleAssignment"/></description></item> 1497/// <item><description><see cref="OperationKind.CompoundAssignment"/></description></item> 1547/// <item><description><see cref="OperationKind.Parenthesized"/></description></item> 1572/// <item><description><see cref="OperationKind.EventAssignment"/></description></item> 1606/// <item><description><see cref="OperationKind.ConditionalAccess"/></description></item> 1637/// <item><description><see cref="OperationKind.ConditionalAccessInstance"/></description></item> 1656/// <item><description><see cref="OperationKind.InterpolatedString"/></description></item> 1681/// <item><description><see cref="OperationKind.AnonymousObjectCreation"/></description></item> 1714/// <item><description><see cref="OperationKind.ObjectOrCollectionInitializer"/></description></item> 1745/// <item><description><see cref="OperationKind.MemberInitializer"/></description></item> 1772/// <item><description><see cref="OperationKind.CollectionElementInitializer"/></description></item> 1797/// <item><description><see cref="OperationKind.NameOf"/></description></item> 1822/// <item><description><see cref="OperationKind.Tuple"/></description></item> 1853/// <item><description><see cref="OperationKind.DynamicObjectCreation"/></description></item> 1882/// <item><description><see cref="OperationKind.DynamicMemberReference"/></description></item> 1934/// <item><description><see cref="OperationKind.DynamicInvocation"/></description></item> 1962/// <item><description><see cref="OperationKind.DynamicIndexerAccess"/></description></item> 1996/// <item><description><see cref="OperationKind.TranslatedQuery"/></description></item> 2021/// <item><description><see cref="OperationKind.DelegateCreation"/></description></item> 2045/// <item><description><see cref="OperationKind.DefaultValue"/></description></item> 2066/// <item><description><see cref="OperationKind.TypeOf"/></description></item> 2090/// <item><description><see cref="OperationKind.SizeOf"/></description></item> 2114/// <item><description><see cref="OperationKind.AddressOf"/></description></item> 2138/// <item><description><see cref="OperationKind.IsPattern"/></description></item> 2155/// Represents an <see cref="OperationKind.Increment" /> or <see cref="OperationKind.Decrement" /> operation. 2168/// <item><description><see cref="OperationKind.Increment"/></description></item> 2169/// <item><description><see cref="OperationKind.Decrement"/></description></item> 2219/// <item><description><see cref="OperationKind.Throw"/></description></item> 2243/// <item><description><see cref="OperationKind.DeconstructionAssignment"/></description></item> 2272/// <item><description><see cref="OperationKind.DeclarationExpression"/></description></item> 2296/// <item><description><see cref="OperationKind.OmittedArgument"/></description></item> 2342/// <item><description><see cref="OperationKind.FieldInitializer"/></description></item> 2367/// <item><description><see cref="OperationKind.VariableInitializer"/></description></item> 2388/// <item><description><see cref="OperationKind.PropertyInitializer"/></description></item> 2413/// <item><description><see cref="OperationKind.ParameterInitializer"/></description></item> 2438/// <item><description><see cref="OperationKind.ArrayInitializer"/></description></item> 2467/// <item><description><see cref="OperationKind.VariableDeclarator"/></description></item> 2512/// <item><description><see cref="OperationKind.VariableDeclaration"/></description></item> 2553/// <item><description><see cref="OperationKind.Argument"/></description></item> 2594/// <item><description><see cref="OperationKind.CatchClause"/></description></item> 2639/// <item><description><see cref="OperationKind.SwitchCase"/></description></item> 2826/// <item><description><see cref="OperationKind.InterpolatedStringText"/></description></item> 2851/// <item><description><see cref="OperationKind.Interpolation"/></description></item> 2907/// <item><description><see cref="OperationKind.ConstantPattern"/></description></item> 2931/// <item><description><see cref="OperationKind.DeclarationPattern"/></description></item> 2965/// <item><description><see cref="OperationKind.TupleBinary"/></description></item> 2966/// <item><description><see cref="OperationKind.TupleBinaryOperator"/></description></item> 3022/// <item><description><see cref="OperationKind.MethodBody"/></description></item> 3023/// <item><description><see cref="OperationKind.MethodBodyOperation"/></description></item> 3043/// <item><description><see cref="OperationKind.ConstructorBody"/></description></item> 3044/// <item><description><see cref="OperationKind.ConstructorBodyOperation"/></description></item> 3072/// <item><description><see cref="OperationKind.Discard"/></description></item> 3101/// <item><description><see cref="OperationKind.CoalesceAssignment"/></description></item> 3121/// <item><description><see cref="OperationKind.Range"/></description></item> 3161/// <item><description><see cref="OperationKind.ReDim"/></description></item> 3189/// <item><description><see cref="OperationKind.ReDimClause"/></description></item> 3211/// <item><description><see cref="OperationKind.RecursivePattern"/></description></item> 3253/// <item><description><see cref="OperationKind.DiscardPattern"/></description></item> 3273/// <item><description><see cref="OperationKind.SwitchExpression"/></description></item> 3299/// <item><description><see cref="OperationKind.SwitchExpressionArm"/></description></item> 3330/// <item><description><see cref="OperationKind.PropertySubpattern"/></description></item> 3471/// <item><description><see cref="OperationKind.UsingDeclaration"/></description></item> 3499/// <item><description><see cref="OperationKind.NegatedPattern"/></description></item> 3523/// <item><description><see cref="OperationKind.BinaryPattern"/></description></item> 3555/// <item><description><see cref="OperationKind.TypePattern"/></description></item> 3579/// <item><description><see cref="OperationKind.RelationalPattern"/></description></item> 3607/// <item><description><see cref="OperationKind.With"/></description></item> 3633/// <item><description><see cref="OperationKind.InterpolatedStringHandlerCreation"/></description></item> 3674/// <item><description><see cref="OperationKind.InterpolatedStringAddition"/></description></item> 3698/// <item><description><see cref="OperationKind.InterpolatedStringAppendLiteral"/></description></item> 3699/// <item><description><see cref="OperationKind.InterpolatedStringAppendFormatted"/></description></item> 3700/// <item><description><see cref="OperationKind.InterpolatedStringAppendInvalid"/></description></item> 3719/// <item><description><see cref="OperationKind.InterpolatedStringHandlerArgumentPlaceholder"/></description></item> 3742/// <item><description><see cref="OperationKind.FunctionPointerInvocation"/></description></item> 3764/// <item><description><see cref="OperationKind.ListPattern"/></description></item> 3796/// <item><description><see cref="OperationKind.SlicePattern"/></description></item> 3824/// <item><description><see cref="OperationKind.ImplicitIndexerReference"/></description></item> 3860/// <item><description><see cref="OperationKind.Utf8String"/></description></item> 3885/// <item><description><see cref="OperationKind.Attribute"/></description></item> 3909/// <item><description><see cref="OperationKind.InlineArrayAccess"/></description></item> 3937/// <item><description><see cref="OperationKind.CollectionExpression"/></description></item> 3975/// <item><description><see cref="OperationKind.Spread"/></description></item> 4052public override OperationKind Kind => OperationKind.Block; 4107public override OperationKind Kind => OperationKind.VariableDeclarationGroup; 4177public override OperationKind Kind => OperationKind.Switch; 4283public override OperationKind Kind => OperationKind.Loop; 4375public override OperationKind Kind => OperationKind.Loop; 4487public override OperationKind Kind => OperationKind.Loop; 4511public override OperationKind Kind => OperationKind.Loop; 4564public override OperationKind Kind => OperationKind.Labeled; 4584public override OperationKind Kind => OperationKind.Branch; 4598public override OperationKind Kind => OperationKind.Empty; 4604internal ReturnOperation(IOperation? returnedValue, OperationKind kind, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 4650public override OperationKind Kind { get; } 4714public override OperationKind Kind => OperationKind.Lock; 4793public override OperationKind Kind => OperationKind.Try; 4861public override OperationKind Kind => OperationKind.Using; 4912public override OperationKind Kind => OperationKind.ExpressionStatement; 4976public override OperationKind Kind => OperationKind.LocalFunction; 4990public override OperationKind Kind => OperationKind.Stop; 5004public override OperationKind Kind => OperationKind.End; 5070public override OperationKind Kind => OperationKind.RaiseEvent; 5088public override OperationKind Kind => OperationKind.Literal; 5148public override OperationKind Kind => OperationKind.Conversion; 5221public override OperationKind Kind => OperationKind.Invocation; 5288public override OperationKind Kind => OperationKind.ArrayElementReference; 5310public override OperationKind Kind => OperationKind.LocalReference; 5329public override OperationKind Kind => OperationKind.ParameterReference; 5394public override OperationKind Kind => OperationKind.FieldReference; 5450public override OperationKind Kind => OperationKind.MethodReference; 5519public override OperationKind Kind => OperationKind.PropertyReference; 5573public override OperationKind Kind => OperationKind.EventReference; 5636public override OperationKind Kind => OperationKind.Unary; 5714public override OperationKind Kind => OperationKind.Binary; 5791public override OperationKind Kind => OperationKind.Conditional; 5858public override OperationKind Kind => OperationKind.Coalesce; 5911public override OperationKind Kind => OperationKind.AnonymousFunction; 5981public override OperationKind Kind => OperationKind.ObjectCreation; 6033public override OperationKind Kind => OperationKind.TypeParameterObjectCreation; 6100public override OperationKind Kind => OperationKind.ArrayCreation; 6119public override OperationKind Kind => OperationKind.InstanceReference; 6175public override OperationKind Kind => OperationKind.IsType; 6227public override OperationKind Kind => OperationKind.Await; 6300public override OperationKind Kind => OperationKind.SimpleAssignment; 6375public override OperationKind Kind => OperationKind.CompoundAssignment; 6428public override OperationKind Kind => OperationKind.Parenthesized; 6493public override OperationKind Kind => OperationKind.EventAssignment; 6556public override OperationKind Kind => OperationKind.ConditionalAccess; 6573public override OperationKind Kind => OperationKind.ConditionalAccessInstance; 6630public override OperationKind Kind => OperationKind.InterpolatedString; 6686public override OperationKind Kind => OperationKind.AnonymousObjectCreation; 6742public override OperationKind Kind => OperationKind.ObjectOrCollectionInitializer; 6805public override OperationKind Kind => OperationKind.MemberInitializer; 6858public override OperationKind Kind => OperationKind.NameOf; 6916public override OperationKind Kind => OperationKind.Tuple; 6974public override OperationKind Kind => OperationKind.DynamicMemberReference; 7026public override OperationKind Kind => OperationKind.TranslatedQuery; 7078public override OperationKind Kind => OperationKind.DelegateCreation; 7096public override OperationKind Kind => OperationKind.DefaultValue; 7115public override OperationKind Kind => OperationKind.TypeOf; 7135public override OperationKind Kind => OperationKind.SizeOf; 7187public override OperationKind Kind => OperationKind.AddressOf; 7250public override OperationKind Kind => OperationKind.IsPattern; 7256internal IncrementOrDecrementOperation(bool isPostfix, bool isLifted, bool isChecked, IOperation target, IMethodSymbol? operatorMethod, ITypeSymbol? constrainedToType, OperationKind kind, SemanticModel? semanticModel, SyntaxNode syntax, ITypeSymbol? type, bool isImplicit) 7313public override OperationKind Kind { get; } 7365public override OperationKind Kind => OperationKind.Throw; 7424public override OperationKind Kind => OperationKind.DeconstructionAssignment; 7476public override OperationKind Kind => OperationKind.DeclarationExpression; 7493public override OperationKind Kind => OperationKind.OmittedArgument; 7555public override OperationKind Kind => OperationKind.FieldInitializer; 7602public override OperationKind Kind => OperationKind.VariableInitializer; 7653public override OperationKind Kind => OperationKind.PropertyInitializer; 7704public override OperationKind Kind => OperationKind.ParameterInitializer; 7759public override OperationKind Kind => OperationKind.ArrayInitializer; 7827public override OperationKind Kind => OperationKind.VariableDeclarator; 7908public override OperationKind Kind => OperationKind.VariableDeclaration; 7969public override OperationKind Kind => OperationKind.Argument; 8046public override OperationKind Kind => OperationKind.CatchClause; 8120public override OperationKind Kind => OperationKind.SwitchCase; 8144public override OperationKind Kind => OperationKind.CaseClause; 8207public override OperationKind Kind => OperationKind.CaseClause; 8269public override OperationKind Kind => OperationKind.CaseClause; 8322public override OperationKind Kind => OperationKind.CaseClause; 8373public override OperationKind Kind => OperationKind.CaseClause; 8429public override OperationKind Kind => OperationKind.InterpolatedStringText; 8502public override OperationKind Kind => OperationKind.Interpolation; 8564public override OperationKind Kind => OperationKind.ConstantPattern; 8586public override OperationKind Kind => OperationKind.DeclarationPattern; 8651public override OperationKind Kind => OperationKind.TupleBinary; 8718public override OperationKind Kind => OperationKind.MethodBody; 8789public override OperationKind Kind => OperationKind.ConstructorBody; 8808public override OperationKind Kind => OperationKind.Discard; 8861public override OperationKind Kind => OperationKind.FlowCapture; 8883public override OperationKind Kind => OperationKind.FlowCaptureReference; 8936public override OperationKind Kind => OperationKind.IsNull; 8953public override OperationKind Kind => OperationKind.CaughtException; 8972public override OperationKind Kind => OperationKind.StaticLocalInitializationSemaphore; 9031public override OperationKind Kind => OperationKind.CoalesceAssignment; 9098public override OperationKind Kind => OperationKind.Range; 9155public override OperationKind Kind => OperationKind.ReDim; 9221public override OperationKind Kind => OperationKind.ReDimClause; 9297public override OperationKind Kind => OperationKind.RecursivePattern; 9311public override OperationKind Kind => OperationKind.DiscardPattern; 9380public override OperationKind Kind => OperationKind.SwitchExpression; 9455public override OperationKind Kind => OperationKind.SwitchExpressionArm; 9517public override OperationKind Kind => OperationKind.PropertySubpattern; 9580public override OperationKind Kind => OperationKind.None; 9644public override OperationKind Kind => OperationKind.None; 9696public override OperationKind Kind => OperationKind.None; 9715public override OperationKind Kind => OperationKind.None; 9777public override OperationKind Kind => OperationKind.None; 9832public override OperationKind Kind => OperationKind.UsingDeclaration; 9883public override OperationKind Kind => OperationKind.NegatedPattern; 9947public override OperationKind Kind => OperationKind.BinaryPattern; 9965public override OperationKind Kind => OperationKind.TypePattern; 10018public override OperationKind Kind => OperationKind.RelationalPattern; 10083public override OperationKind Kind => OperationKind.With; 10150public override OperationKind Kind => OperationKind.InterpolatedStringHandlerCreation; 10212public override OperationKind Kind => OperationKind.InterpolatedStringAddition; 10218internal InterpolatedStringAppendOperation(IOperation appendCall, OperationKind kind, SemanticModel? semanticModel, SyntaxNode syntax, bool isImplicit) 10264public override OperationKind Kind { get; } 10284public override OperationKind Kind => OperationKind.InterpolatedStringHandlerArgumentPlaceholder; 10351public override OperationKind Kind => OperationKind.FunctionPointerInvocation; 10412public override OperationKind Kind => OperationKind.ListPattern; 10465public override OperationKind Kind => OperationKind.SlicePattern; 10532public override OperationKind Kind => OperationKind.ImplicitIndexerReference; 10551public override OperationKind Kind => OperationKind.Utf8String; 10602public override OperationKind Kind => OperationKind.Attribute; 10665public override OperationKind Kind => OperationKind.InlineArrayAccess; 10723public override OperationKind Kind => OperationKind.CollectionExpression; 10779public override OperationKind Kind => OperationKind.Spread;
Operations\ControlFlowGraph.cs (2)
40Debug.Assert(parent != null == (originalOperation.Kind == OperationKind.LocalFunction || originalOperation.Kind == OperationKind.AnonymousFunction));
Operations\ControlFlowGraphBuilder.cs (98)
96Debug.Assert(body.Kind == OperationKind.Block || 97body.Kind == OperationKind.MethodBody || 98body.Kind == OperationKind.ConstructorBody || 99body.Kind == OperationKind.FieldInitializer || 100body.Kind == OperationKind.PropertyInitializer || 101body.Kind == OperationKind.ParameterInitializer || 102body.Kind == OperationKind.Attribute, 108Debug.Assert(body.Kind == OperationKind.LocalFunction || body.Kind == OperationKind.AnonymousFunction); 126case OperationKind.LocalFunction: 130case OperationKind.AnonymousFunction: 861value.Kind != OperationKind.LocalReference || 1280|| slot.operationOpt.Kind == OperationKind.FlowCaptureReference 1281|| slot.operationOpt.Kind == OperationKind.DeclarationExpression 1282|| slot.operationOpt.Kind == OperationKind.Discard 1283|| slot.operationOpt.Kind == OperationKind.OmittedArgument)); 1619if (operation.WhenTrue is IConversionOperation whenTrueConversion && whenTrueConversion.Operand.Kind == OperationKind.Throw) 1622Debug.Assert(rewrittenThrow!.Kind == OperationKind.None); 1631else if (operation.WhenFalse is IConversionOperation whenFalseConversion && whenFalseConversion.Operand.Kind == OperationKind.Throw) 1640Debug.Assert(rewrittenThrow.Kind == OperationKind.None); 1687if (result.Kind != OperationKind.FlowCaptureReference || 1849if (operationOpt.Kind != OperationKind.FlowCaptureReference 1850&& operationOpt.Kind != OperationKind.DeclarationExpression 1851&& operationOpt.Kind != OperationKind.Discard 1852&& operationOpt.Kind != OperationKind.OmittedArgument) 2725if (condition.Kind == OperationKind.Binary) 2789case OperationKind.Binary: 2854case OperationKind.Unary: 2865case OperationKind.Conditional: 2890case OperationKind.Coalesce: 2922case OperationKind.Conversion: 2925if (conversion.Operand.Kind == OperationKind.Throw) 2929Debug.Assert(rewrittenThrow.Kind == OperationKind.None); 2952while (condition.Kind == OperationKind.Parenthesized) 3045bool alternativeThrows = conversion?.Operand.Kind == OperationKind.Throw; 3071Debug.Assert(rewrittenThrow.Kind == OperationKind.None); 3104bool isStatement = _currentStatement == operation || operation.Parent.Kind == OperationKind.ExpressionStatement; 3367bool isOnStatementLevel = _currentStatement == operation || (_currentStatement == operation.Parent && _currentStatement?.Kind == OperationKind.ExpressionStatement); 3562Debug.Assert(operation.Operation.Kind == OperationKind.ConditionalAccess || operation.Operation.Kind == OperationKind.CoalesceAssignment); 3565else if (operation.Operation.Kind == OperationKind.Throw) 3791if (exceptionDeclarationOrExpression.Kind == OperationKind.VariableDeclarator) 3834case OperationKind.YieldReturn: 3835AddStatement(new ReturnOperation(returnedValue, OperationKind.YieldReturn, semanticModel: null, operation.Syntax, IsImplicit(operation))); 3838case OperationKind.YieldBreak: 3839case OperationKind.Return: 3985Debug.Assert(resources.Kind != OperationKind.VariableDeclaration); 3986Debug.Assert(resources.Kind != OperationKind.VariableDeclarator); 4464if (!operation.Locals.IsEmpty && operation.LoopControlVariable.Kind == OperationKind.VariableDeclarator) 4658case OperationKind.VariableDeclarator: 4678case OperationKind.Tuple: 4679case OperationKind.DeclarationExpression: 5355Debug.Assert(controlVariableReferenceForAssignment.Kind == OperationKind.FlowCaptureReference); 5427case OperationKind.VariableDeclarator: 5739if (initialization.Length == 1 && initialization[0].Kind == OperationKind.VariableDeclarationGroup) 6049case OperationKind.MemberInitializer: 6053case OperationKind.SimpleAssignment: 6063var validKinds = ImmutableArray.Create(OperationKind.Invocation, OperationKind.DynamicInvocation, OperationKind.Increment, OperationKind.Literal, 6064OperationKind.LocalReference, OperationKind.Binary, OperationKind.FieldReference, OperationKind.Invalid, 6065OperationKind.InterpolatedString); 6162case OperationKind.FieldReference: 6163case OperationKind.EventReference: 6164case OperationKind.PropertyReference: 6167if (memberReference.Kind == OperationKind.PropertyReference) 6186case OperationKind.ArrayElementReference: 6193case OperationKind.ImplicitIndexerReference: 6200case OperationKind.DynamicIndexerAccess: 6207case OperationKind.DynamicMemberReference: 6220Debug.Assert(instance.Kind == OperationKind.Invalid || instance.Kind == OperationKind.None); 6230case OperationKind.FieldReference: 6235case OperationKind.EventReference: 6240case OperationKind.PropertyReference: 6246case OperationKind.ArrayElementReference: 6252case OperationKind.ImplicitIndexerReference: 6259case OperationKind.DynamicIndexerAccess: 6265case OperationKind.DynamicMemberReference: 6395Debug.Assert(propertyReference.Instance.Kind == OperationKind.InstanceReference); 6506if (elementValue.Kind == OperationKind.ArrayInitializer) 6525if (elementValue.Kind == OperationKind.ArrayInitializer) 6612if (operation.Operation.Kind == OperationKind.DynamicMemberReference) 6628if (operation.Operation.Kind == OperationKind.DynamicMemberReference) 6673if (value.Kind == OperationKind.Tuple) 6693if (value.Kind == OperationKind.Tuple) 7033if (element.Kind == OperationKind.Interpolation) 7331case OperationKind.EventReference: 7334case OperationKind.Parenthesized: 7448if (children.Count != 0 && children.Last().Kind == OperationKind.ObjectOrCollectionInitializer) 7823if (statement.Kind == OperationKind.LocalFunction) 7987if (simpleAssignment.Target.Kind != OperationKind.PropertyReference) 7999Debug.Assert(propertyReference.Instance.Kind == OperationKind.InstanceReference); 8080if (simpleAssignment.Target.Kind != OperationKind.PropertyReference)
Operations\IOperation.cs (1)
30OperationKind Kind { get; }
Operations\Operation.cs (1)
65public abstract OperationKind Kind { get; }
Operations\OperationMapBuilder.cs (1)
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 (14)
66public override OperationKind Kind => OperationKind.None; 137public override OperationKind Kind => OperationKind.Invalid; 168public override OperationKind Kind => OperationKind.FlowAnonymousFunction; 260public override OperationKind Kind => OperationKind.DynamicObjectCreation; 402public override OperationKind Kind => OperationKind.DynamicInvocation; 424public override OperationKind Kind => OperationKind.DynamicIndexerAccess; 699Debug.Assert(statements.All(s => s.Parent != this && s.Parent!.Kind is OperationKind.Block or OperationKind.SwitchCase));
Microsoft.CodeAnalysis.CodeStyle (93)
src\Analyzers\Core\Analyzers\ConvertTypeofToNameof\AbstractConvertTypeOfToNameOfDiagnosticAnalyzer.cs (1)
28context.RegisterOperationAction(AnalyzeAction, OperationKind.TypeOf);
src\Analyzers\Core\Analyzers\MakeFieldReadonly\AbstractMakeFieldReadonlyDiagnosticAnalyzer.cs (2)
69context.RegisterOperationAction(AnalyzeOperation, OperationKind.FieldReference); 281if (fieldReference.Instance?.Kind != OperationKind.InstanceReference ||
src\Analyzers\Core\Analyzers\PopulateSwitch\AbstractPopulateSwitchDiagnosticAnalyzer.cs (1)
31protected abstract OperationKind OperationKind { get; }
src\Analyzers\Core\Analyzers\PopulateSwitch\AbstractPopulateSwitchExpressionDiagnosticAnalyzer.cs (2)
21protected sealed override OperationKind OperationKind => OperationKind.SwitchExpression;
src\Analyzers\Core\Analyzers\PopulateSwitch\AbstractPopulateSwitchStatementDiagnosticAnalyzer.cs (2)
21protected sealed override OperationKind OperationKind => OperationKind.Switch;
src\Analyzers\Core\Analyzers\QualifyMemberAccess\AbstractQualifyMemberAccessDiagnosticAnalyzer.cs (6)
50=> context.RegisterOperationAction(AnalyzeOperation, OperationKind.FieldReference, OperationKind.PropertyReference, OperationKind.MethodReference, OperationKind.Invocation); 84if (instanceOperation.Kind != OperationKind.InstanceReference) 88if (context.Operation.Parent?.Kind == OperationKind.PropertySubpattern)
src\Analyzers\Core\Analyzers\RemoveRedundantEquality\AbstractRemoveRedundantEqualityDiagnosticAnalyzer.cs (3)
25context.RegisterOperationAction(AnalyzeBinaryOperator, OperationKind.BinaryOperator); 26context.RegisterOperationAction(AnalyzeIsPatternOperator, OperationKind.IsPattern); 126Kind: OperationKind.Literal,
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (14)
202symbolStartContext.RegisterOperationAction(AnalyzeMemberReferenceOperation, OperationKind.FieldReference, OperationKind.MethodReference, OperationKind.PropertyReference, OperationKind.EventReference); 203symbolStartContext.RegisterOperationAction(AnalyzeFieldInitializer, OperationKind.FieldInitializer); 204symbolStartContext.RegisterOperationAction(AnalyzeInvocationOperation, OperationKind.Invocation); 205symbolStartContext.RegisterOperationAction(AnalyzeNameOfOperation, OperationKind.NameOf); 206symbolStartContext.RegisterOperationAction(AnalyzeObjectCreationOperation, OperationKind.ObjectCreation); 214symbolStartContext.RegisterOperationAction(_ => hasUnsupportedOperation = true, OperationKind.Invalid, OperationKind.None, 215OperationKind.DynamicIndexerAccess, OperationKind.DynamicInvocation, OperationKind.DynamicMemberReference, OperationKind.DynamicObjectCreation);
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.BlockAnalyzer.cs (24)
73context.RegisterOperationAction(blockAnalyzer.AnalyzeExpressionStatement, OperationKind.ExpressionStatement); 74context.RegisterOperationAction(blockAnalyzer.AnalyzeDelegateCreationOrAnonymousFunction, OperationKind.DelegateCreation, OperationKind.AnonymousFunction); 75context.RegisterOperationAction(blockAnalyzer.AnalyzeLocalOrParameterReference, OperationKind.LocalReference, OperationKind.ParameterReference); 76context.RegisterOperationAction(_ => blockAnalyzer._hasInvalidOperation = true, OperationKind.Invalid); 259Debug.Assert(operation.Kind is OperationKind.DelegateCreation or OperationKind.AnonymousFunction); 275(assignment.Target.Kind == OperationKind.LocalReference || 276assignment.Target.Kind == OperationKind.ParameterReference)) 284if (operation.Kind == OperationKind.AnonymousFunction && 308Debug.Assert(operation.Kind is OperationKind.LocalReference or OperationKind.ParameterReference); 342(assignmentOperation.Target.Kind == OperationKind.LocalReference || 343assignmentOperation.Target.Kind == OperationKind.ParameterReference)) 370case OperationKind.Attribute: 371case OperationKind.ParameterInitializer: 390if (operation.Kind == OperationKind.None) 667case OperationKind.ParameterReference: 668case OperationKind.LocalReference: 672case OperationKind.FieldReference: 676return fieldReference.Instance == null || fieldReference.Instance.Kind == OperationKind.InstanceReference; 678case OperationKind.DefaultValue: 682case OperationKind.Conversion:
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.cs (1)
99context.RegisterOperationAction(OnMethodReference, OperationKind.MethodReference);
src\Analyzers\Core\Analyzers\SimplifyInterpolation\AbstractSimplifyInterpolationDiagnosticAnalyzer.cs (1)
40=> context.RegisterOperationAction(AnalyzeInterpolation, OperationKind.Interpolation);
src\Analyzers\Core\Analyzers\SimplifyInterpolation\AbstractSimplifyInterpolationHelpers.cs (1)
212: alignmentOp is { Kind: OperationKind.Literal })
src\Analyzers\Core\Analyzers\SimplifyLinqExpression\AbstractSimplifyLinqExpressionDiagnosticAnalyzer.cs (1)
68OperationKind.Invocation);
src\Analyzers\Core\Analyzers\UseConditionalExpression\AbstractUseConditionalExpressionDiagnosticAnalyzer.cs (1)
39=> context.RegisterOperationAction(AnalyzeOperation, OperationKind.Conditional);
src\Analyzers\Core\Analyzers\UseConditionalExpression\ForReturn\UseConditionalExpressionForReturnHelpers.cs (2)
96if (trueReturn?.Kind == OperationKind.YieldBreak) 103if (trueReturn?.Kind == OperationKind.YieldReturn &&
src\Analyzers\Core\Analyzers\UseExplicitTupleName\UseExplicitTupleNameDiagnosticAnalyzer.cs (1)
31=> context.RegisterOperationAction(AnalyzeOperation, OperationKind.FieldReference);
src\Analyzers\Core\Analyzers\UseThrowExpression\AbstractUseThrowExpressionDiagnosticAnalyzer.cs (1)
66startContext.RegisterOperationAction(operationContext => AnalyzeOperation(operationContext, expressionType), OperationKind.Throw);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ControlFlowGraphExtensions.cs (1)
30public static IEnumerable<T> DescendantOperations<T>(this ControlFlowGraph cfg, OperationKind operationKind)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (9)
21assignmentOperation.Parent?.Kind == OperationKind.ObjectOrCollectionInitializer; 243case OperationKind.AnonymousFunction: 246case OperationKind.LocalFunction: 267case OperationKind.DeconstructionAssignment: 271case OperationKind.Tuple: 272case OperationKind.Conversion: 273case OperationKind.Parenthesized: 371public static bool HasAnyOperationDescendant(this ImmutableArray<IOperation> operationBlocks, OperationKind kind) 375=> operation.Kind == OperationKind.Literal && operation.Type.IsNumericType();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SemanticEquivalence.cs (1)
129=> operation is IMemberReferenceOperation { Instance.Kind: OperationKind.InstanceReference };
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\LValueFlowCaptureProvider.cs (1)
54foreach (var flowCaptureReference in cfg.DescendantOperations<IFlowCaptureReferenceOperation>(OperationKind.FlowCaptureReference))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.FlowGraphAnalysisData.cs (2)
192if (operation.Kind is OperationKind.LocalFunction or OperationKind.AnonymousFunction)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.Walker.cs (15)
154operation.Parent.Parent?.Kind != OperationKind.ExpressionStatement) 162Debug.Assert(symbolOpt != null || operation.Kind == OperationKind.FlowCaptureReference); 192operation.Parent?.Kind != OperationKind.ExpressionStatement; 196if (write.Kind != OperationKind.FlowCaptureReference) 439case OperationKind.Conversion: 443case OperationKind.Parenthesized: 447case OperationKind.DelegateCreation: 451case OperationKind.AnonymousFunction: 457case OperationKind.FlowAnonymousFunction: 461case OperationKind.MethodReference: 474case OperationKind.LocalReference: 479case OperationKind.ParameterReference: 484case OperationKind.Literal: 554case OperationKind.FlowAnonymousFunction: 558case OperationKind.MethodReference:
Microsoft.CodeAnalysis.CodeStyle.Fixes (3)
src\Analyzers\Core\CodeFixes\UseConditionalExpression\ForReturn\AbstractUseConditionalExpressionForReturnCodeFixProvider.cs (1)
77var returnStatement = anyReturn.Kind == OperationKind.YieldReturn
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_Negate.cs (2)
479if (operation?.Kind == OperationKind.Literal && operation.ConstantValue.HasValue && operation.ConstantValue.Value is true) 483else if (operation?.Kind == OperationKind.Literal && operation.ConstantValue.HasValue && operation.ConstantValue.Value is false)
Microsoft.CodeAnalysis.CSharp (9)
Operations\CSharpOperationFactory.cs (9)
1387OperationKind operationKind = Helper.IsDecrement(boundIncrementOperator.OperatorKind) ? OperationKind.Decrement : OperationKind.Increment; 1783return new ReturnOperation(returnedValue, OperationKind.YieldBreak, _semanticModel, syntax, isImplicit); 2061return new ReturnOperation(returnedValue, OperationKind.Return, _semanticModel, syntax, isImplicit); 2069return new ReturnOperation(returnedValue, OperationKind.YieldReturn, _semanticModel, syntax, isImplicit); 2458"" => OperationKind.InterpolatedStringAppendInvalid, 2459BoundInterpolatedString.AppendLiteralMethod => OperationKind.InterpolatedStringAppendLiteral, 2460BoundInterpolatedString.AppendFormattedMethod => OperationKind.InterpolatedStringAppendFormatted,
Microsoft.CodeAnalysis.CSharp.CodeStyle (15)
src\Analyzers\CSharp\Analyzers\MakeStructFieldsWritable\CSharpMakeStructFieldsWritableDiagnosticAnalyzer.cs (1)
94context.RegisterOperationAction(AnalyzeAssignment, OperationKind.SimpleAssignment);
src\Analyzers\CSharp\Analyzers\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyAnalyzer.cs (1)
287if (operation.Kind == OperationKind.None)
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseIndexOperatorDiagnosticAnalyzer.cs (3)
77OperationKind.PropertyReference); 82OperationKind.Invocation); 93OperationKind.ArrayElementReference);
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseRangeOperatorDiagnosticAnalyzer.cs (1)
72OperationKind.Invocation);
src\Analyzers\CSharp\Analyzers\UseIsNullCheck\CSharpUseNullCheckOverTypeCheckDiagnosticAnalyzer.cs (2)
40context.RegisterOperationAction(c => AnalyzeIsTypeOperation(c, expressionType), OperationKind.IsType); 41context.RegisterOperationAction(c => AnalyzeNegatedPatternOperation(c), OperationKind.NegatedPattern);
src\Analyzers\CSharp\Analyzers\UsePrimaryConstructor\CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs (2)
240OperationKind.FieldReference, OperationKind.PropertyReference);
src\Analyzers\CSharp\Analyzers\UseSystemThreadingLock\CSharpUseSystemThreadingLockDiagnosticAnalyzer.cs (2)
165}, OperationKind.FieldInitializer); 217}, OperationKind.FieldReference);
src\Analyzers\CSharp\Analyzers\UseUtf8StringLiteral\UseUtf8StringLiteralDiagnosticAnalyzer.cs (1)
57context.RegisterOperationAction(c => AnalyzeOperation(c, expressionType), OperationKind.ArrayCreation);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (2)
90Kind: OperationKind.MethodReference, 91Parent.Kind: OperationKind.DelegateCreation,
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (2)
CodeGen\CodeGenLocalFunctionTests.cs (2)
161Assert.Equal(OperationKind.ExpressionStatement, objectCreationOperation.Parent.Kind); 162Assert.Equal(OperationKind.Block, objectCreationOperation.Parent.Parent.Kind);
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (112)
Diagnostics\DiagnosticAnalyzerTests.cs (12)
2245var operationKinds = ImmutableArray.Create(OperationKind.VariableDeclarator); 2281private readonly ImmutableArray<OperationKind> _operationKinds; 2299public GeneratedCodeSyntaxAndOperationAnalyzer(GeneratedCodeAnalysisFlags? generatedCodeAnalysisFlagsOpt, ImmutableArray<SyntaxKind> syntaxKinds, ImmutableArray<OperationKind> operationKinds) 3033TestSymbolStartAnalyzerCore(new SymbolStartAnalyzer(topLevelAction: false, SymbolKind.Namespace, OperationKind.VariableDeclarationGroup), 3045TestSymbolStartAnalyzerCore(new SymbolStartAnalyzer(topLevelAction: false, SymbolKind.NamedType, OperationKind.VariableDeclarationGroup), 3062TestSymbolStartAnalyzerCore(new SymbolStartAnalyzer(topLevelAction: true, SymbolKind.Method, OperationKind.VariableDeclarationGroup), 3089analyzers[i] = new SymbolStartAnalyzer(topLevelAction: false, symbolKinds[i], OperationKind.VariableDeclarationGroup, analyzerId: i + 1); 3149analyzers[i] = new SymbolStartAnalyzer(topLevelAction: false, symbolKinds[i], OperationKind.VariableDeclarationGroup, analyzerId: i + 1); 3191var analyzers = new DiagnosticAnalyzer[] { new SymbolStartAnalyzer(topLevelAction: false, SymbolKind.NamedType, OperationKind.Invocation) }; 3223var analyzers = new DiagnosticAnalyzer[] { new SymbolStartAnalyzer(topLevelAction: true, SymbolKind.NamedType, OperationKind.FieldReference) }; 3864OperationKind.Invocation); 3870OperationKind.Binary);
Diagnostics\GetDiagnosticsTests.cs (4)
715var analyzers = ImmutableArray.Create<DiagnosticAnalyzer>(new SymbolStartAnalyzer(topLevelAction: false, SymbolKind.NamedType, OperationKind.VariableDeclaration)); 984OperationKind.Literal); 1645AssertEx.All(analyzer.AnalyzedOperations, operation => operation.Kind == OperationKind.VariableDeclaration); 1649AssertEx.All(analyzer.AnalyzedOperationsInsideOperationBlock, operation => operation.Kind == OperationKind.VariableDeclaration);
Semantics\CollectionExpressionTests.cs (1)
27157OperationKind IOperation.Kind => throw null;
Semantics\OutVarTests.cs (3)
35951Assert.Equal(OperationKind.ExpressionStatement, initializerOperation.Parent.Kind); 35974Assert.Equal(OperationKind.ConstructorBody, blockBodyOperation.Parent.Kind); 36095Assert.Equal(OperationKind.MethodBody, expressionBodyOperation.Parent.Kind);
Semantics\PrimaryConstructorTests.cs (50)
4314context.RegisterOperationAction(Handle1, OperationKind.ConstructorBody); 4315context.RegisterOperationAction(Handle2, OperationKind.Invocation); 4316context.RegisterOperationAction(Handle3, OperationKind.Literal); 4317context.RegisterOperationAction(Handle4, OperationKind.ParameterInitializer); 4318context.RegisterOperationAction(Handle5, OperationKind.PropertyInitializer); 4319context.RegisterOperationAction(Handle5, OperationKind.FieldInitializer); 4515Assert.Equal(OperationKind.ParameterInitializer, context.OperationBlocks[0].Kind); 4518Assert.Equal(OperationKind.Attribute, context.OperationBlocks[1].Kind); 4526Assert.Equal(OperationKind.ParameterInitializer, context.OperationBlocks[0].Kind); 4529Assert.Equal(OperationKind.Attribute, context.OperationBlocks[1].Kind); 4532Assert.Equal(OperationKind.Invocation, context.OperationBlocks[2].Kind); 4540Assert.Equal(OperationKind.ParameterInitializer, context.OperationBlocks[0].Kind); 4543Assert.Equal(OperationKind.Attribute, context.OperationBlocks[1].Kind); 4546Assert.Equal(OperationKind.Block, context.OperationBlocks[2].Kind); 4548Assert.Equal(OperationKind.Invocation, context.OperationBlocks[3].Kind); 4555Assert.Equal(OperationKind.Block, context.OperationBlocks[0].Kind); 4649Assert.Equal(OperationKind.ParameterInitializer, context.OperationBlocks[0].Kind); 4652Assert.Equal(OperationKind.Attribute, context.OperationBlocks[1].Kind); 4662Assert.Equal(OperationKind.ParameterInitializer, context.OperationBlocks[0].Kind); 4665Assert.Equal(OperationKind.Attribute, context.OperationBlocks[1].Kind); 4668Assert.Equal(OperationKind.Invocation, context.OperationBlocks[2].Kind); 4678Assert.Equal(OperationKind.ParameterInitializer, context.OperationBlocks[0].Kind); 4681Assert.Equal(OperationKind.Attribute, context.OperationBlocks[1].Kind); 4684Assert.Equal(OperationKind.Block, context.OperationBlocks[2].Kind); 4686Assert.Equal(OperationKind.Invocation, context.OperationBlocks[3].Kind); 4695Assert.Equal(OperationKind.Block, context.OperationBlocks[0].Kind); 4707context.RegisterOperationAction(Handle1, OperationKind.ConstructorBody); 4708context.RegisterOperationAction(Handle2, OperationKind.Invocation); 4709context.RegisterOperationAction(Handle3, OperationKind.Literal); 4710context.RegisterOperationAction(Handle4, OperationKind.ParameterInitializer); 4711context.RegisterOperationAction(Handle5, OperationKind.PropertyInitializer); 4712context.RegisterOperationAction(Handle5, OperationKind.FieldInitializer); 4723Assert.Equal(OperationKind.ParameterInitializer, context.OperationBlocks[0].Kind); 4726Assert.Equal(OperationKind.Attribute, context.OperationBlocks[1].Kind); 4734Assert.Equal(OperationKind.ParameterInitializer, context.OperationBlocks[0].Kind); 4737Assert.Equal(OperationKind.Attribute, context.OperationBlocks[1].Kind); 4740Assert.Equal(OperationKind.Invocation, context.OperationBlocks[2].Kind); 4748Assert.Equal(OperationKind.ParameterInitializer, context.OperationBlocks[0].Kind); 4751Assert.Equal(OperationKind.Attribute, context.OperationBlocks[1].Kind); 4754Assert.Equal(OperationKind.Block, context.OperationBlocks[2].Kind); 4756Assert.Equal(OperationKind.Invocation, context.OperationBlocks[3].Kind); 4763Assert.Equal(OperationKind.Block, context.OperationBlocks[0].Kind); 5682context.RegisterOperationAction(HandleConstructorBody, OperationKind.ConstructorBody); 5683context.RegisterOperationAction(HandleInvocation, OperationKind.Invocation); 5684context.RegisterOperationAction(HandleLiteral, OperationKind.Literal); 5685context.RegisterOperationAction(HandleParameterInitializer, OperationKind.ParameterInitializer); 5686context.RegisterOperationAction(Fail, OperationKind.PropertyInitializer); 5687context.RegisterOperationAction(Fail, OperationKind.FieldInitializer); 5790Assert.Equal(OperationKind.ParameterInitializer, context.OperationBlocks[0].Kind); 5793Assert.Equal(OperationKind.Attribute, context.OperationBlocks[1].Kind);
Semantics\RecordTests.cs (42)
26777context.RegisterOperationAction(Handle1, OperationKind.ConstructorBody); 26778context.RegisterOperationAction(Handle2, OperationKind.Invocation); 26779context.RegisterOperationAction(Handle3, OperationKind.Literal); 26780context.RegisterOperationAction(Handle4, OperationKind.ParameterInitializer); 26781context.RegisterOperationAction(Handle5, OperationKind.PropertyInitializer); 26782context.RegisterOperationAction(Handle5, OperationKind.FieldInitializer); 26978Assert.Equal(OperationKind.ParameterInitializer, context.OperationBlocks[0].Kind); 26981Assert.Equal(OperationKind.Attribute, context.OperationBlocks[1].Kind); 26989Assert.Equal(OperationKind.ParameterInitializer, context.OperationBlocks[0].Kind); 26992Assert.Equal(OperationKind.Attribute, context.OperationBlocks[1].Kind); 26995Assert.Equal(OperationKind.Invocation, context.OperationBlocks[2].Kind); 27003Assert.Equal(OperationKind.ParameterInitializer, context.OperationBlocks[0].Kind); 27006Assert.Equal(OperationKind.Attribute, context.OperationBlocks[1].Kind); 27009Assert.Equal(OperationKind.Block, context.OperationBlocks[2].Kind); 27011Assert.Equal(OperationKind.Invocation, context.OperationBlocks[3].Kind); 27018Assert.Equal(OperationKind.Block, context.OperationBlocks[0].Kind); 27112Assert.Equal(OperationKind.ParameterInitializer, context.OperationBlocks[0].Kind); 27115Assert.Equal(OperationKind.Attribute, context.OperationBlocks[1].Kind); 27125Assert.Equal(OperationKind.ParameterInitializer, context.OperationBlocks[0].Kind); 27128Assert.Equal(OperationKind.Attribute, context.OperationBlocks[1].Kind); 27131Assert.Equal(OperationKind.Invocation, context.OperationBlocks[2].Kind); 27141Assert.Equal(OperationKind.ParameterInitializer, context.OperationBlocks[0].Kind); 27144Assert.Equal(OperationKind.Attribute, context.OperationBlocks[1].Kind); 27147Assert.Equal(OperationKind.Block, context.OperationBlocks[2].Kind); 27149Assert.Equal(OperationKind.Invocation, context.OperationBlocks[3].Kind); 27158Assert.Equal(OperationKind.Block, context.OperationBlocks[0].Kind); 27170context.RegisterOperationAction(Handle1, OperationKind.ConstructorBody); 27171context.RegisterOperationAction(Handle2, OperationKind.Invocation); 27172context.RegisterOperationAction(Handle3, OperationKind.Literal); 27173context.RegisterOperationAction(Handle4, OperationKind.ParameterInitializer); 27174context.RegisterOperationAction(Handle5, OperationKind.PropertyInitializer); 27175context.RegisterOperationAction(Handle5, OperationKind.FieldInitializer); 27186Assert.Equal(OperationKind.ParameterInitializer, context.OperationBlocks[0].Kind); 27189Assert.Equal(OperationKind.Attribute, context.OperationBlocks[1].Kind); 27197Assert.Equal(OperationKind.ParameterInitializer, context.OperationBlocks[0].Kind); 27200Assert.Equal(OperationKind.Attribute, context.OperationBlocks[1].Kind); 27203Assert.Equal(OperationKind.Invocation, context.OperationBlocks[2].Kind); 27211Assert.Equal(OperationKind.ParameterInitializer, context.OperationBlocks[0].Kind); 27214Assert.Equal(OperationKind.Attribute, context.OperationBlocks[1].Kind); 27217Assert.Equal(OperationKind.Block, context.OperationBlocks[2].Kind); 27219Assert.Equal(OperationKind.Invocation, context.OperationBlocks[3].Kind); 27226Assert.Equal(OperationKind.Block, context.OperationBlocks[0].Kind);
Microsoft.CodeAnalysis.CSharp.Features (15)
ConvertLinq\CSharpConvertLinqQueryToForEachProvider.cs (2)
916return operation.Kind is OperationKind.LocalReference or OperationKind.ParameterReference;
src\Analyzers\CSharp\Analyzers\MakeStructFieldsWritable\CSharpMakeStructFieldsWritableDiagnosticAnalyzer.cs (1)
94context.RegisterOperationAction(AnalyzeAssignment, OperationKind.SimpleAssignment);
src\Analyzers\CSharp\Analyzers\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyAnalyzer.cs (1)
287if (operation.Kind == OperationKind.None)
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseIndexOperatorDiagnosticAnalyzer.cs (3)
77OperationKind.PropertyReference); 82OperationKind.Invocation); 93OperationKind.ArrayElementReference);
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseRangeOperatorDiagnosticAnalyzer.cs (1)
72OperationKind.Invocation);
src\Analyzers\CSharp\Analyzers\UseIsNullCheck\CSharpUseNullCheckOverTypeCheckDiagnosticAnalyzer.cs (2)
40context.RegisterOperationAction(c => AnalyzeIsTypeOperation(c, expressionType), OperationKind.IsType); 41context.RegisterOperationAction(c => AnalyzeNegatedPatternOperation(c), OperationKind.NegatedPattern);
src\Analyzers\CSharp\Analyzers\UsePrimaryConstructor\CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs (2)
240OperationKind.FieldReference, OperationKind.PropertyReference);
src\Analyzers\CSharp\Analyzers\UseSystemThreadingLock\CSharpUseSystemThreadingLockDiagnosticAnalyzer.cs (2)
165}, OperationKind.FieldInitializer); 217}, OperationKind.FieldReference);
src\Analyzers\CSharp\Analyzers\UseUtf8StringLiteral\UseUtf8StringLiteralDiagnosticAnalyzer.cs (1)
57context.RegisterOperationAction(c => AnalyzeOperation(c, expressionType), OperationKind.ArrayCreation);
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (2)
Diagnostics\Suppression\RemoveUnnecessaryPragmaSuppressionsTests.cs (2)
76}, OperationKind.VariableDeclarator); 91}, OperationKind.LocalReference);
Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests (18)
IOperation\IOperationTests.cs (8)
467Assert.Equal(OperationKind.DeconstructionAssignment, operation1.Kind); 473Assert.Equal(OperationKind.DeconstructionAssignment, operation2.Kind); 479Assert.Equal(OperationKind.DeconstructionAssignment, operation3.Kind); 513Assert.Equal(OperationKind.ExpressionStatement, operation.Kind); 562Assert.Equal(OperationKind.FieldReference, operation.Kind); 592VerifyRootAndModelForOperationAncestors(operation, model, expectedRootOperationKind: OperationKind.MethodBody, expectedRootSyntax: methodDeclSyntax); 627VerifyRootAndModelForOperationAncestors(operation, speculativeModel, expectedRootOperationKind: OperationKind.Block, expectedRootSyntax: speculatedBlock); 678OperationKind expectedRootOperationKind,
IOperation\IOperationTests_IConversionExpression.cs (2)
184Assert.Equal(OperationKind.Invalid, initializerOperation.Kind); 5351if (operation.Kind == OperationKind.Conversion)
IOperation\IOperationTests_IVariableDeclaration.cs (8)
614Assert.Equal(OperationKind.Literal, declarator.ChildOperations.First().Kind); 615Assert.Equal(OperationKind.VariableInitializer, declarator.ChildOperations.ElementAt(1).Kind); 636Assert.Equal(OperationKind.Literal, declarator.ChildOperations.First().Kind); 657Assert.Equal(OperationKind.VariableInitializer, declarator.ChildOperations.ElementAt(0).Kind); 852Assert.Equal(OperationKind.Literal, declaration.ChildOperations.First().Kind); 853Assert.Equal(OperationKind.VariableDeclarator, declaration.ChildOperations.ElementAt(1).Kind); 874Assert.Equal(OperationKind.Literal, declaration.ChildOperations.First().Kind); 875Assert.Equal(OperationKind.VariableDeclarator, declaration.ChildOperations.ElementAt(1).Kind);
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (13)
Semantics\DynamicTests.cs (1)
11420Assert.Equal(OperationKind.Invalid, model.GetOperation(call).Kind);
Semantics\RecordStructTests.cs (8)
6408context.RegisterOperationAction(HandleConstructorBody, OperationKind.ConstructorBody); 6409context.RegisterOperationAction(HandleInvocation, OperationKind.Invocation); 6410context.RegisterOperationAction(HandleLiteral, OperationKind.Literal); 6411context.RegisterOperationAction(HandleParameterInitializer, OperationKind.ParameterInitializer); 6412context.RegisterOperationAction(Fail, OperationKind.PropertyInitializer); 6413context.RegisterOperationAction(Fail, OperationKind.FieldInitializer); 6516Assert.Equal(OperationKind.ParameterInitializer, context.OperationBlocks[0].Kind); 6519Assert.Equal(OperationKind.Attribute, context.OperationBlocks[1].Kind);
Semantics\TopLevelStatementsTests.cs (4)
6714context.RegisterOperationAction(Handle1, OperationKind.Invocation); 6715context.RegisterOperationAction(Handle2, OperationKind.Block); 7414context.RegisterOperationAction(Handle2, OperationKind.Block); 9681Assert.Equal(OperationKind.Literal, model.GetOperation(tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single()).Kind);
Microsoft.CodeAnalysis.CSharp.Workspaces (2)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (2)
90Kind: OperationKind.MethodReference, 91Parent.Kind: OperationKind.DelegateCreation,
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (2)
CodeFixes\CodeFixServiceTests.cs (2)
1190=> variableDeclarations.Add(context.Operation.Syntax), OperationKind.VariableDeclaration); 1211OperationKind.VariableDeclaration);
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (4)
Diagnostics\DiagnosticServiceTests.vb (4)
2403End Sub, OperationKind.VariableDeclaration) 2463Assert.Equal(OperationKind.VariableDeclaration, analyzedOperation.Kind) 2523context.RegisterOperationAction(Sub(operationContext) AnalyzedOperations.Add(operationContext.Operation), OperationKind.VariableDeclaration) 2527operationBlockStartContext.RegisterOperationAction(Sub(operationContext) AnalyzedOperationsInsideOperationBlock.Add(operationContext.Operation), OperationKind.VariableDeclaration)
Microsoft.CodeAnalysis.Features (79)
ConvertForEachToFor\AbstractConvertForEachToForCodeRefactoringProvider.cs (5)
376case OperationKind.LocalReference: 377case OperationKind.FieldReference: 378case OperationKind.ParameterReference: 379case OperationKind.PropertyReference: 380case OperationKind.ArrayElementReference:
ConvertIfToSwitch\AbstractConvertIfToSwitchCodeRefactoringProvider.cs (2)
130if (!sections.Any(static section => GetSwitchArmKind(section.Body) == OperationKind.Return)) 138static OperationKind GetSwitchArmKind(IOperation op)
InitializeParameter\AbstractInitializeParameterCodeRefactoringProvider.cs (2)
171case OperationKind.AnonymousFunction: 174case OperationKind.Block:
InlineMethod\AbstractInlineMethodRefactoringProvider.InlineContext.cs (2)
421if (operation.Kind is OperationKind.AnonymousFunction or OperationKind.LocalFunction)
IntroduceParameter\AbstractIntroduceParameterCodeRefactoringProvider.cs (1)
228containsClassSpecificStatement = operation.Descendants().Any(op => op.Kind == OperationKind.InstanceReference);
IntroduceUsingStatement\AbstractIntroduceUsingStatementCodeRefactoringProvider.cs (1)
91if (initializer is null || initializer.Kind == OperationKind.Invalid)
IntroduceVariable\AbstractIntroduceVariableService.cs (1)
372memberReferenceOperation.Instance?.Kind == OperationKind.InstanceReference;
src\Analyzers\Core\Analyzers\ConvertTypeofToNameof\AbstractConvertTypeOfToNameOfDiagnosticAnalyzer.cs (1)
28context.RegisterOperationAction(AnalyzeAction, OperationKind.TypeOf);
src\Analyzers\Core\Analyzers\MakeFieldReadonly\AbstractMakeFieldReadonlyDiagnosticAnalyzer.cs (2)
69context.RegisterOperationAction(AnalyzeOperation, OperationKind.FieldReference); 281if (fieldReference.Instance?.Kind != OperationKind.InstanceReference ||
src\Analyzers\Core\Analyzers\PopulateSwitch\AbstractPopulateSwitchDiagnosticAnalyzer.cs (1)
31protected abstract OperationKind OperationKind { get; }
src\Analyzers\Core\Analyzers\PopulateSwitch\AbstractPopulateSwitchExpressionDiagnosticAnalyzer.cs (2)
21protected sealed override OperationKind OperationKind => OperationKind.SwitchExpression;
src\Analyzers\Core\Analyzers\PopulateSwitch\AbstractPopulateSwitchStatementDiagnosticAnalyzer.cs (2)
21protected sealed override OperationKind OperationKind => OperationKind.Switch;
src\Analyzers\Core\Analyzers\QualifyMemberAccess\AbstractQualifyMemberAccessDiagnosticAnalyzer.cs (6)
50=> context.RegisterOperationAction(AnalyzeOperation, OperationKind.FieldReference, OperationKind.PropertyReference, OperationKind.MethodReference, OperationKind.Invocation); 84if (instanceOperation.Kind != OperationKind.InstanceReference) 88if (context.Operation.Parent?.Kind == OperationKind.PropertySubpattern)
src\Analyzers\Core\Analyzers\RemoveRedundantEquality\AbstractRemoveRedundantEqualityDiagnosticAnalyzer.cs (3)
25context.RegisterOperationAction(AnalyzeBinaryOperator, OperationKind.BinaryOperator); 26context.RegisterOperationAction(AnalyzeIsPatternOperator, OperationKind.IsPattern); 126Kind: OperationKind.Literal,
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (14)
202symbolStartContext.RegisterOperationAction(AnalyzeMemberReferenceOperation, OperationKind.FieldReference, OperationKind.MethodReference, OperationKind.PropertyReference, OperationKind.EventReference); 203symbolStartContext.RegisterOperationAction(AnalyzeFieldInitializer, OperationKind.FieldInitializer); 204symbolStartContext.RegisterOperationAction(AnalyzeInvocationOperation, OperationKind.Invocation); 205symbolStartContext.RegisterOperationAction(AnalyzeNameOfOperation, OperationKind.NameOf); 206symbolStartContext.RegisterOperationAction(AnalyzeObjectCreationOperation, OperationKind.ObjectCreation); 214symbolStartContext.RegisterOperationAction(_ => hasUnsupportedOperation = true, OperationKind.Invalid, OperationKind.None, 215OperationKind.DynamicIndexerAccess, OperationKind.DynamicInvocation, OperationKind.DynamicMemberReference, OperationKind.DynamicObjectCreation);
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.BlockAnalyzer.cs (24)
73context.RegisterOperationAction(blockAnalyzer.AnalyzeExpressionStatement, OperationKind.ExpressionStatement); 74context.RegisterOperationAction(blockAnalyzer.AnalyzeDelegateCreationOrAnonymousFunction, OperationKind.DelegateCreation, OperationKind.AnonymousFunction); 75context.RegisterOperationAction(blockAnalyzer.AnalyzeLocalOrParameterReference, OperationKind.LocalReference, OperationKind.ParameterReference); 76context.RegisterOperationAction(_ => blockAnalyzer._hasInvalidOperation = true, OperationKind.Invalid); 259Debug.Assert(operation.Kind is OperationKind.DelegateCreation or OperationKind.AnonymousFunction); 275(assignment.Target.Kind == OperationKind.LocalReference || 276assignment.Target.Kind == OperationKind.ParameterReference)) 284if (operation.Kind == OperationKind.AnonymousFunction && 308Debug.Assert(operation.Kind is OperationKind.LocalReference or OperationKind.ParameterReference); 342(assignmentOperation.Target.Kind == OperationKind.LocalReference || 343assignmentOperation.Target.Kind == OperationKind.ParameterReference)) 370case OperationKind.Attribute: 371case OperationKind.ParameterInitializer: 390if (operation.Kind == OperationKind.None) 667case OperationKind.ParameterReference: 668case OperationKind.LocalReference: 672case OperationKind.FieldReference: 676return fieldReference.Instance == null || fieldReference.Instance.Kind == OperationKind.InstanceReference; 678case OperationKind.DefaultValue: 682case OperationKind.Conversion:
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.cs (1)
99context.RegisterOperationAction(OnMethodReference, OperationKind.MethodReference);
src\Analyzers\Core\Analyzers\SimplifyInterpolation\AbstractSimplifyInterpolationDiagnosticAnalyzer.cs (1)
40=> context.RegisterOperationAction(AnalyzeInterpolation, OperationKind.Interpolation);
src\Analyzers\Core\Analyzers\SimplifyInterpolation\AbstractSimplifyInterpolationHelpers.cs (1)
212: alignmentOp is { Kind: OperationKind.Literal })
src\Analyzers\Core\Analyzers\SimplifyLinqExpression\AbstractSimplifyLinqExpressionDiagnosticAnalyzer.cs (1)
68OperationKind.Invocation);
src\Analyzers\Core\Analyzers\UseConditionalExpression\AbstractUseConditionalExpressionDiagnosticAnalyzer.cs (1)
39=> context.RegisterOperationAction(AnalyzeOperation, OperationKind.Conditional);
src\Analyzers\Core\Analyzers\UseConditionalExpression\ForReturn\UseConditionalExpressionForReturnHelpers.cs (2)
96if (trueReturn?.Kind == OperationKind.YieldBreak) 103if (trueReturn?.Kind == OperationKind.YieldReturn &&
src\Analyzers\Core\Analyzers\UseExplicitTupleName\UseExplicitTupleNameDiagnosticAnalyzer.cs (1)
31=> context.RegisterOperationAction(AnalyzeOperation, OperationKind.FieldReference);
src\Analyzers\Core\Analyzers\UseThrowExpression\AbstractUseThrowExpressionDiagnosticAnalyzer.cs (1)
66startContext.RegisterOperationAction(operationContext => AnalyzeOperation(operationContext, expressionType), OperationKind.Throw);
src\Analyzers\Core\CodeFixes\UseConditionalExpression\ForReturn\AbstractUseConditionalExpressionForReturnCodeFixProvider.cs (1)
77var returnStatement = anyReturn.Kind == OperationKind.YieldReturn
Microsoft.CodeAnalysis.Test.Utilities (434)
Compilation\ControlFlowGraphVerifier.cs (126)
33operationRoot = operationRoot.Kind == OperationKind.Block && 34(operationRoot.Parent?.Kind == OperationKind.ConstructorBody || 35operationRoot.Parent?.Kind == OperationKind.MethodBody) ? 700query.Operation.Kind == OperationKind.AnonymousObjectCreation) 1042if (operation.Parent == null && operation is IsNullOperation isNull && isNull.Operand.Kind == OperationKind.FlowCaptureReference) 1524Assert.Equal(OperationKind.LocalFunction, g.OriginalOperation.Kind); 1826Assert.Equal(OperationKind.AnonymousFunction, g.OriginalOperation.Kind); 1837case OperationKind.Block: 1838case OperationKind.Switch: 1839case OperationKind.Loop: 1840case OperationKind.Branch: 1841case OperationKind.Lock: 1842case OperationKind.Try: 1843case OperationKind.Using: 1844case OperationKind.Conditional: 1845case OperationKind.Coalesce: 1846case OperationKind.ConditionalAccess: 1847case OperationKind.ConditionalAccessInstance: 1848case OperationKind.MemberInitializer: 1849case OperationKind.FieldInitializer: 1850case OperationKind.PropertyInitializer: 1851case OperationKind.ParameterInitializer: 1852case OperationKind.CatchClause: 1853case OperationKind.SwitchCase: 1854case OperationKind.CaseClause: 1855case OperationKind.VariableDeclarationGroup: 1856case OperationKind.VariableDeclaration: 1857case OperationKind.VariableDeclarator: 1858case OperationKind.VariableInitializer: 1859case OperationKind.Return: 1860case OperationKind.YieldBreak: 1861case OperationKind.Labeled: 1862case OperationKind.Throw: 1863case OperationKind.End: 1864case OperationKind.Empty: 1865case OperationKind.NameOf: 1866case OperationKind.AnonymousFunction: 1867case OperationKind.ObjectOrCollectionInitializer: 1868case OperationKind.LocalFunction: 1869case OperationKind.CoalesceAssignment: 1870case OperationKind.SwitchExpression: 1871case OperationKind.SwitchExpressionArm: 1874case OperationKind.Binary: 1883case OperationKind.InstanceReference: 1897simpleAssignment.Parent.Kind == OperationKind.AnonymousObjectCreation); 1899case OperationKind.None: 1902case OperationKind.FunctionPointerInvocation: 1903case OperationKind.Invalid: 1904case OperationKind.YieldReturn: 1905case OperationKind.ExpressionStatement: 1906case OperationKind.Stop: 1907case OperationKind.RaiseEvent: 1908case OperationKind.Literal: 1909case OperationKind.Utf8String: 1910case OperationKind.Conversion: 1911case OperationKind.Invocation: 1912case OperationKind.ArrayElementReference: 1913case OperationKind.LocalReference: 1914case OperationKind.ParameterReference: 1915case OperationKind.FieldReference: 1916case OperationKind.MethodReference: 1917case OperationKind.PropertyReference: 1918case OperationKind.EventReference: 1919case OperationKind.FlowAnonymousFunction: 1920case OperationKind.ObjectCreation: 1921case OperationKind.TypeParameterObjectCreation: 1922case OperationKind.ArrayCreation: 1923case OperationKind.ArrayInitializer: 1924case OperationKind.IsType: 1925case OperationKind.Await: 1926case OperationKind.SimpleAssignment: 1927case OperationKind.CompoundAssignment: 1928case OperationKind.Parenthesized: 1929case OperationKind.EventAssignment: 1930case OperationKind.InterpolatedString: 1931case OperationKind.AnonymousObjectCreation: 1932case OperationKind.Tuple: 1933case OperationKind.TupleBinary: 1934case OperationKind.DynamicObjectCreation: 1935case OperationKind.DynamicMemberReference: 1936case OperationKind.DynamicInvocation: 1937case OperationKind.DynamicIndexerAccess: 1938case OperationKind.TranslatedQuery: 1939case OperationKind.DelegateCreation: 1940case OperationKind.DefaultValue: 1941case OperationKind.TypeOf: 1942case OperationKind.SizeOf: 1943case OperationKind.AddressOf: 1944case OperationKind.IsPattern: 1945case OperationKind.Increment: 1946case OperationKind.Decrement: 1947case OperationKind.DeconstructionAssignment: 1948case OperationKind.DeclarationExpression: 1949case OperationKind.OmittedArgument: 1950case OperationKind.Argument: 1951case OperationKind.InterpolatedStringText: 1952case OperationKind.Interpolation: 1953case OperationKind.ConstantPattern: 1954case OperationKind.DeclarationPattern: 1955case OperationKind.Unary: 1956case OperationKind.FlowCapture: 1957case OperationKind.FlowCaptureReference: 1958case OperationKind.IsNull: 1959case OperationKind.CaughtException: 1960case OperationKind.StaticLocalInitializationSemaphore: 1961case OperationKind.Discard: 1962case OperationKind.ReDim: 1963case OperationKind.ReDimClause: 1964case OperationKind.Range: 1965case OperationKind.RecursivePattern: 1966case OperationKind.DiscardPattern: 1967case OperationKind.PropertySubpattern: 1968case OperationKind.RelationalPattern: 1969case OperationKind.NegatedPattern: 1970case OperationKind.BinaryPattern: 1971case OperationKind.TypePattern: 1972case OperationKind.InterpolatedStringAppendFormatted: 1973case OperationKind.InterpolatedStringAppendLiteral: 1974case OperationKind.InterpolatedStringAppendInvalid: 1975case OperationKind.SlicePattern: 1976case OperationKind.ListPattern: 1977case OperationKind.ImplicitIndexerReference: 1978case OperationKind.Attribute: 1979case OperationKind.InlineArrayAccess: 1980case OperationKind.CollectionExpression: 1981case OperationKind.Spread:
Compilation\OperationTreeVerifier.cs (17)
103LogString($"{nameof(OperationKind)}.{GetKindText(operation.Kind)}"); 136string GetKindText(OperationKind kind) 140case OperationKind.Unary: 142case OperationKind.Binary: 144case OperationKind.TupleBinary: 146case OperationKind.MethodBody: 148case OperationKind.ConstructorBody: 400if (!children.IsEmpty || operation.Kind != OperationKind.None) 627Assert.Equal(OperationKind.Loop, operation.Kind); 760Assert.NotEqual(OperationKind.VariableDeclaration, operation.Resources.Kind); 761Assert.NotEqual(OperationKind.VariableDeclarator, operation.Resources.Kind); 1461Assert.Equal(OperationKind.InstanceReference, propertyReference.Instance.Kind); 1823Assert.Equal(OperationKind.CaseClause, operation.Kind); 1911if (operation.Text.Kind != OperationKind.Literal) 1913Assert.Equal(OperationKind.Literal, ((IConversionOperation)operation.Text).Operand.Kind); 1927if (operation.FormatString != null && operation.FormatString.Kind != OperationKind.Literal) 1929Assert.Equal(OperationKind.Literal, ((IConversionOperation)operation.FormatString).Operand.Kind);
Compilation\TestOperationVisitor.cs (152)
39Assert.Equal(OperationKind.None, operation.Kind); 55Assert.Equal(OperationKind.None, operation.Kind); 119Assert.Equal(OperationKind.Block, operation.Kind); 127Assert.Equal(OperationKind.VariableDeclarationGroup, operation.Kind); 133Assert.Equal(OperationKind.VariableDeclarator, operation.Kind); 148Assert.Equal(OperationKind.VariableDeclaration, operation.Kind); 162Assert.Equal(OperationKind.Switch, operation.Kind); 170Assert.Equal(OperationKind.SwitchCase, operation.Kind); 222Assert.Equal(OperationKind.CaseClause, operation.Kind); 359Assert.Equal(OperationKind.Loop, operation.Kind); 367Assert.Equal(OperationKind.Labeled, operation.Kind); 382Assert.Equal(OperationKind.Branch, operation.Kind); 401Assert.Equal(OperationKind.Empty, operation.Kind); 407Assert.Contains(operation.Kind, new[] { OperationKind.Return, OperationKind.YieldReturn, OperationKind.YieldBreak }); 410Assert.NotEqual(OperationKind.YieldReturn, operation.Kind); 421Assert.Equal(OperationKind.Lock, operation.Kind); 427Assert.Equal(OperationKind.Try, operation.Kind); 441Assert.Equal(OperationKind.CatchClause, operation.Kind); 462Assert.Equal(OperationKind.Using, operation.Kind); 465Assert.NotEqual(OperationKind.VariableDeclaration, operation.Resources.Kind); 466Assert.NotEqual(OperationKind.VariableDeclarator, operation.Resources.Kind); 482Assert.Equal(OperationKind.None, operation.Kind); 489Assert.Equal(OperationKind.CollectionExpression, operation.Kind); 495Assert.Equal(OperationKind.Spread, operation.Kind); 501Assert.Equal(OperationKind.None, operation.Kind); 507Assert.Equal(OperationKind.ExpressionStatement, operation.Kind); 513Assert.Equal(OperationKind.None, operation.Kind); 519Assert.Equal(OperationKind.Stop, operation.Kind); 525Assert.Equal(OperationKind.End, operation.Kind); 531Assert.Equal(OperationKind.Invocation, operation.Kind); 564Assert.Equal(OperationKind.FunctionPointerInvocation, operation.Kind); 578Assert.Equal(OperationKind.Argument, operation.Kind); 594Assert.Equal(OperationKind.OmittedArgument, operation.Kind); 600Assert.Equal(OperationKind.ArrayElementReference, operation.Kind); 606Assert.Equal(OperationKind.ImplicitIndexerReference, operation.Kind); 615Assert.Equal(OperationKind.InlineArrayAccess, operation.Kind); 621Assert.Equal(OperationKind.None, operation.Kind); 627Assert.Equal(OperationKind.LocalReference, operation.Kind); 635Assert.Equal(OperationKind.ParameterReference, operation.Kind); 642Assert.Equal(OperationKind.InstanceReference, operation.Kind); 681Assert.Equal(OperationKind.FieldReference, operation.Kind); 691Assert.Equal(OperationKind.MethodReference, operation.Kind); 705Assert.Equal(OperationKind.PropertyReference, operation.Kind); 713Assert.Equal(OperationKind.EventReference, operation.Kind); 721Assert.Equal(OperationKind.EventAssignment, operation.Kind); 728Assert.Equal(OperationKind.ConditionalAccess, operation.Kind); 735Assert.Equal(OperationKind.ConditionalAccessInstance, operation.Kind); 741Assert.Equal(OperationKind.None, operation.Kind); 747Assert.Equal(OperationKind.UnaryOperator, operation.Kind); 748Assert.Equal(OperationKind.Unary, operation.Kind); 762Assert.Equal(OperationKind.BinaryOperator, operation.Kind); 763Assert.Equal(OperationKind.Binary, operation.Kind); 831Assert.Equal(OperationKind.TupleBinaryOperator, operation.Kind); 832Assert.Equal(OperationKind.TupleBinary, operation.Kind); 840Assert.Equal(OperationKind.Conversion, operation.Kind); 888Assert.Equal(OperationKind.Conditional, operation.Kind); 903Assert.Equal(OperationKind.Coalesce, operation.Kind); 910Assert.Equal(OperationKind.CoalesceAssignment, operation.Kind); 916Assert.Equal(OperationKind.IsType, operation.Kind); 924Assert.Equal(OperationKind.SizeOf, operation.Kind); 931Assert.Equal(OperationKind.TypeOf, operation.Kind); 938Assert.Equal(OperationKind.AnonymousFunction, operation.Kind); 945Assert.Equal(OperationKind.FlowAnonymousFunction, operation.Kind); 952Assert.Equal(OperationKind.LocalFunction, operation.Kind); 978Assert.Equal(OperationKind.Literal, operation.Kind); 984Assert.Equal(OperationKind.Utf8String, operation.Kind); 991Assert.Equal(OperationKind.Await, operation.Kind); 997Assert.Equal(OperationKind.NameOf, operation.Kind); 1003Assert.Equal(OperationKind.Throw, operation.Kind); 1016Assert.Equal(OperationKind.AddressOf, operation.Kind); 1022Assert.Equal(OperationKind.ObjectCreation, operation.Kind); 1047Assert.Equal(OperationKind.AnonymousObjectCreation, operation.Kind); 1054Assert.Equal(OperationKind.InstanceReference, propertyReference.Instance.Kind); 1061Assert.Equal(OperationKind.DynamicObjectCreation, operation.Kind); 1074Assert.Equal(OperationKind.DynamicInvocation, operation.Kind); 1080Assert.Equal(OperationKind.DynamicIndexerAccess, operation.Kind); 1086Assert.Equal(OperationKind.ObjectOrCollectionInitializer, operation.Kind); 1092Assert.Equal(OperationKind.MemberInitializer, operation.Kind); 1104Assert.Equal(OperationKind.FieldInitializer, operation.Kind); 1114Assert.Equal(OperationKind.VariableInitializer, operation.Kind); 1121Assert.Equal(OperationKind.PropertyInitializer, operation.Kind); 1131Assert.Equal(OperationKind.ParameterInitializer, operation.Kind); 1138Assert.Equal(OperationKind.ArrayCreation, operation.Kind); 1151Assert.Equal(OperationKind.ArrayInitializer, operation.Kind); 1163Assert.Equal(OperationKind.SimpleAssignment, operation.Kind); 1170Assert.Equal(OperationKind.CompoundAssignment, operation.Kind); 1199Assert.Contains(operation.Kind, new[] { OperationKind.Increment, OperationKind.Decrement }); 1211Assert.Equal(OperationKind.Parenthesized, operation.Kind); 1217Assert.Equal(OperationKind.DynamicMemberReference, operation.Kind); 1239Assert.Equal(OperationKind.DefaultValue, operation.Kind); 1245Assert.Equal(OperationKind.TypeParameterObjectCreation, operation.Kind); 1258Assert.Equal(OperationKind.None, operation.Kind); 1271Assert.Equal(OperationKind.Invalid, operation.Kind); 1276Assert.Equal(OperationKind.Tuple, operation.Kind); 1283Assert.Equal(OperationKind.InterpolatedString, operation.Kind); 1289Assert.Equal(OperationKind.InterpolatedStringText, operation.Kind); 1290if (operation.Text.Kind != OperationKind.Literal) 1292Assert.Equal(OperationKind.Literal, ((IConversionOperation)operation.Text).Operand.Kind); 1299Assert.Equal(OperationKind.Interpolation, operation.Kind); 1308if (operation.FormatString.Kind != OperationKind.Literal) 1310Assert.Equal(OperationKind.Literal, ((IConversionOperation)operation.FormatString).Operand.Kind); 1320Assert.Equal(OperationKind.InterpolatedStringHandlerCreation, operation.Kind); 1331Assert.Equal(OperationKind.InterpolatedStringAddition, operation.Kind); 1339Assert.Equal(OperationKind.InterpolatedStringHandlerArgumentPlaceholder, operation.Kind); 1353Assert.True(operation.Kind is OperationKind.InterpolatedStringAppendFormatted or OperationKind.InterpolatedStringAppendLiteral or OperationKind.InterpolatedStringAppendInvalid); 1367Assert.Equal(OperationKind.ConstantPattern, operation.Kind); 1374Assert.Equal(OperationKind.RelationalPattern, operation.Kind); 1387Assert.Equal(OperationKind.BinaryPattern, operation.Kind); 1398Assert.Equal(OperationKind.NegatedPattern, operation.Kind); 1405Assert.Equal(OperationKind.TypePattern, operation.Kind); 1413Assert.Equal(OperationKind.DeclarationPattern, operation.Kind); 1446Assert.Equal(OperationKind.SlicePattern, operation.Kind); 1461Assert.Equal(OperationKind.ListPattern, operation.Kind); 1479Assert.Equal(OperationKind.RecursivePattern, operation.Kind); 1527if (operation.Member.Kind == OperationKind.Invalid) 1551Assert.Equal(OperationKind.SwitchExpression, operation.Kind); 1573Assert.Equal(OperationKind.IsPattern, operation.Kind); 1595Assert.Equal(OperationKind.TranslatedQuery, operation.Kind); 1601Assert.Equal(OperationKind.DeclarationExpression, operation.Kind); 1607Assert.Equal(OperationKind.DeconstructionAssignment, operation.Kind); 1613Assert.Equal(OperationKind.DelegateCreation, operation.Kind); 1619Assert.Equal(OperationKind.RaiseEvent, operation.Kind); 1632Assert.Equal(OperationKind.ConstructorBodyOperation, operation.Kind); 1633Assert.Equal(OperationKind.ConstructorBody, operation.Kind); 1659Assert.Equal(OperationKind.MethodBodyOperation, operation.Kind); 1660Assert.Equal(OperationKind.MethodBody, operation.Kind); 1685Assert.Equal(OperationKind.Discard, operation.Kind); 1694Assert.Equal(OperationKind.DiscardPattern, operation.Kind); 1701Assert.Equal(OperationKind.FlowCapture, operation.Kind); 1707case OperationKind.Invalid: 1708case OperationKind.None: 1709case OperationKind.AnonymousFunction: 1710case OperationKind.FlowCaptureReference: 1711case OperationKind.DefaultValue: 1712case OperationKind.FlowAnonymousFunction: // must be an error case like in Microsoft.CodeAnalysis.CSharp.UnitTests.ConditionalOperatorTests.TestBothUntyped unit-test 1715case OperationKind.OmittedArgument: 1716case OperationKind.DeclarationExpression: 1717case OperationKind.Discard: 1733Assert.Equal(OperationKind.FlowCaptureReference, operation.Kind); 1740Assert.Equal(OperationKind.IsNull, operation.Kind); 1747Assert.Equal(OperationKind.CaughtException, operation.Kind); 1754Assert.Equal(OperationKind.StaticLocalInitializationSemaphore, operation.Kind); 1763Assert.Equal(OperationKind.Range, operation.Kind); 1784Assert.Equal(OperationKind.ReDim, operation.Kind); 1791Assert.Equal(OperationKind.ReDimClause, operation.Kind); 1818Assert.Equal(OperationKind.With, operation.Kind); 1826Assert.Equal(OperationKind.Attribute, operation.Kind);
Diagnostics\BoxingOperationAnalyzer.cs (4)
45if (operation.Kind == OperationKind.Conversion) 58if (operation.Kind == OperationKind.Invocation) 70OperationKind.Conversion, 71OperationKind.Invocation);
Diagnostics\CommonDiagnosticAnalyzers.cs (18)
970oc.RegisterOperationAction(c => ReportDiagnostic(c.ReportDiagnostic, ActionKind.Operation), OperationKind.VariableDeclarationGroup); 1355}, OperationKind.Literal); 1367}, OperationKind.Literal); 1434context.RegisterOperationAction(AnalyzerOperation, OperationKind.FieldReference); 1468}, OperationKind.MethodBody, OperationKind.ConstructorBody); 1583OperationKind.Invocation); 1873private readonly OperationKind? _operationKind; 1876public SymbolStartAnalyzer(bool topLevelAction, SymbolKind symbolKind, OperationKind? operationKindOpt = null, int? analyzerId = null) 2563analysisContext.RegisterOperationAction(_ => { }, OperationKind.Invocation); 2759OperationKind.VariableDeclarationGroup); 2773OperationKind.VariableDeclarationGroup); 2786OperationKind.VariableDeclarationGroup); 2889OperationKind.VariableDeclaration); 2943context.RegisterOperationAction(context => HandleCallback(context.Operation.Syntax.GetLocation(), context.Compilation, context.ReportDiagnostic, context.CancellationToken), OperationKind.VariableDeclaration); 3017context.RegisterOperationAction(operationContext => AnalyzedOperations.Add(operationContext.Operation), OperationKind.VariableDeclaration); 3045operationBlockStartContext.RegisterOperationAction(operationContext => AnalyzedOperationsInsideOperationBlock.Add(operationContext.Operation), OperationKind.VariableDeclaration); 3156}, OperationKind.VariableDeclarationGroup);
Diagnostics\CouldHaveMoreSpecificTypeAnalyzer.cs (10)
79OperationKind.SimpleAssignment, 80OperationKind.CompoundAssignment, 81OperationKind.Increment); 96OperationKind.Invocation); 118OperationKind.VariableInitializer); 145OperationKind.FieldInitializer); 239OperationKind targetKind = target.Kind; 240if (targetKind == OperationKind.LocalReference) 245else if (targetKind == OperationKind.FieldReference) 281if (value.Kind == OperationKind.Conversion)
Diagnostics\EmptyArrayAnalyzer.cs (1)
87OperationKind.ArrayCreation);
Diagnostics\FieldCouldBeReadOnlyAnalyzer.cs (7)
67OperationKind.SimpleAssignment, 68OperationKind.CompoundAssignment, 69OperationKind.Increment, 70OperationKind.Decrement); 84OperationKind.Invocation); 113if (target.Kind == OperationKind.FieldReference) 120case OperationKind.InstanceReference:
Diagnostics\LocalCouldBeConstAnalyzer.cs (7)
61OperationKind.SimpleAssignment, 62OperationKind.CompoundAssignment, 63OperationKind.Increment); 77OperationKind.Invocation); 100OperationKind.VariableDeclarationGroup); 116if (target.Kind == OperationKind.LocalReference) 123else if (target.Kind == OperationKind.FieldReference)
Diagnostics\OperationTestAnalyzer.cs (90)
66OperationKind.Invalid); 76OperationKind.Invocation, 77OperationKind.Invalid); 112OperationKind.LocalReference, 113OperationKind.Literal); 141context.RegisterOperationAction(AnalyzeOperation, OperationKind.Loop); 152if (forCondition.Kind == OperationKind.Binary) 160conditionLeft.Kind == OperationKind.LocalReference) 170if (setup.Kind == OperationKind.ExpressionStatement && ((IExpressionStatementOperation)setup).Operation.Kind == OperationKind.SimpleAssignment) 173if (setupAssignment.Target.Kind == OperationKind.LocalReference && 185if (advance.Kind == OperationKind.ExpressionStatement) 234if (advanceExpression.Kind == OperationKind.SimpleAssignment) 238if (advanceAssignment.Target.Kind == OperationKind.LocalReference && 240advanceAssignment.Value.Kind == OperationKind.Binary && 247advanceOperation.LeftOperand.Kind == OperationKind.LocalReference && 258else if (advanceExpression.Kind == OperationKind.CompoundAssignment) 262if (advanceAssignment.Target.Kind == OperationKind.LocalReference && 272else if (advanceExpression.Kind == OperationKind.Increment) 276if (advanceAssignment.Target.Kind == OperationKind.LocalReference && 464OperationKind.Switch); 581OperationKind.Invocation); 638OperationKind.Literal); 673OperationKind.Argument); 716Report(operationContext, initializer.Syntax, initializer.Kind == OperationKind.FieldReference ? DoNotUseFieldInitializerDescriptor : DoNotUsePropertyInitializerDescriptor); 718OperationKind.FieldReference, 719OperationKind.PropertyReference); 753var kind = assignment.Target.Kind; 754if (kind == OperationKind.FieldReference || 755kind == OperationKind.PropertyReference) 760OperationKind.SimpleAssignment); 800OperationKind.ArrayInitializer); 857OperationKind.VariableDeclarationGroup); 901case OperationKind.CaseClause: 908case OperationKind.SwitchCase: 917OperationKind.SwitchCase, 918OperationKind.CaseClause); 957OperationKind.InstanceReference); 1036OperationKind.EventReference); 1044if (eventAssignment.EventReference.Kind == OperationKind.Invalid || eventAssignment.HasErrors(operationContext.Compilation, operationContext.CancellationToken)) 1049OperationKind.EventAssignment); 1056OperationKind.PropertyReference); 1063OperationKind.FieldReference); 1070OperationKind.MethodReference); 1117OperationKind.Invocation); 1144OperationKind.ObjectCreation); 1187OperationKind.FieldInitializer); 1198OperationKind.ParameterInitializer); 1229OperationKind.None); 1264if (addressOfOperation.Reference.Kind == OperationKind.Invalid && addressOfOperation.HasErrors(operationContext.Compilation, operationContext.CancellationToken)) 1269OperationKind.AddressOf); 1328if (statement.Kind == OperationKind.None) 1339OperationKind.AnonymousFunction); 1383case OperationKind.FieldReference: 1387case OperationKind.PropertyReference: 1391case OperationKind.EventReference: 1395case OperationKind.MethodReference: 1399case OperationKind.Invocation: 1416OperationKind.FieldReference, 1417OperationKind.PropertyReference, 1418OperationKind.EventReference, 1419OperationKind.MethodReference, 1420OperationKind.Invocation); 1455OperationKind.Labeled); 1470OperationKind.Branch); 1526OperationKind.Binary); 1547OperationKind.Unary); 1578OperationKind.Binary); 1615if (left.Kind == OperationKind.LocalReference) 1620if (right.Kind == OperationKind.Literal) 1635OperationKind.Binary); 1642if (operand.Kind == OperationKind.LocalReference) 1657OperationKind.Unary); 1710OperationKind.Invocation); 1735if (operation.Kind == OperationKind.Argument) 1786if (operation.Kind == OperationKind.Binary) 1794else if (operation.Kind == OperationKind.Unary) 1802else if (operation.Kind == OperationKind.Increment) 1811OperationKind.Binary, 1812OperationKind.Unary, 1813OperationKind.Increment); 1851OperationKind.ConditionalAccess); 1859OperationKind.ConditionalAccessInstance); 1900OperationKind.Conversion); 1939OperationKind.Loop); 1981OperationKind.Unary); 2017OperationKind.SimpleAssignment); 2054OperationKind.Literal); 2082OperationKind.Literal); 2113OperationKind.Literal);
Extensions\OperationExtensions.cs (2)
16case OperationKind.ArrayInitializer: 17case OperationKind.Argument:
Microsoft.CodeAnalysis.UnitTests (1)
Diagnostics\AnalysisContextInfoTests.cs (1)
76c.RegisterOperationAction(b => ThrowIfMatch(nameof(c.RegisterOperationAction), new AnalysisContextInfo(b.Compilation, b.Operation)), OperationKind.Return);
Microsoft.CodeAnalysis.VisualBasic (2)
Operations\VisualBasicOperationFactory.vb (2)
1327Return New ReturnOperation(returnedValue, OperationKind.Return, _semanticModel, syntax, isImplicit) 1377Return New ReturnOperation(returnedValue, OperationKind.YieldReturn, _semanticModel, syntax, isImplicit)
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (1)
Diagnostics\GetDiagnosticsTests.vb (1)
613blockStartContext.RegisterOperationAction(AddressOf AnalyzeOperationContext, OperationKind.Literal)
Microsoft.CodeAnalysis.Workspaces (31)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ControlFlowGraphExtensions.cs (1)
30public static IEnumerable<T> DescendantOperations<T>(this ControlFlowGraph cfg, OperationKind operationKind)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (9)
21assignmentOperation.Parent?.Kind == OperationKind.ObjectOrCollectionInitializer; 243case OperationKind.AnonymousFunction: 246case OperationKind.LocalFunction: 267case OperationKind.DeconstructionAssignment: 271case OperationKind.Tuple: 272case OperationKind.Conversion: 273case OperationKind.Parenthesized: 371public static bool HasAnyOperationDescendant(this ImmutableArray<IOperation> operationBlocks, OperationKind kind) 375=> operation.Kind == OperationKind.Literal && operation.Type.IsNumericType();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SemanticEquivalence.cs (1)
129=> operation is IMemberReferenceOperation { Instance.Kind: OperationKind.InstanceReference };
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\LValueFlowCaptureProvider.cs (1)
54foreach (var flowCaptureReference in cfg.DescendantOperations<IFlowCaptureReferenceOperation>(OperationKind.FlowCaptureReference))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.FlowGraphAnalysisData.cs (2)
192if (operation.Kind is OperationKind.LocalFunction or OperationKind.AnonymousFunction)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.Walker.cs (15)
154operation.Parent.Parent?.Kind != OperationKind.ExpressionStatement) 162Debug.Assert(symbolOpt != null || operation.Kind == OperationKind.FlowCaptureReference); 192operation.Parent?.Kind != OperationKind.ExpressionStatement; 196if (write.Kind != OperationKind.FlowCaptureReference) 439case OperationKind.Conversion: 443case OperationKind.Parenthesized: 447case OperationKind.DelegateCreation: 451case OperationKind.AnonymousFunction: 457case OperationKind.FlowAnonymousFunction: 461case OperationKind.MethodReference: 474case OperationKind.LocalReference: 479case OperationKind.ParameterReference: 484case OperationKind.Literal: 554case OperationKind.FlowAnonymousFunction: 558case OperationKind.MethodReference:
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_Negate.cs (2)
479if (operation?.Kind == OperationKind.Literal && operation.ConstantValue.HasValue && operation.ConstantValue.Value is true) 483else if (operation?.Kind == OperationKind.Literal && operation.ConstantValue.HasValue && operation.ConstantValue.Value is false)
Microsoft.Interop.ComInterfaceGenerator (3)
Analyzers\ComHostingDoesNotSupportGeneratedComInterfaceAnalyzer.cs (1)
67}, OperationKind.Attribute);
Analyzers\RuntimeComApiUsageWithSourceGeneratedComAnalyzer.cs (2)
131}, OperationKind.Invocation); 198}, OperationKind.Conversion);
Microsoft.Interop.LibraryImportGenerator (2)
Analyzers\CustomMarshallerAttributeAnalyzer.cs (1)
624context.RegisterOperationAction(perCompilationAnalyzer.AnalyzeAttribute, OperationKind.Attribute);
Analyzers\NativeMarshallingAttributeAnalyzer.cs (1)
72context.RegisterOperationAction(perCompilationAnalyzer.AnalyzeAttribute, OperationKind.Attribute);
System.Private.CoreLib.Generators (4)
IntrinsicsInSystemPrivateCoreLibAnalyzer.cs (4)
185OperationKind.Invocation, OperationKind.PropertyReference); 493if (operationSearch.Kind == OperationKind.AnonymousFunction) 498if (operationSearch.Kind == OperationKind.LocalFunction)
System.Text.RegularExpressions.Generator (2)
UpgradeToGeneratedRegexAnalyzer.cs (2)
55context.RegisterOperationAction(context => AnalyzeObjectCreation(context, regexTypeSymbol), OperationKind.ObjectCreation); 58context.RegisterOperationAction(context => AnalyzeInvocation(context, regexTypeSymbol, staticMethodsToDetect), OperationKind.Invocation);