133 implementations of Kind
Microsoft.CodeAnalysis (132)
Generated\Operations.Generated.cs (126)
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; 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; 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; 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\Operation.cs (1)
65public abstract OperationKind Kind { get; }
Operations\OperationNodes.cs (5)
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;
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (1)
Semantics\CollectionExpressionTests.cs (1)
27157OperationKind IOperation.Kind => throw null;
510 references to Kind
ILLink.RoslynAnalyzer (8)
DataFlow\CapturedReferenceValue.cs (1)
17 switch (operation.Kind) {
DataFlow\ControlFlowGraphExtensions.cs (1)
34 => cfg.DescendantOperations ().Where (d => d?.Kind == operationKind).Cast<T> ();
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 (2)
185 switch (operation.Kind) { 207 switch (current.Kind) {
TrimAnalysis\HandleCallAction.cs (1)
39 _isNewObj = operation.Kind == OperationKind.ObjectCreation;
Microsoft.Analyzers.Extra (8)
AsyncCallInsideUsingBlockAnalyzer.cs (1)
86switch (operation.Kind)
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 (2)
39if (op.Target.Kind == OperationKind.ParameterReference) 66if (op.Value.Kind == OperationKind.ParameterReference)
ConditionalAccessAnalyzer.cs (2)
37switch (op.Operation.Kind) 98if (op.Operation.Kind == OperationKind.ParameterReference)
Microsoft.AspNetCore.App.Analyzers (4)
Http\RequestDelegateReturnTypeAnalyzer.cs (2)
32parent.Kind == OperationKind.DelegateCreation && 48parent.Kind == OperationKind.DelegateCreation &&
RouteHandlers\RouteHandlerAnalyzer.cs (2)
105if (delegateCreation.Target.Kind == OperationKind.AnonymousFunction) 115else if (delegateCreation.Target.Kind == OperationKind.MethodReference)
Microsoft.AspNetCore.Components.Analyzers (2)
ComponentParameterUsageAnalyzer.cs (1)
59if (leftHandSide.Kind != OperationKind.PropertyReference)
InternalUsageAnalyzer.cs (1)
69_ => throw new InvalidOperationException("Unexpected operation kind: " + context.Operation.Kind),
Microsoft.AspNetCore.Components.SdkAnalyzers (2)
ComponentParameterUsageAnalyzer.cs (1)
59if (leftHandSide.Kind != OperationKind.PropertyReference)
InternalUsageAnalyzer.cs (1)
69_ => throw new InvalidOperationException("Unexpected operation kind: " + context.Operation.Kind),
Microsoft.AspNetCore.Mvc.Analyzers (4)
TagHelpersInCodeBlocksAnalyzer.cs (4)
48if (awaitOperation.Operation.Kind != OperationKind.Invocation) 115if (operation.Kind == OperationKind.LocalFunction) 120if (operation.Kind == OperationKind.MethodBody) 125if (operation.Kind == OperationKind.AnonymousFunction)
Microsoft.AspNetCore.Mvc.Api.Analyzers (8)
ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzer.cs (8)
58if (parent.Kind == OperationKind.Block && parent.Parent != null) 63if (parent.Kind != OperationKind.MethodBodyOperation) 70if (trueStatement.Kind != OperationKind.Return) 131switch (condition.Kind) 164if (operation.Kind != OperationKind.Literal) 182if (operation.Kind != OperationKind.PropertyReference) 198if (propertyReference.Instance?.Kind != OperationKind.PropertyReference) 205if (modelStatePropertyReference.Instance?.Kind != OperationKind.InstanceReference)
Microsoft.CodeAnalysis (85)
DiagnosticAnalyzer\AnalysisContextInfo.cs (1)
85sb.AppendLine($"{nameof(IOperation)}: {_operation.Kind}");
DiagnosticAnalyzer\AnalyzerDriver.cs (4)
2953switch (operationBlock.Parent.Kind) 2964Debug.Assert(operationBlock.Kind is OperationKind.Invocation or OperationKind.Invalid); 2975Debug.Fail($"Expected operation with kind '{operationBlock.Kind}' to be the root operation with null 'Parent', but instead it has a non-null Parent with kind '{operationBlock.Parent.Kind}'");
DiagnosticAnalyzer\AnalyzerExecutor.cs (1)
1104if (operationActionsByKind.TryGetValue(operation.Kind, out var actionsForKind))
Operations\ControlFlowGraph.cs (2)
40Debug.Assert(parent != null == (originalOperation.Kind == OperationKind.LocalFunction || originalOperation.Kind == OperationKind.AnonymousFunction));
Operations\ControlFlowGraphBuilder.cs (74)
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, 103$"Unexpected root operation kind: {body.Kind}"); 108Debug.Assert(body.Kind == OperationKind.LocalFunction || body.Kind == OperationKind.AnonymousFunction); 124switch (body.Kind) 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) 2787switch (condition.Kind) 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) 3832switch (operation.Kind) 3849throw ExceptionUtilities.UnexpectedValue(operation.Kind); 3985Debug.Assert(resources.Kind != OperationKind.VariableDeclaration); 3986Debug.Assert(resources.Kind != OperationKind.VariableDeclarator); 4464if (!operation.Locals.IsEmpty && operation.LoopControlVariable.Kind == OperationKind.VariableDeclarator) 4656switch (operation.LoopControlVariable.Kind) 5355Debug.Assert(controlVariableReferenceForAssignment.Kind == OperationKind.FlowCaptureReference); 5425switch (operation.LoopControlVariable.Kind) 5739if (initialization.Length == 1 && initialization[0].Kind == OperationKind.VariableDeclarationGroup) 6047switch (innerInitializer.Kind) 6066Debug.Assert(validKinds.Contains(innerInitializer.Kind)); 6160switch (instance.Kind) 6167if (memberReference.Kind == OperationKind.PropertyReference) 6220Debug.Assert(instance.Kind == OperationKind.Invalid || instance.Kind == OperationKind.None); 6228switch (originalTarget.Kind) 6274throw ExceptionUtilities.UnexpectedValue(originalTarget.Kind); 6346throw ExceptionUtilities.UnexpectedValue(lhs.Kind); 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) 6914throw ExceptionUtilities.UnexpectedValue(currentAddition.Left.Kind); 6926throw ExceptionUtilities.UnexpectedValue(currentAddition.Left.Kind); 7033if (element.Kind == OperationKind.Interpolation) 7074throw ExceptionUtilities.UnexpectedValue(element.Kind); 7329switch (current.Kind) 7370operation.Kind, semanticModel: null, operation.Syntax, operation.Type, IsImplicit(operation)); 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\OperationMapBuilder.cs (2)
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 (1)
699Debug.Assert(statements.All(s => s.Parent != this && s.Parent!.Kind is OperationKind.Block or OperationKind.SwitchCase));
Microsoft.CodeAnalysis.CodeStyle (34)
src\Analyzers\Core\Analyzers\MakeFieldReadonly\AbstractMakeFieldReadonlyDiagnosticAnalyzer.cs (1)
281if (fieldReference.Instance?.Kind != OperationKind.InstanceReference ||
src\Analyzers\Core\Analyzers\QualifyMemberAccess\AbstractQualifyMemberAccessDiagnosticAnalyzer.cs (2)
84if (instanceOperation.Kind != OperationKind.InstanceReference) 88if (context.Operation.Parent?.Kind == OperationKind.PropertySubpattern)
src\Analyzers\Core\Analyzers\RemoveRedundantEquality\AbstractRemoveRedundantEqualityDiagnosticAnalyzer.cs (1)
126Kind: OperationKind.Literal,
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.BlockAnalyzer.cs (11)
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)) 368switch (operationBlock.Kind) 390if (operation.Kind == OperationKind.None) 665switch (assignmentValue.Kind) 676return fieldReference.Instance == null || fieldReference.Instance.Kind == OperationKind.InstanceReference;
src\Analyzers\Core\Analyzers\SimplifyInterpolation\AbstractSimplifyInterpolationHelpers.cs (1)
212: alignmentOp is { Kind: OperationKind.Literal })
src\Analyzers\Core\Analyzers\UseConditionalExpression\ForReturn\UseConditionalExpressionForReturnHelpers.cs (4)
89trueReturn.Kind != falseReturn.Kind) 96if (trueReturn?.Kind == OperationKind.YieldBreak) 103if (trueReturn?.Kind == OperationKind.YieldReturn &&
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ControlFlowGraphExtensions.cs (1)
32=> cfg.DescendantOperations().Where(d => d?.Kind == operationKind).Cast<T>();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (5)
21assignmentOperation.Parent?.Kind == OperationKind.ObjectOrCollectionInitializer; 241switch (operation.Kind) 265switch (current.Kind) 372=> operationBlocks.HasAnyOperationDescendant(predicate: operation => operation.Kind == 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\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.FlowGraphAnalysisData.cs (1)
192if (operation.Kind is OperationKind.LocalFunction or OperationKind.AnonymousFunction)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.Walker.cs (6)
154operation.Parent.Parent?.Kind != OperationKind.ExpressionStatement) 162Debug.Assert(symbolOpt != null || operation.Kind == OperationKind.FlowCaptureReference); 192operation.Parent?.Kind != OperationKind.ExpressionStatement; 196if (write.Kind != OperationKind.FlowCaptureReference) 437switch (currentOperation.Kind) 552switch (target.Kind)
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.CodeStyle (5)
src\Analyzers\CSharp\Analyzers\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyAnalyzer.cs (1)
287if (operation.Kind == OperationKind.None)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (4)
90Kind: OperationKind.MethodReference, 91Parent.Kind: OperationKind.DelegateCreation, 1126if (oldInterpolationPart.Kind != newInterpolationPart.Kind)
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 (67)
Diagnostics\GetDiagnosticsTests.cs (2)
1645AssertEx.All(analyzer.AnalyzedOperations, operation => operation.Kind == OperationKind.VariableDeclaration); 1649AssertEx.All(analyzer.AnalyzedOperationsInsideOperationBlock, operation => operation.Kind == OperationKind.VariableDeclaration);
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 (32)
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); 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); 5790Assert.Equal(OperationKind.ParameterInitializer, context.OperationBlocks[0].Kind); 5793Assert.Equal(OperationKind.Attribute, context.OperationBlocks[1].Kind);
Semantics\RecordTests.cs (30)
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); 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 (3)
ConvertIfToSwitch\CSharpConvertIfToSwitchCodeRefactoringProvider.Rewriting.cs (1)
66var v => throw ExceptionUtilities.UnexpectedValue(v.Kind)
ConvertLinq\CSharpConvertLinqQueryToForEachProvider.cs (1)
916return operation.Kind is OperationKind.LocalReference or OperationKind.ParameterReference;
src\Analyzers\CSharp\Analyzers\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyAnalyzer.cs (1)
287if (operation.Kind == OperationKind.None)
Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests (16)
IOperation\IOperationTests.cs (6)
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); 689Assert.Equal(expectedRootOperationKind, operation.Kind);
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 (4)
Semantics\DynamicTests.cs (1)
11420Assert.Equal(OperationKind.Invalid, model.GetOperation(call).Kind);
Semantics\RecordStructTests.cs (2)
6516Assert.Equal(OperationKind.ParameterInitializer, context.OperationBlocks[0].Kind); 6519Assert.Equal(OperationKind.Attribute, context.OperationBlocks[1].Kind);
Semantics\TopLevelStatementsTests.cs (1)
9681Assert.Equal(OperationKind.Literal, model.GetOperation(tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single()).Kind);
Microsoft.CodeAnalysis.CSharp.Workspaces (4)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (4)
90Kind: OperationKind.MethodReference, 91Parent.Kind: OperationKind.DelegateCreation, 1126if (oldInterpolationPart.Kind != newInterpolationPart.Kind)
Microsoft.CodeAnalysis.Features (28)
ConvertForEachToFor\AbstractConvertForEachToForCodeRefactoringProvider.cs (1)
374switch (operation.Kind)
ConvertIfToSwitch\AbstractConvertIfToSwitchCodeRefactoringProvider.cs (1)
144return op.Kind;
InitializeParameter\AbstractInitializeParameterCodeRefactoringProvider.cs (1)
169switch (operation.Kind)
InlineMethod\AbstractInlineMethodRefactoringProvider.InlineContext.cs (1)
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\MakeFieldReadonly\AbstractMakeFieldReadonlyDiagnosticAnalyzer.cs (1)
281if (fieldReference.Instance?.Kind != OperationKind.InstanceReference ||
src\Analyzers\Core\Analyzers\QualifyMemberAccess\AbstractQualifyMemberAccessDiagnosticAnalyzer.cs (2)
84if (instanceOperation.Kind != OperationKind.InstanceReference) 88if (context.Operation.Parent?.Kind == OperationKind.PropertySubpattern)
src\Analyzers\Core\Analyzers\RemoveRedundantEquality\AbstractRemoveRedundantEqualityDiagnosticAnalyzer.cs (1)
126Kind: OperationKind.Literal,
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.BlockAnalyzer.cs (11)
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)) 368switch (operationBlock.Kind) 390if (operation.Kind == OperationKind.None) 665switch (assignmentValue.Kind) 676return fieldReference.Instance == null || fieldReference.Instance.Kind == OperationKind.InstanceReference;
src\Analyzers\Core\Analyzers\SimplifyInterpolation\AbstractSimplifyInterpolationHelpers.cs (1)
212: alignmentOp is { Kind: OperationKind.Literal })
src\Analyzers\Core\Analyzers\UseConditionalExpression\ForReturn\UseConditionalExpressionForReturnHelpers.cs (4)
89trueReturn.Kind != falseReturn.Kind) 96if (trueReturn?.Kind == OperationKind.YieldBreak) 103if (trueReturn?.Kind == OperationKind.YieldReturn &&
src\Analyzers\Core\CodeFixes\UseConditionalExpression\ForReturn\AbstractUseConditionalExpressionForReturnCodeFixProvider.cs (1)
77var returnStatement = anyReturn.Kind == OperationKind.YieldReturn
Microsoft.CodeAnalysis.Test.Utilities (201)
Compilation\ControlFlowGraphVerifier.cs (11)
33operationRoot = operationRoot.Kind == OperationKind.Block && 34(operationRoot.Parent?.Kind == OperationKind.ConstructorBody || 35operationRoot.Parent?.Kind == OperationKind.MethodBody) ? 700query.Operation.Kind == OperationKind.AnonymousObjectCreation) 1524Assert.Equal(OperationKind.LocalFunction, g.OriginalOperation.Kind); 1634Assert.True(CanBeInControlFlowGraph(root), $"Unexpected node kind OperationKind.{root.Kind}"); 1642Assert.True(CanBeInControlFlowGraph(operation), $"Unexpected node kind OperationKind.{operation.Kind}"); 1826Assert.Equal(OperationKind.AnonymousFunction, g.OriginalOperation.Kind); 1835switch (n.Kind) 1897simpleAssignment.Parent.Kind == OperationKind.AnonymousObjectCreation); 1985Assert.True(false, $"Unhandled node kind OperationKind.{n.Kind}");
Compilation\OperationTreeVerifier.cs (12)
103LogString($"{nameof(OperationKind)}.{GetKindText(operation.Kind)}"); 180var operationKind = (int)operation.Kind; 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 (140)
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); 1705switch (operation.Value.Kind) 1718Assert.False(true, $"A {operation.Value.Kind} node should not be spilled or captured."); 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 (2)
45if (operation.Kind == OperationKind.Conversion) 58if (operation.Kind == OperationKind.Invocation)
Diagnostics\CommonDiagnosticAnalyzers.cs (1)
1392var diagnostic = Diagnostic.Create(Descriptor, c.OwningSymbol.Locations[0], c.OwningSymbol.Name, operationRoot.Kind);
Diagnostics\CouldHaveMoreSpecificTypeAnalyzer.cs (2)
239OperationKind targetKind = target.Kind; 281if (value.Kind == OperationKind.Conversion)
Diagnostics\FieldCouldBeReadOnlyAnalyzer.cs (2)
113if (target.Kind == OperationKind.FieldReference) 118switch (fieldReference.Instance.Kind)
Diagnostics\LocalCouldBeConstAnalyzer.cs (2)
116if (target.Kind == OperationKind.LocalReference) 123else if (target.Kind == OperationKind.FieldReference)
Diagnostics\OperationTestAnalyzer.cs (28)
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 && 716Report(operationContext, initializer.Syntax, initializer.Kind == OperationKind.FieldReference ? DoNotUseFieldInitializerDescriptor : DoNotUsePropertyInitializerDescriptor); 753var kind = assignment.Target.Kind; 899switch (operationContext.Operation.Kind) 1044if (eventAssignment.EventReference.Kind == OperationKind.Invalid || eventAssignment.HasErrors(operationContext.Compilation, operationContext.CancellationToken)) 1264if (addressOfOperation.Reference.Kind == OperationKind.Invalid && addressOfOperation.HasErrors(operationContext.Compilation, operationContext.CancellationToken)) 1328if (statement.Kind == OperationKind.None) 1381switch (operation.Kind) 1615if (left.Kind == OperationKind.LocalReference) 1620if (right.Kind == OperationKind.Literal) 1642if (operand.Kind == OperationKind.LocalReference) 1735if (operation.Kind == OperationKind.Argument) 1786if (operation.Kind == OperationKind.Binary) 1794else if (operation.Kind == OperationKind.Unary) 1802else if (operation.Kind == OperationKind.Increment)
Extensions\OperationExtensions.cs (1)
13switch (operation.Kind)
Microsoft.CodeAnalysis.Workspaces (16)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ControlFlowGraphExtensions.cs (1)
32=> cfg.DescendantOperations().Where(d => d?.Kind == operationKind).Cast<T>();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (5)
21assignmentOperation.Parent?.Kind == OperationKind.ObjectOrCollectionInitializer; 241switch (operation.Kind) 265switch (current.Kind) 372=> operationBlocks.HasAnyOperationDescendant(predicate: operation => operation.Kind == 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\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.FlowGraphAnalysisData.cs (1)
192if (operation.Kind is OperationKind.LocalFunction or OperationKind.AnonymousFunction)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.Walker.cs (6)
154operation.Parent.Parent?.Kind != OperationKind.ExpressionStatement) 162Debug.Assert(symbolOpt != null || operation.Kind == OperationKind.FlowCaptureReference); 192operation.Parent?.Kind != OperationKind.ExpressionStatement; 196if (write.Kind != OperationKind.FlowCaptureReference) 437switch (currentOperation.Kind) 552switch (target.Kind)
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)
Roslyn.Compilers.VisualBasic.IOperation.UnitTests (4)
IOperation\IOperationTests.vb (3)
65Assert.Equal(assignment1.Value.Kind, OperationKind.Binary) 98Assert.Equal(assignment2.Value.Kind, OperationKind.Binary) 131Assert.Equal(assignment3.Value.Kind, OperationKind.Unary)
IOperation\IOperationTests_IUsingStatement.vb (1)
85Assert.Equal(OperationKind.Invalid, op.Resources.Kind)
System.Private.CoreLib.Generators (2)
IntrinsicsInSystemPrivateCoreLibAnalyzer.cs (2)
493if (operationSearch.Kind == OperationKind.AnonymousFunction) 498if (operationSearch.Kind == OperationKind.LocalFunction)