133 implementations of Kind
Microsoft.CodeAnalysis (132)
Generated\Operations.Generated.cs (126)
4052
public override OperationKind
Kind
=> OperationKind.Block;
4107
public override OperationKind
Kind
=> OperationKind.VariableDeclarationGroup;
4177
public override OperationKind
Kind
=> OperationKind.Switch;
4283
public override OperationKind
Kind
=> OperationKind.Loop;
4375
public override OperationKind
Kind
=> OperationKind.Loop;
4487
public override OperationKind
Kind
=> OperationKind.Loop;
4511
public override OperationKind
Kind
=> OperationKind.Loop;
4564
public override OperationKind
Kind
=> OperationKind.Labeled;
4584
public override OperationKind
Kind
=> OperationKind.Branch;
4598
public override OperationKind
Kind
=> OperationKind.Empty;
4650
public override OperationKind
Kind
{ get; }
4714
public override OperationKind
Kind
=> OperationKind.Lock;
4793
public override OperationKind
Kind
=> OperationKind.Try;
4861
public override OperationKind
Kind
=> OperationKind.Using;
4912
public override OperationKind
Kind
=> OperationKind.ExpressionStatement;
4976
public override OperationKind
Kind
=> OperationKind.LocalFunction;
4990
public override OperationKind
Kind
=> OperationKind.Stop;
5004
public override OperationKind
Kind
=> OperationKind.End;
5070
public override OperationKind
Kind
=> OperationKind.RaiseEvent;
5088
public override OperationKind
Kind
=> OperationKind.Literal;
5148
public override OperationKind
Kind
=> OperationKind.Conversion;
5221
public override OperationKind
Kind
=> OperationKind.Invocation;
5288
public override OperationKind
Kind
=> OperationKind.ArrayElementReference;
5310
public override OperationKind
Kind
=> OperationKind.LocalReference;
5329
public override OperationKind
Kind
=> OperationKind.ParameterReference;
5394
public override OperationKind
Kind
=> OperationKind.FieldReference;
5450
public override OperationKind
Kind
=> OperationKind.MethodReference;
5519
public override OperationKind
Kind
=> OperationKind.PropertyReference;
5573
public override OperationKind
Kind
=> OperationKind.EventReference;
5636
public override OperationKind
Kind
=> OperationKind.Unary;
5714
public override OperationKind
Kind
=> OperationKind.Binary;
5791
public override OperationKind
Kind
=> OperationKind.Conditional;
5858
public override OperationKind
Kind
=> OperationKind.Coalesce;
5911
public override OperationKind
Kind
=> OperationKind.AnonymousFunction;
5981
public override OperationKind
Kind
=> OperationKind.ObjectCreation;
6033
public override OperationKind
Kind
=> OperationKind.TypeParameterObjectCreation;
6100
public override OperationKind
Kind
=> OperationKind.ArrayCreation;
6119
public override OperationKind
Kind
=> OperationKind.InstanceReference;
6175
public override OperationKind
Kind
=> OperationKind.IsType;
6227
public override OperationKind
Kind
=> OperationKind.Await;
6300
public override OperationKind
Kind
=> OperationKind.SimpleAssignment;
6375
public override OperationKind
Kind
=> OperationKind.CompoundAssignment;
6428
public override OperationKind
Kind
=> OperationKind.Parenthesized;
6493
public override OperationKind
Kind
=> OperationKind.EventAssignment;
6556
public override OperationKind
Kind
=> OperationKind.ConditionalAccess;
6573
public override OperationKind
Kind
=> OperationKind.ConditionalAccessInstance;
6630
public override OperationKind
Kind
=> OperationKind.InterpolatedString;
6686
public override OperationKind
Kind
=> OperationKind.AnonymousObjectCreation;
6742
public override OperationKind
Kind
=> OperationKind.ObjectOrCollectionInitializer;
6805
public override OperationKind
Kind
=> OperationKind.MemberInitializer;
6858
public override OperationKind
Kind
=> OperationKind.NameOf;
6916
public override OperationKind
Kind
=> OperationKind.Tuple;
6974
public override OperationKind
Kind
=> OperationKind.DynamicMemberReference;
7026
public override OperationKind
Kind
=> OperationKind.TranslatedQuery;
7078
public override OperationKind
Kind
=> OperationKind.DelegateCreation;
7096
public override OperationKind
Kind
=> OperationKind.DefaultValue;
7115
public override OperationKind
Kind
=> OperationKind.TypeOf;
7135
public override OperationKind
Kind
=> OperationKind.SizeOf;
7187
public override OperationKind
Kind
=> OperationKind.AddressOf;
7250
public override OperationKind
Kind
=> OperationKind.IsPattern;
7313
public override OperationKind
Kind
{ get; }
7365
public override OperationKind
Kind
=> OperationKind.Throw;
7424
public override OperationKind
Kind
=> OperationKind.DeconstructionAssignment;
7476
public override OperationKind
Kind
=> OperationKind.DeclarationExpression;
7493
public override OperationKind
Kind
=> OperationKind.OmittedArgument;
7555
public override OperationKind
Kind
=> OperationKind.FieldInitializer;
7602
public override OperationKind
Kind
=> OperationKind.VariableInitializer;
7653
public override OperationKind
Kind
=> OperationKind.PropertyInitializer;
7704
public override OperationKind
Kind
=> OperationKind.ParameterInitializer;
7759
public override OperationKind
Kind
=> OperationKind.ArrayInitializer;
7827
public override OperationKind
Kind
=> OperationKind.VariableDeclarator;
7908
public override OperationKind
Kind
=> OperationKind.VariableDeclaration;
7969
public override OperationKind
Kind
=> OperationKind.Argument;
8046
public override OperationKind
Kind
=> OperationKind.CatchClause;
8120
public override OperationKind
Kind
=> OperationKind.SwitchCase;
8144
public override OperationKind
Kind
=> OperationKind.CaseClause;
8207
public override OperationKind
Kind
=> OperationKind.CaseClause;
8269
public override OperationKind
Kind
=> OperationKind.CaseClause;
8322
public override OperationKind
Kind
=> OperationKind.CaseClause;
8373
public override OperationKind
Kind
=> OperationKind.CaseClause;
8429
public override OperationKind
Kind
=> OperationKind.InterpolatedStringText;
8502
public override OperationKind
Kind
=> OperationKind.Interpolation;
8564
public override OperationKind
Kind
=> OperationKind.ConstantPattern;
8586
public override OperationKind
Kind
=> OperationKind.DeclarationPattern;
8651
public override OperationKind
Kind
=> OperationKind.TupleBinary;
8718
public override OperationKind
Kind
=> OperationKind.MethodBody;
8789
public override OperationKind
Kind
=> OperationKind.ConstructorBody;
8808
public override OperationKind
Kind
=> OperationKind.Discard;
8861
public override OperationKind
Kind
=> OperationKind.FlowCapture;
8883
public override OperationKind
Kind
=> OperationKind.FlowCaptureReference;
8936
public override OperationKind
Kind
=> OperationKind.IsNull;
8953
public override OperationKind
Kind
=> OperationKind.CaughtException;
8972
public override OperationKind
Kind
=> OperationKind.StaticLocalInitializationSemaphore;
9031
public override OperationKind
Kind
=> OperationKind.CoalesceAssignment;
9098
public override OperationKind
Kind
=> OperationKind.Range;
9155
public override OperationKind
Kind
=> OperationKind.ReDim;
9221
public override OperationKind
Kind
=> OperationKind.ReDimClause;
9297
public override OperationKind
Kind
=> OperationKind.RecursivePattern;
9311
public override OperationKind
Kind
=> OperationKind.DiscardPattern;
9380
public override OperationKind
Kind
=> OperationKind.SwitchExpression;
9455
public override OperationKind
Kind
=> OperationKind.SwitchExpressionArm;
9517
public override OperationKind
Kind
=> OperationKind.PropertySubpattern;
9580
public override OperationKind
Kind
=> OperationKind.None;
9644
public override OperationKind
Kind
=> OperationKind.None;
9696
public override OperationKind
Kind
=> OperationKind.None;
9715
public override OperationKind
Kind
=> OperationKind.None;
9777
public override OperationKind
Kind
=> OperationKind.None;
9832
public override OperationKind
Kind
=> OperationKind.UsingDeclaration;
9883
public override OperationKind
Kind
=> OperationKind.NegatedPattern;
9947
public override OperationKind
Kind
=> OperationKind.BinaryPattern;
9965
public override OperationKind
Kind
=> OperationKind.TypePattern;
10018
public override OperationKind
Kind
=> OperationKind.RelationalPattern;
10083
public override OperationKind
Kind
=> OperationKind.With;
10150
public override OperationKind
Kind
=> OperationKind.InterpolatedStringHandlerCreation;
10212
public override OperationKind
Kind
=> OperationKind.InterpolatedStringAddition;
10264
public override OperationKind
Kind
{ get; }
10284
public override OperationKind
Kind
=> OperationKind.InterpolatedStringHandlerArgumentPlaceholder;
10351
public override OperationKind
Kind
=> OperationKind.FunctionPointerInvocation;
10412
public override OperationKind
Kind
=> OperationKind.ListPattern;
10465
public override OperationKind
Kind
=> OperationKind.SlicePattern;
10532
public override OperationKind
Kind
=> OperationKind.ImplicitIndexerReference;
10551
public override OperationKind
Kind
=> OperationKind.Utf8String;
10602
public override OperationKind
Kind
=> OperationKind.Attribute;
10665
public override OperationKind
Kind
=> OperationKind.InlineArrayAccess;
10723
public override OperationKind
Kind
=> OperationKind.CollectionExpression;
10779
public override OperationKind
Kind
=> OperationKind.Spread;
Operations\Operation.cs (1)
65
public abstract OperationKind
Kind
{ get; }
Operations\OperationNodes.cs (5)
137
public override OperationKind
Kind
=> OperationKind.Invalid;
168
public override OperationKind
Kind
=> OperationKind.FlowAnonymousFunction;
260
public override OperationKind
Kind
=> OperationKind.DynamicObjectCreation;
402
public override OperationKind
Kind
=> OperationKind.DynamicInvocation;
424
public override OperationKind
Kind
=> OperationKind.DynamicIndexerAccess;
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (1)
Semantics\CollectionExpressionTests.cs (1)
27157
OperationKind 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)
86
switch (operation.
Kind
)
CallAnalysis\Fixers\LegacyLoggingFixer.cs (1)
368
if (invocationOp.Parent?.
Kind
== OperationKind.ConditionalAccess)
CallAnalysis\Fixers\LegacyLoggingFixer.FixDetails.cs (2)
106
var op = invocationOp.Arguments[LogLevelParamIndex].Descendants().SingleOrDefault(x => x.
Kind
== OperationKind.Literal || x.
Kind
== OperationKind.FieldReference);
CoalesceAnalyzer.cs (2)
39
if (op.Target.
Kind
== OperationKind.ParameterReference)
66
if (op.Value.
Kind
== OperationKind.ParameterReference)
ConditionalAccessAnalyzer.cs (2)
37
switch (op.Operation.
Kind
)
98
if (op.Operation.
Kind
== OperationKind.ParameterReference)
Microsoft.AspNetCore.App.Analyzers (4)
Http\RequestDelegateReturnTypeAnalyzer.cs (2)
32
parent.
Kind
== OperationKind.DelegateCreation &&
48
parent.
Kind
== OperationKind.DelegateCreation &&
RouteHandlers\RouteHandlerAnalyzer.cs (2)
105
if (delegateCreation.Target.
Kind
== OperationKind.AnonymousFunction)
115
else if (delegateCreation.Target.
Kind
== OperationKind.MethodReference)
Microsoft.AspNetCore.Components.Analyzers (2)
ComponentParameterUsageAnalyzer.cs (1)
59
if (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)
59
if (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)
48
if (awaitOperation.Operation.
Kind
!= OperationKind.Invocation)
115
if (operation.
Kind
== OperationKind.LocalFunction)
120
if (operation.
Kind
== OperationKind.MethodBody)
125
if (operation.
Kind
== OperationKind.AnonymousFunction)
Microsoft.AspNetCore.Mvc.Api.Analyzers (8)
ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzer.cs (8)
58
if (parent.
Kind
== OperationKind.Block && parent.Parent != null)
63
if (parent.
Kind
!= OperationKind.MethodBodyOperation)
70
if (trueStatement.
Kind
!= OperationKind.Return)
131
switch (condition.
Kind
)
164
if (operation.
Kind
!= OperationKind.Literal)
182
if (operation.
Kind
!= OperationKind.PropertyReference)
198
if (propertyReference.Instance?.
Kind
!= OperationKind.PropertyReference)
205
if (modelStatePropertyReference.Instance?.
Kind
!= OperationKind.InstanceReference)
Microsoft.CodeAnalysis (85)
DiagnosticAnalyzer\AnalysisContextInfo.cs (1)
85
sb.AppendLine($"{nameof(IOperation)}: {_operation.
Kind
}");
DiagnosticAnalyzer\AnalyzerDriver.cs (4)
2953
switch (operationBlock.Parent.
Kind
)
2964
Debug.Assert(operationBlock.
Kind
is OperationKind.Invocation or OperationKind.Invalid);
2975
Debug.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)
1104
if (operationActionsByKind.TryGetValue(operation.
Kind
, out var actionsForKind))
Operations\ControlFlowGraph.cs (2)
40
Debug.Assert(parent != null == (originalOperation.
Kind
== OperationKind.LocalFunction || originalOperation.
Kind
== OperationKind.AnonymousFunction));
Operations\ControlFlowGraphBuilder.cs (74)
96
Debug.Assert(body.
Kind
== OperationKind.Block ||
97
body.
Kind
== OperationKind.MethodBody ||
98
body.
Kind
== OperationKind.ConstructorBody ||
99
body.
Kind
== OperationKind.FieldInitializer ||
100
body.
Kind
== OperationKind.PropertyInitializer ||
101
body.
Kind
== OperationKind.ParameterInitializer ||
102
body.
Kind
== OperationKind.Attribute,
103
$"Unexpected root operation kind: {body.
Kind
}");
108
Debug.Assert(body.
Kind
== OperationKind.LocalFunction || body.
Kind
== OperationKind.AnonymousFunction);
124
switch (body.
Kind
)
861
value.
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));
1619
if (operation.WhenTrue is IConversionOperation whenTrueConversion && whenTrueConversion.Operand.
Kind
== OperationKind.Throw)
1622
Debug.Assert(rewrittenThrow!.
Kind
== OperationKind.None);
1631
else if (operation.WhenFalse is IConversionOperation whenFalseConversion && whenFalseConversion.Operand.
Kind
== OperationKind.Throw)
1640
Debug.Assert(rewrittenThrow.
Kind
== OperationKind.None);
1687
if (result.
Kind
!= OperationKind.FlowCaptureReference ||
1849
if (operationOpt.
Kind
!= OperationKind.FlowCaptureReference
1850
&& operationOpt.
Kind
!= OperationKind.DeclarationExpression
1851
&& operationOpt.
Kind
!= OperationKind.Discard
1852
&& operationOpt.
Kind
!= OperationKind.OmittedArgument)
2725
if (condition.
Kind
== OperationKind.Binary)
2787
switch (condition.
Kind
)
2925
if (conversion.Operand.
Kind
== OperationKind.Throw)
2929
Debug.Assert(rewrittenThrow.
Kind
== OperationKind.None);
2952
while (condition.
Kind
== OperationKind.Parenthesized)
3045
bool alternativeThrows = conversion?.Operand.
Kind
== OperationKind.Throw;
3071
Debug.Assert(rewrittenThrow.
Kind
== OperationKind.None);
3104
bool isStatement = _currentStatement == operation || operation.Parent.
Kind
== OperationKind.ExpressionStatement;
3367
bool isOnStatementLevel = _currentStatement == operation || (_currentStatement == operation.Parent && _currentStatement?.
Kind
== OperationKind.ExpressionStatement);
3562
Debug.Assert(operation.Operation.
Kind
== OperationKind.ConditionalAccess || operation.Operation.
Kind
== OperationKind.CoalesceAssignment);
3565
else if (operation.Operation.
Kind
== OperationKind.Throw)
3791
if (exceptionDeclarationOrExpression.
Kind
== OperationKind.VariableDeclarator)
3832
switch (operation.
Kind
)
3849
throw ExceptionUtilities.UnexpectedValue(operation.
Kind
);
3985
Debug.Assert(resources.
Kind
!= OperationKind.VariableDeclaration);
3986
Debug.Assert(resources.
Kind
!= OperationKind.VariableDeclarator);
4464
if (!operation.Locals.IsEmpty && operation.LoopControlVariable.
Kind
== OperationKind.VariableDeclarator)
4656
switch (operation.LoopControlVariable.
Kind
)
5355
Debug.Assert(controlVariableReferenceForAssignment.
Kind
== OperationKind.FlowCaptureReference);
5425
switch (operation.LoopControlVariable.
Kind
)
5739
if (initialization.Length == 1 && initialization[0].
Kind
== OperationKind.VariableDeclarationGroup)
6047
switch (innerInitializer.
Kind
)
6066
Debug.Assert(validKinds.Contains(innerInitializer.
Kind
));
6160
switch (instance.
Kind
)
6167
if (memberReference.
Kind
== OperationKind.PropertyReference)
6220
Debug.Assert(instance.
Kind
== OperationKind.Invalid || instance.
Kind
== OperationKind.None);
6228
switch (originalTarget.
Kind
)
6274
throw ExceptionUtilities.UnexpectedValue(originalTarget.
Kind
);
6346
throw ExceptionUtilities.UnexpectedValue(lhs.
Kind
);
6395
Debug.Assert(propertyReference.Instance.
Kind
== OperationKind.InstanceReference);
6506
if (elementValue.
Kind
== OperationKind.ArrayInitializer)
6525
if (elementValue.
Kind
== OperationKind.ArrayInitializer)
6612
if (operation.Operation.
Kind
== OperationKind.DynamicMemberReference)
6628
if (operation.Operation.
Kind
== OperationKind.DynamicMemberReference)
6673
if (value.
Kind
== OperationKind.Tuple)
6693
if (value.
Kind
== OperationKind.Tuple)
6914
throw ExceptionUtilities.UnexpectedValue(currentAddition.Left.
Kind
);
6926
throw ExceptionUtilities.UnexpectedValue(currentAddition.Left.
Kind
);
7033
if (element.
Kind
== OperationKind.Interpolation)
7074
throw ExceptionUtilities.UnexpectedValue(element.
Kind
);
7329
switch (current.
Kind
)
7370
operation.
Kind
, semanticModel: null, operation.Syntax, operation.Type, IsImplicit(operation));
7448
if (children.Count != 0 && children.Last().
Kind
== OperationKind.ObjectOrCollectionInitializer)
7823
if (statement.
Kind
== OperationKind.LocalFunction)
7987
if (simpleAssignment.Target.
Kind
!= OperationKind.PropertyReference)
7999
Debug.Assert(propertyReference.Instance.
Kind
== OperationKind.InstanceReference);
8080
if (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)
699
Debug.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)
281
if (fieldReference.Instance?.
Kind
!= OperationKind.InstanceReference ||
src\Analyzers\Core\Analyzers\QualifyMemberAccess\AbstractQualifyMemberAccessDiagnosticAnalyzer.cs (2)
84
if (instanceOperation.
Kind
!= OperationKind.InstanceReference)
88
if (context.Operation.Parent?.
Kind
== OperationKind.PropertySubpattern)
src\Analyzers\Core\Analyzers\RemoveRedundantEquality\AbstractRemoveRedundantEqualityDiagnosticAnalyzer.cs (1)
126
Kind
: OperationKind.Literal,
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.BlockAnalyzer.cs (11)
259
Debug.Assert(operation.
Kind
is OperationKind.DelegateCreation or OperationKind.AnonymousFunction);
275
(assignment.Target.
Kind
== OperationKind.LocalReference ||
276
assignment.Target.
Kind
== OperationKind.ParameterReference))
284
if (operation.
Kind
== OperationKind.AnonymousFunction &&
308
Debug.Assert(operation.
Kind
is OperationKind.LocalReference or OperationKind.ParameterReference);
342
(assignmentOperation.Target.
Kind
== OperationKind.LocalReference ||
343
assignmentOperation.Target.
Kind
== OperationKind.ParameterReference))
368
switch (operationBlock.
Kind
)
390
if (operation.
Kind
== OperationKind.None)
665
switch (assignmentValue.
Kind
)
676
return 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)
89
trueReturn.
Kind
!= falseReturn.
Kind
)
96
if (trueReturn?.
Kind
== OperationKind.YieldBreak)
103
if (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)
21
assignmentOperation.Parent?.
Kind
== OperationKind.ObjectOrCollectionInitializer;
241
switch (operation.
Kind
)
265
switch (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)
192
if (operation.
Kind
is OperationKind.LocalFunction or OperationKind.AnonymousFunction)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.Walker.cs (6)
154
operation.Parent.Parent?.
Kind
!= OperationKind.ExpressionStatement)
162
Debug.Assert(symbolOpt != null || operation.
Kind
== OperationKind.FlowCaptureReference);
192
operation.Parent?.
Kind
!= OperationKind.ExpressionStatement;
196
if (write.
Kind
!= OperationKind.FlowCaptureReference)
437
switch (currentOperation.
Kind
)
552
switch (target.
Kind
)
Microsoft.CodeAnalysis.CodeStyle.Fixes (3)
src\Analyzers\Core\CodeFixes\UseConditionalExpression\ForReturn\AbstractUseConditionalExpressionForReturnCodeFixProvider.cs (1)
77
var returnStatement = anyReturn.
Kind
== OperationKind.YieldReturn
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_Negate.cs (2)
479
if (operation?.
Kind
== OperationKind.Literal && operation.ConstantValue.HasValue && operation.ConstantValue.Value is true)
483
else 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)
287
if (operation.
Kind
== OperationKind.None)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (4)
90
Kind
: OperationKind.MethodReference,
91
Parent.
Kind
: OperationKind.DelegateCreation,
1126
if (oldInterpolationPart.
Kind
!= newInterpolationPart.
Kind
)
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (2)
CodeGen\CodeGenLocalFunctionTests.cs (2)
161
Assert.Equal(OperationKind.ExpressionStatement, objectCreationOperation.Parent.
Kind
);
162
Assert.Equal(OperationKind.Block, objectCreationOperation.Parent.Parent.
Kind
);
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (67)
Diagnostics\GetDiagnosticsTests.cs (2)
1645
AssertEx.All(analyzer.AnalyzedOperations, operation => operation.
Kind
== OperationKind.VariableDeclaration);
1649
AssertEx.All(analyzer.AnalyzedOperationsInsideOperationBlock, operation => operation.
Kind
== OperationKind.VariableDeclaration);
Semantics\OutVarTests.cs (3)
35951
Assert.Equal(OperationKind.ExpressionStatement, initializerOperation.Parent.
Kind
);
35974
Assert.Equal(OperationKind.ConstructorBody, blockBodyOperation.Parent.
Kind
);
36095
Assert.Equal(OperationKind.MethodBody, expressionBodyOperation.Parent.
Kind
);
Semantics\PrimaryConstructorTests.cs (32)
4515
Assert.Equal(OperationKind.ParameterInitializer, context.OperationBlocks[0].
Kind
);
4518
Assert.Equal(OperationKind.Attribute, context.OperationBlocks[1].
Kind
);
4526
Assert.Equal(OperationKind.ParameterInitializer, context.OperationBlocks[0].
Kind
);
4529
Assert.Equal(OperationKind.Attribute, context.OperationBlocks[1].
Kind
);
4532
Assert.Equal(OperationKind.Invocation, context.OperationBlocks[2].
Kind
);
4540
Assert.Equal(OperationKind.ParameterInitializer, context.OperationBlocks[0].
Kind
);
4543
Assert.Equal(OperationKind.Attribute, context.OperationBlocks[1].
Kind
);
4546
Assert.Equal(OperationKind.Block, context.OperationBlocks[2].
Kind
);
4548
Assert.Equal(OperationKind.Invocation, context.OperationBlocks[3].
Kind
);
4555
Assert.Equal(OperationKind.Block, context.OperationBlocks[0].
Kind
);
4649
Assert.Equal(OperationKind.ParameterInitializer, context.OperationBlocks[0].
Kind
);
4652
Assert.Equal(OperationKind.Attribute, context.OperationBlocks[1].
Kind
);
4662
Assert.Equal(OperationKind.ParameterInitializer, context.OperationBlocks[0].
Kind
);
4665
Assert.Equal(OperationKind.Attribute, context.OperationBlocks[1].
Kind
);
4668
Assert.Equal(OperationKind.Invocation, context.OperationBlocks[2].
Kind
);
4678
Assert.Equal(OperationKind.ParameterInitializer, context.OperationBlocks[0].
Kind
);
4681
Assert.Equal(OperationKind.Attribute, context.OperationBlocks[1].
Kind
);
4684
Assert.Equal(OperationKind.Block, context.OperationBlocks[2].
Kind
);
4686
Assert.Equal(OperationKind.Invocation, context.OperationBlocks[3].
Kind
);
4695
Assert.Equal(OperationKind.Block, context.OperationBlocks[0].
Kind
);
4723
Assert.Equal(OperationKind.ParameterInitializer, context.OperationBlocks[0].
Kind
);
4726
Assert.Equal(OperationKind.Attribute, context.OperationBlocks[1].
Kind
);
4734
Assert.Equal(OperationKind.ParameterInitializer, context.OperationBlocks[0].
Kind
);
4737
Assert.Equal(OperationKind.Attribute, context.OperationBlocks[1].
Kind
);
4740
Assert.Equal(OperationKind.Invocation, context.OperationBlocks[2].
Kind
);
4748
Assert.Equal(OperationKind.ParameterInitializer, context.OperationBlocks[0].
Kind
);
4751
Assert.Equal(OperationKind.Attribute, context.OperationBlocks[1].
Kind
);
4754
Assert.Equal(OperationKind.Block, context.OperationBlocks[2].
Kind
);
4756
Assert.Equal(OperationKind.Invocation, context.OperationBlocks[3].
Kind
);
4763
Assert.Equal(OperationKind.Block, context.OperationBlocks[0].
Kind
);
5790
Assert.Equal(OperationKind.ParameterInitializer, context.OperationBlocks[0].
Kind
);
5793
Assert.Equal(OperationKind.Attribute, context.OperationBlocks[1].
Kind
);
Semantics\RecordTests.cs (30)
26978
Assert.Equal(OperationKind.ParameterInitializer, context.OperationBlocks[0].
Kind
);
26981
Assert.Equal(OperationKind.Attribute, context.OperationBlocks[1].
Kind
);
26989
Assert.Equal(OperationKind.ParameterInitializer, context.OperationBlocks[0].
Kind
);
26992
Assert.Equal(OperationKind.Attribute, context.OperationBlocks[1].
Kind
);
26995
Assert.Equal(OperationKind.Invocation, context.OperationBlocks[2].
Kind
);
27003
Assert.Equal(OperationKind.ParameterInitializer, context.OperationBlocks[0].
Kind
);
27006
Assert.Equal(OperationKind.Attribute, context.OperationBlocks[1].
Kind
);
27009
Assert.Equal(OperationKind.Block, context.OperationBlocks[2].
Kind
);
27011
Assert.Equal(OperationKind.Invocation, context.OperationBlocks[3].
Kind
);
27018
Assert.Equal(OperationKind.Block, context.OperationBlocks[0].
Kind
);
27112
Assert.Equal(OperationKind.ParameterInitializer, context.OperationBlocks[0].
Kind
);
27115
Assert.Equal(OperationKind.Attribute, context.OperationBlocks[1].
Kind
);
27125
Assert.Equal(OperationKind.ParameterInitializer, context.OperationBlocks[0].
Kind
);
27128
Assert.Equal(OperationKind.Attribute, context.OperationBlocks[1].
Kind
);
27131
Assert.Equal(OperationKind.Invocation, context.OperationBlocks[2].
Kind
);
27141
Assert.Equal(OperationKind.ParameterInitializer, context.OperationBlocks[0].
Kind
);
27144
Assert.Equal(OperationKind.Attribute, context.OperationBlocks[1].
Kind
);
27147
Assert.Equal(OperationKind.Block, context.OperationBlocks[2].
Kind
);
27149
Assert.Equal(OperationKind.Invocation, context.OperationBlocks[3].
Kind
);
27158
Assert.Equal(OperationKind.Block, context.OperationBlocks[0].
Kind
);
27186
Assert.Equal(OperationKind.ParameterInitializer, context.OperationBlocks[0].
Kind
);
27189
Assert.Equal(OperationKind.Attribute, context.OperationBlocks[1].
Kind
);
27197
Assert.Equal(OperationKind.ParameterInitializer, context.OperationBlocks[0].
Kind
);
27200
Assert.Equal(OperationKind.Attribute, context.OperationBlocks[1].
Kind
);
27203
Assert.Equal(OperationKind.Invocation, context.OperationBlocks[2].
Kind
);
27211
Assert.Equal(OperationKind.ParameterInitializer, context.OperationBlocks[0].
Kind
);
27214
Assert.Equal(OperationKind.Attribute, context.OperationBlocks[1].
Kind
);
27217
Assert.Equal(OperationKind.Block, context.OperationBlocks[2].
Kind
);
27219
Assert.Equal(OperationKind.Invocation, context.OperationBlocks[3].
Kind
);
27226
Assert.Equal(OperationKind.Block, context.OperationBlocks[0].
Kind
);
Microsoft.CodeAnalysis.CSharp.Features (3)
ConvertIfToSwitch\CSharpConvertIfToSwitchCodeRefactoringProvider.Rewriting.cs (1)
66
var v => throw ExceptionUtilities.UnexpectedValue(v.
Kind
)
ConvertLinq\CSharpConvertLinqQueryToForEachProvider.cs (1)
916
return operation.
Kind
is OperationKind.LocalReference or OperationKind.ParameterReference;
src\Analyzers\CSharp\Analyzers\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyAnalyzer.cs (1)
287
if (operation.
Kind
== OperationKind.None)
Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests (16)
IOperation\IOperationTests.cs (6)
467
Assert.Equal(OperationKind.DeconstructionAssignment, operation1.
Kind
);
473
Assert.Equal(OperationKind.DeconstructionAssignment, operation2.
Kind
);
479
Assert.Equal(OperationKind.DeconstructionAssignment, operation3.
Kind
);
513
Assert.Equal(OperationKind.ExpressionStatement, operation.
Kind
);
562
Assert.Equal(OperationKind.FieldReference, operation.
Kind
);
689
Assert.Equal(expectedRootOperationKind, operation.
Kind
);
IOperation\IOperationTests_IConversionExpression.cs (2)
184
Assert.Equal(OperationKind.Invalid, initializerOperation.
Kind
);
5351
if (operation.
Kind
== OperationKind.Conversion)
IOperation\IOperationTests_IVariableDeclaration.cs (8)
614
Assert.Equal(OperationKind.Literal, declarator.ChildOperations.First().
Kind
);
615
Assert.Equal(OperationKind.VariableInitializer, declarator.ChildOperations.ElementAt(1).
Kind
);
636
Assert.Equal(OperationKind.Literal, declarator.ChildOperations.First().
Kind
);
657
Assert.Equal(OperationKind.VariableInitializer, declarator.ChildOperations.ElementAt(0).
Kind
);
852
Assert.Equal(OperationKind.Literal, declaration.ChildOperations.First().
Kind
);
853
Assert.Equal(OperationKind.VariableDeclarator, declaration.ChildOperations.ElementAt(1).
Kind
);
874
Assert.Equal(OperationKind.Literal, declaration.ChildOperations.First().
Kind
);
875
Assert.Equal(OperationKind.VariableDeclarator, declaration.ChildOperations.ElementAt(1).
Kind
);
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (4)
Semantics\DynamicTests.cs (1)
11420
Assert.Equal(OperationKind.Invalid, model.GetOperation(call).
Kind
);
Semantics\RecordStructTests.cs (2)
6516
Assert.Equal(OperationKind.ParameterInitializer, context.OperationBlocks[0].
Kind
);
6519
Assert.Equal(OperationKind.Attribute, context.OperationBlocks[1].
Kind
);
Semantics\TopLevelStatementsTests.cs (1)
9681
Assert.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)
90
Kind
: OperationKind.MethodReference,
91
Parent.
Kind
: OperationKind.DelegateCreation,
1126
if (oldInterpolationPart.
Kind
!= newInterpolationPart.
Kind
)
Microsoft.CodeAnalysis.Features (28)
ConvertForEachToFor\AbstractConvertForEachToForCodeRefactoringProvider.cs (1)
374
switch (operation.
Kind
)
ConvertIfToSwitch\AbstractConvertIfToSwitchCodeRefactoringProvider.cs (1)
144
return op.
Kind
;
InitializeParameter\AbstractInitializeParameterCodeRefactoringProvider.cs (1)
169
switch (operation.
Kind
)
InlineMethod\AbstractInlineMethodRefactoringProvider.InlineContext.cs (1)
421
if (operation.
Kind
is OperationKind.AnonymousFunction or OperationKind.LocalFunction)
IntroduceParameter\AbstractIntroduceParameterCodeRefactoringProvider.cs (1)
228
containsClassSpecificStatement = operation.Descendants().Any(op => op.
Kind
== OperationKind.InstanceReference);
IntroduceUsingStatement\AbstractIntroduceUsingStatementCodeRefactoringProvider.cs (1)
91
if (initializer is null || initializer.
Kind
== OperationKind.Invalid)
IntroduceVariable\AbstractIntroduceVariableService.cs (1)
372
memberReferenceOperation.Instance?.
Kind
== OperationKind.InstanceReference;
src\Analyzers\Core\Analyzers\MakeFieldReadonly\AbstractMakeFieldReadonlyDiagnosticAnalyzer.cs (1)
281
if (fieldReference.Instance?.
Kind
!= OperationKind.InstanceReference ||
src\Analyzers\Core\Analyzers\QualifyMemberAccess\AbstractQualifyMemberAccessDiagnosticAnalyzer.cs (2)
84
if (instanceOperation.
Kind
!= OperationKind.InstanceReference)
88
if (context.Operation.Parent?.
Kind
== OperationKind.PropertySubpattern)
src\Analyzers\Core\Analyzers\RemoveRedundantEquality\AbstractRemoveRedundantEqualityDiagnosticAnalyzer.cs (1)
126
Kind
: OperationKind.Literal,
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.BlockAnalyzer.cs (11)
259
Debug.Assert(operation.
Kind
is OperationKind.DelegateCreation or OperationKind.AnonymousFunction);
275
(assignment.Target.
Kind
== OperationKind.LocalReference ||
276
assignment.Target.
Kind
== OperationKind.ParameterReference))
284
if (operation.
Kind
== OperationKind.AnonymousFunction &&
308
Debug.Assert(operation.
Kind
is OperationKind.LocalReference or OperationKind.ParameterReference);
342
(assignmentOperation.Target.
Kind
== OperationKind.LocalReference ||
343
assignmentOperation.Target.
Kind
== OperationKind.ParameterReference))
368
switch (operationBlock.
Kind
)
390
if (operation.
Kind
== OperationKind.None)
665
switch (assignmentValue.
Kind
)
676
return 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)
89
trueReturn.
Kind
!= falseReturn.
Kind
)
96
if (trueReturn?.
Kind
== OperationKind.YieldBreak)
103
if (trueReturn?.
Kind
== OperationKind.YieldReturn &&
src\Analyzers\Core\CodeFixes\UseConditionalExpression\ForReturn\AbstractUseConditionalExpressionForReturnCodeFixProvider.cs (1)
77
var returnStatement = anyReturn.
Kind
== OperationKind.YieldReturn
Microsoft.CodeAnalysis.Test.Utilities (201)
Compilation\ControlFlowGraphVerifier.cs (11)
33
operationRoot = operationRoot.
Kind
== OperationKind.Block &&
34
(operationRoot.Parent?.
Kind
== OperationKind.ConstructorBody ||
35
operationRoot.Parent?.
Kind
== OperationKind.MethodBody) ?
700
query.Operation.
Kind
== OperationKind.AnonymousObjectCreation)
1524
Assert.Equal(OperationKind.LocalFunction, g.OriginalOperation.
Kind
);
1634
Assert.True(CanBeInControlFlowGraph(root), $"Unexpected node kind OperationKind.{root.
Kind
}");
1642
Assert.True(CanBeInControlFlowGraph(operation), $"Unexpected node kind OperationKind.{operation.
Kind
}");
1826
Assert.Equal(OperationKind.AnonymousFunction, g.OriginalOperation.
Kind
);
1835
switch (n.
Kind
)
1897
simpleAssignment.Parent.
Kind
== OperationKind.AnonymousObjectCreation);
1985
Assert.True(false, $"Unhandled node kind OperationKind.{n.
Kind
}");
Compilation\OperationTreeVerifier.cs (12)
103
LogString($"{nameof(OperationKind)}.{GetKindText(operation.
Kind
)}");
180
var operationKind = (int)operation.
Kind
;
400
if (!children.IsEmpty || operation.
Kind
!= OperationKind.None)
627
Assert.Equal(OperationKind.Loop, operation.
Kind
);
760
Assert.NotEqual(OperationKind.VariableDeclaration, operation.Resources.
Kind
);
761
Assert.NotEqual(OperationKind.VariableDeclarator, operation.Resources.
Kind
);
1461
Assert.Equal(OperationKind.InstanceReference, propertyReference.Instance.
Kind
);
1823
Assert.Equal(OperationKind.CaseClause, operation.
Kind
);
1911
if (operation.Text.
Kind
!= OperationKind.Literal)
1913
Assert.Equal(OperationKind.Literal, ((IConversionOperation)operation.Text).Operand.
Kind
);
1927
if (operation.FormatString != null && operation.FormatString.
Kind
!= OperationKind.Literal)
1929
Assert.Equal(OperationKind.Literal, ((IConversionOperation)operation.FormatString).Operand.
Kind
);
Compilation\TestOperationVisitor.cs (140)
39
Assert.Equal(OperationKind.None, operation.
Kind
);
55
Assert.Equal(OperationKind.None, operation.
Kind
);
119
Assert.Equal(OperationKind.Block, operation.
Kind
);
127
Assert.Equal(OperationKind.VariableDeclarationGroup, operation.
Kind
);
133
Assert.Equal(OperationKind.VariableDeclarator, operation.
Kind
);
148
Assert.Equal(OperationKind.VariableDeclaration, operation.
Kind
);
162
Assert.Equal(OperationKind.Switch, operation.
Kind
);
170
Assert.Equal(OperationKind.SwitchCase, operation.
Kind
);
222
Assert.Equal(OperationKind.CaseClause, operation.
Kind
);
359
Assert.Equal(OperationKind.Loop, operation.
Kind
);
367
Assert.Equal(OperationKind.Labeled, operation.
Kind
);
382
Assert.Equal(OperationKind.Branch, operation.
Kind
);
401
Assert.Equal(OperationKind.Empty, operation.
Kind
);
407
Assert.Contains(operation.
Kind
, new[] { OperationKind.Return, OperationKind.YieldReturn, OperationKind.YieldBreak });
410
Assert.NotEqual(OperationKind.YieldReturn, operation.
Kind
);
421
Assert.Equal(OperationKind.Lock, operation.
Kind
);
427
Assert.Equal(OperationKind.Try, operation.
Kind
);
441
Assert.Equal(OperationKind.CatchClause, operation.
Kind
);
462
Assert.Equal(OperationKind.Using, operation.
Kind
);
465
Assert.NotEqual(OperationKind.VariableDeclaration, operation.Resources.
Kind
);
466
Assert.NotEqual(OperationKind.VariableDeclarator, operation.Resources.
Kind
);
482
Assert.Equal(OperationKind.None, operation.
Kind
);
489
Assert.Equal(OperationKind.CollectionExpression, operation.
Kind
);
495
Assert.Equal(OperationKind.Spread, operation.
Kind
);
501
Assert.Equal(OperationKind.None, operation.
Kind
);
507
Assert.Equal(OperationKind.ExpressionStatement, operation.
Kind
);
513
Assert.Equal(OperationKind.None, operation.
Kind
);
519
Assert.Equal(OperationKind.Stop, operation.
Kind
);
525
Assert.Equal(OperationKind.End, operation.
Kind
);
531
Assert.Equal(OperationKind.Invocation, operation.
Kind
);
564
Assert.Equal(OperationKind.FunctionPointerInvocation, operation.
Kind
);
578
Assert.Equal(OperationKind.Argument, operation.
Kind
);
594
Assert.Equal(OperationKind.OmittedArgument, operation.
Kind
);
600
Assert.Equal(OperationKind.ArrayElementReference, operation.
Kind
);
606
Assert.Equal(OperationKind.ImplicitIndexerReference, operation.
Kind
);
615
Assert.Equal(OperationKind.InlineArrayAccess, operation.
Kind
);
621
Assert.Equal(OperationKind.None, operation.
Kind
);
627
Assert.Equal(OperationKind.LocalReference, operation.
Kind
);
635
Assert.Equal(OperationKind.ParameterReference, operation.
Kind
);
642
Assert.Equal(OperationKind.InstanceReference, operation.
Kind
);
681
Assert.Equal(OperationKind.FieldReference, operation.
Kind
);
691
Assert.Equal(OperationKind.MethodReference, operation.
Kind
);
705
Assert.Equal(OperationKind.PropertyReference, operation.
Kind
);
713
Assert.Equal(OperationKind.EventReference, operation.
Kind
);
721
Assert.Equal(OperationKind.EventAssignment, operation.
Kind
);
728
Assert.Equal(OperationKind.ConditionalAccess, operation.
Kind
);
735
Assert.Equal(OperationKind.ConditionalAccessInstance, operation.
Kind
);
741
Assert.Equal(OperationKind.None, operation.
Kind
);
747
Assert.Equal(OperationKind.UnaryOperator, operation.
Kind
);
748
Assert.Equal(OperationKind.Unary, operation.
Kind
);
762
Assert.Equal(OperationKind.BinaryOperator, operation.
Kind
);
763
Assert.Equal(OperationKind.Binary, operation.
Kind
);
831
Assert.Equal(OperationKind.TupleBinaryOperator, operation.
Kind
);
832
Assert.Equal(OperationKind.TupleBinary, operation.
Kind
);
840
Assert.Equal(OperationKind.Conversion, operation.
Kind
);
888
Assert.Equal(OperationKind.Conditional, operation.
Kind
);
903
Assert.Equal(OperationKind.Coalesce, operation.
Kind
);
910
Assert.Equal(OperationKind.CoalesceAssignment, operation.
Kind
);
916
Assert.Equal(OperationKind.IsType, operation.
Kind
);
924
Assert.Equal(OperationKind.SizeOf, operation.
Kind
);
931
Assert.Equal(OperationKind.TypeOf, operation.
Kind
);
938
Assert.Equal(OperationKind.AnonymousFunction, operation.
Kind
);
945
Assert.Equal(OperationKind.FlowAnonymousFunction, operation.
Kind
);
952
Assert.Equal(OperationKind.LocalFunction, operation.
Kind
);
978
Assert.Equal(OperationKind.Literal, operation.
Kind
);
984
Assert.Equal(OperationKind.Utf8String, operation.
Kind
);
991
Assert.Equal(OperationKind.Await, operation.
Kind
);
997
Assert.Equal(OperationKind.NameOf, operation.
Kind
);
1003
Assert.Equal(OperationKind.Throw, operation.
Kind
);
1016
Assert.Equal(OperationKind.AddressOf, operation.
Kind
);
1022
Assert.Equal(OperationKind.ObjectCreation, operation.
Kind
);
1047
Assert.Equal(OperationKind.AnonymousObjectCreation, operation.
Kind
);
1054
Assert.Equal(OperationKind.InstanceReference, propertyReference.Instance.
Kind
);
1061
Assert.Equal(OperationKind.DynamicObjectCreation, operation.
Kind
);
1074
Assert.Equal(OperationKind.DynamicInvocation, operation.
Kind
);
1080
Assert.Equal(OperationKind.DynamicIndexerAccess, operation.
Kind
);
1086
Assert.Equal(OperationKind.ObjectOrCollectionInitializer, operation.
Kind
);
1092
Assert.Equal(OperationKind.MemberInitializer, operation.
Kind
);
1104
Assert.Equal(OperationKind.FieldInitializer, operation.
Kind
);
1114
Assert.Equal(OperationKind.VariableInitializer, operation.
Kind
);
1121
Assert.Equal(OperationKind.PropertyInitializer, operation.
Kind
);
1131
Assert.Equal(OperationKind.ParameterInitializer, operation.
Kind
);
1138
Assert.Equal(OperationKind.ArrayCreation, operation.
Kind
);
1151
Assert.Equal(OperationKind.ArrayInitializer, operation.
Kind
);
1163
Assert.Equal(OperationKind.SimpleAssignment, operation.
Kind
);
1170
Assert.Equal(OperationKind.CompoundAssignment, operation.
Kind
);
1199
Assert.Contains(operation.
Kind
, new[] { OperationKind.Increment, OperationKind.Decrement });
1211
Assert.Equal(OperationKind.Parenthesized, operation.
Kind
);
1217
Assert.Equal(OperationKind.DynamicMemberReference, operation.
Kind
);
1239
Assert.Equal(OperationKind.DefaultValue, operation.
Kind
);
1245
Assert.Equal(OperationKind.TypeParameterObjectCreation, operation.
Kind
);
1258
Assert.Equal(OperationKind.None, operation.
Kind
);
1271
Assert.Equal(OperationKind.Invalid, operation.
Kind
);
1276
Assert.Equal(OperationKind.Tuple, operation.
Kind
);
1283
Assert.Equal(OperationKind.InterpolatedString, operation.
Kind
);
1289
Assert.Equal(OperationKind.InterpolatedStringText, operation.
Kind
);
1290
if (operation.Text.
Kind
!= OperationKind.Literal)
1292
Assert.Equal(OperationKind.Literal, ((IConversionOperation)operation.Text).Operand.
Kind
);
1299
Assert.Equal(OperationKind.Interpolation, operation.
Kind
);
1308
if (operation.FormatString.
Kind
!= OperationKind.Literal)
1310
Assert.Equal(OperationKind.Literal, ((IConversionOperation)operation.FormatString).Operand.
Kind
);
1320
Assert.Equal(OperationKind.InterpolatedStringHandlerCreation, operation.
Kind
);
1331
Assert.Equal(OperationKind.InterpolatedStringAddition, operation.
Kind
);
1339
Assert.Equal(OperationKind.InterpolatedStringHandlerArgumentPlaceholder, operation.
Kind
);
1353
Assert.True(operation.
Kind
is OperationKind.InterpolatedStringAppendFormatted or OperationKind.InterpolatedStringAppendLiteral or OperationKind.InterpolatedStringAppendInvalid);
1367
Assert.Equal(OperationKind.ConstantPattern, operation.
Kind
);
1374
Assert.Equal(OperationKind.RelationalPattern, operation.
Kind
);
1387
Assert.Equal(OperationKind.BinaryPattern, operation.
Kind
);
1398
Assert.Equal(OperationKind.NegatedPattern, operation.
Kind
);
1405
Assert.Equal(OperationKind.TypePattern, operation.
Kind
);
1413
Assert.Equal(OperationKind.DeclarationPattern, operation.
Kind
);
1446
Assert.Equal(OperationKind.SlicePattern, operation.
Kind
);
1461
Assert.Equal(OperationKind.ListPattern, operation.
Kind
);
1479
Assert.Equal(OperationKind.RecursivePattern, operation.
Kind
);
1527
if (operation.Member.
Kind
== OperationKind.Invalid)
1551
Assert.Equal(OperationKind.SwitchExpression, operation.
Kind
);
1573
Assert.Equal(OperationKind.IsPattern, operation.
Kind
);
1595
Assert.Equal(OperationKind.TranslatedQuery, operation.
Kind
);
1601
Assert.Equal(OperationKind.DeclarationExpression, operation.
Kind
);
1607
Assert.Equal(OperationKind.DeconstructionAssignment, operation.
Kind
);
1613
Assert.Equal(OperationKind.DelegateCreation, operation.
Kind
);
1619
Assert.Equal(OperationKind.RaiseEvent, operation.
Kind
);
1632
Assert.Equal(OperationKind.ConstructorBodyOperation, operation.
Kind
);
1633
Assert.Equal(OperationKind.ConstructorBody, operation.
Kind
);
1659
Assert.Equal(OperationKind.MethodBodyOperation, operation.
Kind
);
1660
Assert.Equal(OperationKind.MethodBody, operation.
Kind
);
1685
Assert.Equal(OperationKind.Discard, operation.
Kind
);
1694
Assert.Equal(OperationKind.DiscardPattern, operation.
Kind
);
1701
Assert.Equal(OperationKind.FlowCapture, operation.
Kind
);
1705
switch (operation.Value.
Kind
)
1718
Assert.False(true, $"A {operation.Value.
Kind
} node should not be spilled or captured.");
1733
Assert.Equal(OperationKind.FlowCaptureReference, operation.
Kind
);
1740
Assert.Equal(OperationKind.IsNull, operation.
Kind
);
1747
Assert.Equal(OperationKind.CaughtException, operation.
Kind
);
1754
Assert.Equal(OperationKind.StaticLocalInitializationSemaphore, operation.
Kind
);
1763
Assert.Equal(OperationKind.Range, operation.
Kind
);
1784
Assert.Equal(OperationKind.ReDim, operation.
Kind
);
1791
Assert.Equal(OperationKind.ReDimClause, operation.
Kind
);
1818
Assert.Equal(OperationKind.With, operation.
Kind
);
1826
Assert.Equal(OperationKind.Attribute, operation.
Kind
);
Diagnostics\BoxingOperationAnalyzer.cs (2)
45
if (operation.
Kind
== OperationKind.Conversion)
58
if (operation.
Kind
== OperationKind.Invocation)
Diagnostics\CommonDiagnosticAnalyzers.cs (1)
1392
var diagnostic = Diagnostic.Create(Descriptor, c.OwningSymbol.Locations[0], c.OwningSymbol.Name, operationRoot.
Kind
);
Diagnostics\CouldHaveMoreSpecificTypeAnalyzer.cs (2)
239
OperationKind targetKind = target.
Kind
;
281
if (value.
Kind
== OperationKind.Conversion)
Diagnostics\FieldCouldBeReadOnlyAnalyzer.cs (2)
113
if (target.
Kind
== OperationKind.FieldReference)
118
switch (fieldReference.Instance.
Kind
)
Diagnostics\LocalCouldBeConstAnalyzer.cs (2)
116
if (target.
Kind
== OperationKind.LocalReference)
123
else if (target.
Kind
== OperationKind.FieldReference)
Diagnostics\OperationTestAnalyzer.cs (28)
152
if (forCondition.
Kind
== OperationKind.Binary)
160
conditionLeft.
Kind
== OperationKind.LocalReference)
170
if (setup.
Kind
== OperationKind.ExpressionStatement && ((IExpressionStatementOperation)setup).Operation.
Kind
== OperationKind.SimpleAssignment)
173
if (setupAssignment.Target.
Kind
== OperationKind.LocalReference &&
185
if (advance.
Kind
== OperationKind.ExpressionStatement)
234
if (advanceExpression.
Kind
== OperationKind.SimpleAssignment)
238
if (advanceAssignment.Target.
Kind
== OperationKind.LocalReference &&
240
advanceAssignment.Value.
Kind
== OperationKind.Binary &&
247
advanceOperation.LeftOperand.
Kind
== OperationKind.LocalReference &&
258
else if (advanceExpression.
Kind
== OperationKind.CompoundAssignment)
262
if (advanceAssignment.Target.
Kind
== OperationKind.LocalReference &&
272
else if (advanceExpression.
Kind
== OperationKind.Increment)
276
if (advanceAssignment.Target.
Kind
== OperationKind.LocalReference &&
716
Report(operationContext, initializer.Syntax, initializer.
Kind
== OperationKind.FieldReference ? DoNotUseFieldInitializerDescriptor : DoNotUsePropertyInitializerDescriptor);
753
var kind = assignment.Target.
Kind
;
899
switch (operationContext.Operation.
Kind
)
1044
if (eventAssignment.EventReference.
Kind
== OperationKind.Invalid || eventAssignment.HasErrors(operationContext.Compilation, operationContext.CancellationToken))
1264
if (addressOfOperation.Reference.
Kind
== OperationKind.Invalid && addressOfOperation.HasErrors(operationContext.Compilation, operationContext.CancellationToken))
1328
if (statement.
Kind
== OperationKind.None)
1381
switch (operation.
Kind
)
1615
if (left.
Kind
== OperationKind.LocalReference)
1620
if (right.
Kind
== OperationKind.Literal)
1642
if (operand.
Kind
== OperationKind.LocalReference)
1735
if (operation.
Kind
== OperationKind.Argument)
1786
if (operation.
Kind
== OperationKind.Binary)
1794
else if (operation.
Kind
== OperationKind.Unary)
1802
else if (operation.
Kind
== OperationKind.Increment)
Extensions\OperationExtensions.cs (1)
13
switch (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)
21
assignmentOperation.Parent?.
Kind
== OperationKind.ObjectOrCollectionInitializer;
241
switch (operation.
Kind
)
265
switch (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)
192
if (operation.
Kind
is OperationKind.LocalFunction or OperationKind.AnonymousFunction)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.Walker.cs (6)
154
operation.Parent.Parent?.
Kind
!= OperationKind.ExpressionStatement)
162
Debug.Assert(symbolOpt != null || operation.
Kind
== OperationKind.FlowCaptureReference);
192
operation.Parent?.
Kind
!= OperationKind.ExpressionStatement;
196
if (write.
Kind
!= OperationKind.FlowCaptureReference)
437
switch (currentOperation.
Kind
)
552
switch (target.
Kind
)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_Negate.cs (2)
479
if (operation?.
Kind
== OperationKind.Literal && operation.ConstantValue.HasValue && operation.ConstantValue.Value is true)
483
else if (operation?.
Kind
== OperationKind.Literal && operation.ConstantValue.HasValue && operation.ConstantValue.Value is false)
Roslyn.Compilers.VisualBasic.IOperation.UnitTests (4)
IOperation\IOperationTests.vb (3)
65
Assert.Equal(assignment1.Value.
Kind
, OperationKind.Binary)
98
Assert.Equal(assignment2.Value.
Kind
, OperationKind.Binary)
131
Assert.Equal(assignment3.Value.
Kind
, OperationKind.Unary)
IOperation\IOperationTests_IUsingStatement.vb (1)
85
Assert.Equal(OperationKind.Invalid, op.Resources.
Kind
)
System.Private.CoreLib.Generators (2)
IntrinsicsInSystemPrivateCoreLibAnalyzer.cs (2)
493
if (operationSearch.
Kind
== OperationKind.AnonymousFunction)
498
if (operationSearch.
Kind
== OperationKind.LocalFunction)