760 references to Kind
Microsoft.CodeAnalysis.CSharp (733)
Binder\Binder.cs (1)
862
RoslynDebug.Assert(statement.
Kind
!= BoundKind.StatementList);
Binder\Binder.ValueChecks.cs (31)
385
switch (expr.
Kind
)
442
if (expr.
Kind
== BoundKind.MethodGroup && valueKind != BindValueKind.RValueOrMethodGroup)
467
if ((object)otherSymbol != null && receiver?.
Kind
== BoundKind.TypeOrValueExpression)
504
switch (expression?.
Kind
)
507
case BoundKind.QueryClause when ((BoundQueryClause)expression).Value.
Kind
== BoundKind.TypeOrValueExpression:
536
switch (expr.
Kind
)
541
case BoundKind.ImplicitIndexerAccess when ((BoundImplicitIndexerAccess)expr).IndexerOrSliceAccess.
Kind
== BoundKind.IndexerAccess:
562
switch (expr.
Kind
)
726
throw ExceptionUtilities.UnexpectedValue(implicitIndexer.IndexerOrSliceAccess.
Kind
);
760
Debug.Assert(expr is not BoundValuePlaceholderBase, $"Placeholder kind {expr.
Kind
} should be explicitly handled");
805
switch (expr.
Kind
)
1398
return Flags.Includes(BinderFlags.ObjectInitializerMember) && receiver.
Kind
== BoundKind.ObjectOrCollectionValuePlaceholder ||
1562
ReportDiagnosticsIfObsolete(diagnostics, setMethod, node, receiver?.
Kind
== BoundKind.BaseReference);
1612
ReportDiagnosticsIfObsolete(diagnostics, getMethod, node, receiver?.
Kind
== BoundKind.BaseReference);
1695
if (receiverOpt?.
Kind
== BoundKind.BaseReference && member.IsAbstract)
2107
if (argument.
Kind
== BoundKind.ArgListOperator)
2934
switch (expr.
Kind
)
3109
throw ExceptionUtilities.UnexpectedValue(implicitIndexerAccess.IndexerOrSliceAccess.
Kind
);
3177
switch (expr.
Kind
)
3359
throw ExceptionUtilities.UnexpectedValue(implicitIndexerAccess.IndexerOrSliceAccess.
Kind
);
3492
switch (expr.
Kind
)
3660
throw ExceptionUtilities.UnexpectedValue(implicitIndexerAccess.IndexerOrSliceAccess.
Kind
);
3811
Debug.Assert(false, $"{expr.
Kind
} expression of {expr.Type} type");
3832
if (expression.
Kind
== BoundKind.AssignmentOperator)
3899
switch (expr.
Kind
)
4108
throw ExceptionUtilities.UnexpectedValue(implicitIndexerAccess.IndexerOrSliceAccess.
Kind
);
4289
Debug.Assert(false, $"{expr.
Kind
} expression of {expr.Type} type");
4438
if (expression.
Kind
== BoundKind.AssignmentOperator)
4525
throw ExceptionUtilities.UnexpectedValue(expression.
Kind
);
4593
switch (expression.
Kind
)
4799
fieldAccess.ReceiverOpt.
Kind
== BoundKind.ThisReference;
Binder\Binder_Attributes.cs (2)
907
switch (assignment.Left.
Kind
)
957
switch (node.
Kind
)
Binder\Binder_Await.cs (4)
78
if (expression.
Kind
!= BoundKind.Call ||
340
if (getAwaiterCall.
Kind
!= BoundKind.Call)
378
if (qualified.
Kind
!= BoundKind.PropertyAccess)
446
if (getAwaiterGetResultCall.
Kind
!= BoundKind.Call)
Binder\Binder_Conversions.cs (11)
135
if (conversion.IsAnonymousFunction && source.
Kind
== BoundKind.UnboundLambda)
211
if (source.
Kind
== BoundKind.UnconvertedSwitchExpression)
233
if (source.
Kind
== BoundKind.UnconvertedConditionalOperator)
648
Debug.Assert(source.
Kind
is BoundKind.MethodGroup or BoundKind.UnboundLambda);
655
if (source.
Kind
== BoundKind.UnboundLambda &&
664
source.
Kind
== BoundKind.MethodGroup &&
1003
if (node.
Kind
!= BoundKind.MethodGroup)
1144
if (receiverOpt.
Kind
== BoundKind.QueryClause)
1245
while (receiverOpt.
Kind
== BoundKind.QueryClause)
1250
return receiverOpt.
Kind
== BoundKind.TypeExpression;
1260
switch (receiverOpt.
Kind
)
Binder\Binder_Deconstruct.cs (8)
212
if (boundRHS.
Kind
== BoundKind.TupleLiteral)
369
switch (expression.
Kind
)
383
throw ExceptionUtilities.UnexpectedValue(expression.
Kind
);
404
switch (variable.Single.
Kind
)
488
if (element.
Kind
== BoundKind.TupleLiteral)
597
if (expression.
Kind
== BoundKind.DiscardExpression)
661
if (memberAccess.
Kind
!= BoundKind.MethodGroup)
792
if (expression == null && checkedVariable.
Kind
!= BoundKind.DiscardExpression)
Binder\Binder_Expressions.cs (39)
197
BoundKind exprKind = expr.
Kind
;
251
if (valueOrType.
Kind
== BoundKind.TypeExpression)
399
Debug.Assert(expr.
Kind
is BoundKind.UnboundLambda or BoundKind.MethodGroup);
520
if (expr.
Kind
== BoundKind.ArgListOperator)
2514
if (operand.
Kind
== BoundKind.UnboundLambda)
2561
switch (operand.
Kind
)
2852
switch (arg.
Kind
)
3188
else if (argument.
Kind
== BoundKind.OutVariablePendingInference)
3193
else if (argument.
Kind
== BoundKind.OutDeconstructVarPendingInference)
3198
else if (argument.
Kind
== BoundKind.DiscardExpression && !argument.HasExpressionType())
4579
else if (argument.
Kind
== BoundKind.MethodGroup)
4958
if (boundMember.
Kind
== BoundKind.PropertyGroup)
5001
BoundKind boundMemberKind = boundMember.
Kind
;
5526
if (addMethodInvocation.
Kind
== BoundKind.DynamicInvocation)
5537
else if (addMethodInvocation.
Kind
== BoundKind.Call)
5566
Debug.Assert(addMethodInvocation.
Kind
== BoundKind.BadExpression);
5899
switch (classCreation.
Kind
)
5912
throw ExceptionUtilities.UnexpectedValue(classCreation.
Kind
);
6384
if (boundValue.
Kind
== BoundKind.Conversion)
6574
if (boundLeft.
Kind
== BoundKind.UnboundLambda)
6619
switch (boundLeft.
Kind
)
6651
if (boundLeft.
Kind
== BoundKind.Literal && ((BoundLiteral)boundLeft).ConstantValueOpt == ConstantValue.Null)
6822
switch (expr.
Kind
)
6879
bool leftIsBaseReference = boundLeft.
Kind
== BoundKind.BaseReference;
6970
if (boundLeft.HasAnyErrors && boundLeft.
Kind
!= BoundKind.TypeOrValueExpression)
6992
else if (boundLeft.
Kind
== BoundKind.TypeExpression ||
6993
boundLeft.
Kind
== BoundKind.BaseReference ||
7208
ReportDiagnosticsIfObsolete(diagnostics, symbol, node, hasBaseReceiver: left.
Kind
== BoundKind.BaseReference);
7596
ReportDiagnosticsIfObsolete(diagnostics, propertySymbol, node, hasBaseReceiver: receiver?.
Kind
== BoundKind.BaseReference);
7689
switch (receiver.
Kind
)
7880
if (receiver.
Kind
== BoundKind.PropertyGroup)
8056
if (index.
Kind
== BoundKind.OutVariablePendingInference)
8060
else if (index.
Kind
== BoundKind.DiscardExpression && !index.HasExpressionType())
8248
LookupOptions lookupOptions = expr.
Kind
== BoundKind.BaseReference ? LookupOptions.UseBaseReferenceAccessibility : LookupOptions.Default;
8362
BoundKind receiverKind = receiver.
Kind
;
8484
ReportDiagnosticsIfObsolete(diagnostics, property, syntax, hasBaseReceiver: receiver != null && receiver.
Kind
== BoundKind.BaseReference);
8493
if (!gotError && receiver != null && receiver.
Kind
== BoundKind.ThisReference && receiver.WasCompilerGenerated)
9352
if (access.
Kind
== BoundKind.MethodGroup)
9511
if (receiver.
Kind
== BoundKind.UnboundLambda)
Binder\Binder_Initializers.cs (2)
268
if (statement.
Kind
== BoundKind.LabeledStatement)
271
while (labeledStatementBody.
Kind
== BoundKind.LabeledStatement)
Binder\Binder_InterpolatedString.cs (1)
425
_ => throw ExceptionUtilities.UnexpectedValue(unconvertedExpression.
Kind
)
Binder\Binder_Invocation.cs (28)
98
if (!allowFieldsAndProperties && (boundExpression.
Kind
== BoundKind.FieldAccess || boundExpression.
Kind
== BoundKind.PropertyAccess))
102
if (boundExpression.
Kind
== BoundKind.FieldAccess)
127
Debug.Assert(!args.Any(static e => e.
Kind
== BoundKind.OutVariablePendingInference ||
128
e.
Kind
== BoundKind.OutDeconstructVarPendingInference ||
129
e.
Kind
== BoundKind.DiscardExpression && !e.HasExpressionType()));
142
if (queryClause != null && result.
Kind
== BoundKind.DynamicInvocation)
182
string name = boundExpression.
Kind
== BoundKind.MethodGroup ? GetName(node.Expression) : null;
201
if (argument.
Kind
== BoundKind.OutVariablePendingInference)
268
else if (boundExpression.
Kind
== BoundKind.MethodGroup)
315
if (expression.
Kind
== BoundKind.MethodGroup)
323
switch (receiver.
Kind
)
477
if (arg.
Kind
== BoundKind.Lambda || arg.
Kind
== BoundKind.UnboundLambda)
483
else if (arg.
Kind
== BoundKind.MethodGroup)
489
else if (arg.
Kind
== BoundKind.ArgListOperator)
876
switch (expression.
Kind
)
892
else if (call.ReceiverOpt.
Kind
== BoundKind.BaseReference && this.ContainingType.IsRestrictedType())
916
throw ExceptionUtilities.UnexpectedValue(expression.
Kind
);
1093
if (!gotError && method.RequiresInstanceReceiver && receiver != null && receiver.
Kind
== BoundKind.ThisReference && receiver.WasCompilerGenerated)
1109
bool hasBaseReceiver = receiver != null && receiver.
Kind
== BoundKind.BaseReference;
1526
switch (receiver.
Kind
)
1579
if ((object)expr != null && expr.
Kind
!= BoundKind.TypeExpression)
1693
switch (argument.
Kind
)
1723
if (argument.
Kind
== BoundKind.OutVariablePendingInference)
1734
else if (argument.
Kind
== BoundKind.DiscardExpression)
1843
var originalMethods = (expr.
Kind
== BoundKind.MethodGroup) ? ((BoundMethodGroup)expr).Methods : ImmutableArray<MethodSymbol>.Empty;
1891
if (!boundArgument.HasAnyErrors && syntaxIsOk && boundArgument.
Kind
== BoundKind.MethodGroup)
Binder\Binder_Operators.cs (17)
33
if (left.
Kind
== BoundKind.EventAccess)
99
if (left.
Kind
== BoundKind.EventAccess && !CheckEventValueKind((BoundEventAccess)left, BindValueKind.Assignable, diagnostics))
241
Debug.Assert(left.
Kind
!= BoundKind.EventAccess || hasError);
474
if (result.
Kind
== BoundKind.TypeExpression
479
else if (result.
Kind
== BoundKind.BadExpression)
754
_ => throw ExceptionUtilities.UnexpectedValue(current.Right.
Kind
)
803
switch (left.
Kind
, right.
Kind
)
1915
if (left.
Kind
== BoundKind.Conversion && right.
Kind
== BoundKind.Conversion)
2413
switch (expr.
Kind
)
2537
BoundKind exprKind = expr.
Kind
;
3114
switch (operand.
Kind
)
3246
operand.
Kind
== BoundKind.MethodGroup ||
3633
switch (operand.
Kind
)
3941
if (leftOperand.
Kind
== BoundKind.UnboundLambda || leftOperand.
Kind
== BoundKind.MethodGroup)
Binder\Binder_Patterns.cs (6)
508
wasExpression = expression.
Kind
!= BoundKind.TypeExpression;
515
Debug.Assert(expression is {
Kind
: BoundKind.TypeExpression, Type: { } });
537
wasExpression = expression.
Kind
switch { BoundKind.BadExpression => false, BoundKind.TypeExpression => false, _ => true };
677
if (convertedExpression.
Kind
== BoundKind.Conversion)
1552
if (boundMember.
Kind
== BoundKind.PropertyGroup)
1560
switch (boundMember.
Kind
)
Binder\Binder_Query.cs (7)
923
while (ultimateReceiver.
Kind
== BoundKind.QueryClause)
946
else if (ultimateReceiver.
Kind
== BoundKind.NamespaceExpression)
950
else if (ultimateReceiver.
Kind
== BoundKind.Lambda || ultimateReceiver.
Kind
== BoundKind.UnboundLambda)
955
else if (ultimateReceiver.
Kind
== BoundKind.MethodGroup)
976
else if (ultimateReceiver.
Kind
== BoundKind.TypeExpression)
984
else if (ultimateReceiver.
Kind
== BoundKind.TypeOrValueExpression)
Binder\Binder_QueryErrors.cs (1)
220
if (arg.
Kind
== BoundKind.UnboundLambda)
Binder\Binder_Statements.cs (25)
151
(result.
Kind
== BoundKind.Block &&
895
BoundExpression expression = value.
Kind
is BoundKind.UnboundLambda or BoundKind.MethodGroup ?
1254
switch (initializerOpt.
Kind
)
1437
bool discardAssignment = op1.
Kind
== BoundKind.DiscardExpression;
1503
if (op1.
Kind
!= BoundKind.DynamicIndexerAccess &&
1504
op1.
Kind
!= BoundKind.DynamicMemberAccess &&
1505
op1.
Kind
!= BoundKind.DynamicObjectInitializerMember)
1520
if ((op1.
Kind
== BoundKind.EventAccess) &&
1577
else if (op1.
Kind
is BoundKind.Local or BoundKind.Parameter)
1589
Debug.Assert(op1.
Kind
!= BoundKind.Parameter); // If the assert fails, add a corresponding test.
1641
switch (expr.
Kind
)
1674
throw ExceptionUtilities.UnexpectedValue(implicitIndexerAccess.IndexerOrSliceAccess.
Kind
);
1725
_ => throw ExceptionUtilities.UnexpectedValue(e.
Kind
)
1781
(propertyIsStatic || receiver.
Kind
== BoundKind.ThisReference);
1798
else if (receiver.
Kind
== BoundKind.BaseReference)
1923
if (expression.HasAnyErrors && expression.
Kind
!= BoundKind.UnboundLambda)
2284
switch (operand.
Kind
)
2400
Debug.Assert(operand.HasAnyErrors && operand.
Kind
!= BoundKind.UnboundLambda, "Missing a case in implicit conversion error reporting");
2582
if (expr.
Kind
== BoundKind.AssignmentOperator)
2585
if (assignment.Right.
Kind
== BoundKind.Literal && assignment.Right.ConstantValueOpt.Discriminator == ConstantValueTypeDiscriminator.Boolean)
3333
if (expression.
Kind
== BoundKind.DelegateCreationExpression || expression.
Kind
== BoundKind.NameOfOperator)
3361
if ((refKind != RefKind.None) != (returnRefKind != RefKind.None) && expression.
Kind
!= BoundKind.ThrowExpression)
4020
if (boundAccess.
Kind
!= BoundKind.MethodGroup)
4046
if (patternMethodCall.
Kind
!= BoundKind.Call)
Binder\Binder_TupleOperators.cs (2)
217
Debug.Assert((object)left.Type != null || left.
Kind
== BoundKind.TupleLiteral);
218
Debug.Assert((object)right.Type != null || right.
Kind
== BoundKind.TupleLiteral);
Binder\DecisionDagBuilder.cs (16)
311
throw ExceptionUtilities.UnexpectedValue(pattern.
Kind
);
912
throw ExceptionUtilities.UnexpectedValue(n.
Kind
);
1012
throw ExceptionUtilities.UnexpectedValue(n?.
Kind
);
1702
return $"t{tempIdentifier(a)}={a.
Kind
}({tempName(a.Input)} as {a.Type})";
1704
return $"t{tempIdentifier(e)}={e.
Kind
}({tempName(e.Input)}.{e.Field.Name})";
1706
return $"t{tempIdentifier(e)}={e.
Kind
}({tempName(e.Input)}.{e.Property.Name})";
1708
return $"t{tempIdentifier(e)}={e.
Kind
}({tempName(e.Input)}[{e.Index}])";
1710
return $"{e.
Kind
}({tempName(e.Target)}<--{tempName(e.Input)})";
1712
return $"t{tempIdentifier(e)}={e.
Kind
}({tempName(e.Input)})";
1714
return $"?{d.
Kind
}({tempName(d.Input)} is {b.Type})";
1716
return $"?{d.
Kind
}({tempName(d.Input)} == {v.Value})";
1726
return $"?{d.
Kind
}({tempName(d.Input)} {operatorName} {r.Value})";
1728
return $"?{d.
Kind
}({tempName(d.Input)})";
2277
if (RemainingTests[0] is One { Test: {
Kind
: BoundKind.DagNonNullTest } planA })
2284
case One { Test: {
Kind
: BoundKind.DagTypeTest } planB1 }:
2291
case One { Test: {
Kind
: BoundKind.DagValueTest } planB2 }:
Binder\DecisionDagBuilder_ListPatterns.cs (1)
18
list.Subpatterns.Count(p => p.
Kind
== BoundKind.SlicePattern) == (list.HasSlice ? 1 : 0) &&
Binder\ForEachLoopBinder.cs (1)
378
if (iterationErrorExpression.
Kind
== BoundKind.DiscardExpression)
Binder\ForLoopBinder.cs (2)
108
Debug.Assert(increment.
Kind
!= BoundKind.StatementList || ((BoundStatementList)increment).Statements.Length > 1);
113
if (increment.
Kind
== BoundKind.StatementList)
Binder\LockOrUsingBinder.cs (1)
59
switch (expression.
Kind
)
Binder\PatternExplainer.cs (1)
164
throw ExceptionUtilities.UnexpectedValue(currentNode.
Kind
);
Binder\RefSafetyAnalysis.cs (1)
485
if (node.Left.
Kind
!= BoundKind.DiscardExpression)
Binder\Semantics\Conversions\ConversionsBase.cs (4)
1022
switch (sourceExpression.
Kind
)
1335
if (sourceExpression.
Kind
== BoundKind.TupleLiteral)
1570
if (source.
Kind
!= BoundKind.UnboundLambda)
1803
if (sourceExpressionOpt?.
Kind
== BoundKind.TupleLiteral)
Binder\Semantics\Operators\BinaryOperatorOverloadResolution.cs (1)
456
&& nonDelegate.
Kind
== BoundKind.UnboundLambda)
Binder\Semantics\OverloadResolution\MethodGroup.cs (1)
112
if (this.Receiver.
Kind
== BoundKind.TypeExpression)
Binder\Semantics\OverloadResolution\MethodTypeInference.cs (12)
607
if (argument.
Kind
== BoundKind.UnboundLambda && target.Type.GetDelegateType() is { })
612
else if (argument.
Kind
!= BoundKind.TupleLiteral ||
787
if (argument.
Kind
== BoundKind.TupleLiteral && (object)argument.Type == null)
904
if ((isFunctionPointer && argument.
Kind
!= BoundKind.UnconvertedAddressOfOperator) ||
905
(!isFunctionPointer && argument.
Kind
is not (BoundKind.UnboundLambda or BoundKind.MethodGroup)))
960
if ((isFunctionPointer && argument.
Kind
!= BoundKind.UnconvertedAddressOfOperator) ||
961
(!isFunctionPointer && argument.
Kind
is not (BoundKind.UnboundLambda or BoundKind.MethodGroup)))
1329
if (source.
Kind
is not (BoundKind.MethodGroup or BoundKind.UnconvertedAddressOfOperator))
1340
if (delegateOrFunctionPointerType.IsFunctionPointer() != (source.
Kind
== BoundKind.UnconvertedAddressOfOperator))
1436
if (source.
Kind
!= BoundKind.UnboundLambda)
1490
if (source.
Kind
!= BoundKind.UnboundLambda)
2881
if (source.
Kind
!= BoundKind.UnboundLambda)
Binder\Semantics\OverloadResolution\OverloadResolution.cs (13)
1747
var argumentKind = arguments[i].
Kind
;
1891
var argumentKind = arguments[i].
Kind
;
2057
if (arguments[i].
Kind
== BoundKind.ArgListOperator)
2149
if (arguments[i].
Kind
!= BoundKind.ArgListOperator)
2436
var nodeKind = node.
Kind
;
2524
if (node.
Kind
== BoundKind.TupleLiteral)
2540
if (node.
Kind
== BoundKind.UnboundLambda &&
2580
if (lambda.Body.Statements[0].
Kind
== BoundKind.ReturnStatement)
2846
if (node?.
Kind
== BoundKind.MethodGroup)
3648
if (argument.
Kind
== BoundKind.ArgListOperator)
3791
if (argument.
Kind
== BoundKind.OutVariablePendingInference ||
3792
argument.
Kind
== BoundKind.OutDeconstructVarPendingInference ||
3793
(argument.
Kind
== BoundKind.DiscardExpression && (object)argType == null))
Binder\Semantics\OverloadResolution\OverloadResolutionResult.cs (12)
638
if (receiverOpt?.
Kind
== BoundKind.QueryClause)
1046
if (argument.
Kind
== BoundKind.UnboundLambda)
1173
argument.
Kind
!= BoundKind.OutDeconstructVarPendingInference &&
1174
argument.
Kind
!= BoundKind.OutVariablePendingInference &&
1175
argument.
Kind
!= BoundKind.DiscardExpression)
1181
if (argument.
Kind
== BoundKind.UnboundLambda && refArg == refParameter)
1185
else if (argument.
Kind
== BoundKind.MethodGroup && parameterType.TypeKind == TypeKind.Delegate &&
1190
else if (argument.
Kind
== BoundKind.MethodGroup && parameterType.TypeKind == TypeKind.FunctionPointer)
1194
else if (argument.
Kind
== BoundKind.UnconvertedAddressOfOperator &&
1238
Debug.Assert(argument.
Kind
!= BoundKind.OutDeconstructVarPendingInference);
1239
Debug.Assert(argument.
Kind
!= BoundKind.OutVariablePendingInference);
1240
Debug.Assert(argument.
Kind
!= BoundKind.DiscardExpression || argument.HasExpressionType());
BoundTree\BoundDagEvaluation.cs (3)
27
this.
Kind
== other.
Kind
&&
45
_ => throw ExceptionUtilities.UnexpectedValue(this.
Kind
)
BoundTree\BoundDagTest.cs (5)
20
if (other is null || this.
Kind
!= other.
Kind
)
46
return Hash.Combine(((int)
Kind
).GetHashCode(), Input.GetHashCode());
81
return $"{e.GetOutputTempDebuggerDisplay()} = {e.
Kind
}({e.Input.GetDebuggerDisplay()})";
102
return $"{this.
Kind
}({this.Input.GetDebuggerDisplay()})";
BoundTree\BoundDecisionDag.cs (2)
36
throw ExceptionUtilities.UnexpectedValue(node.
Kind
);
199
return this.TopologicallySortedNodes.Any(static node => node is BoundEvaluationDecisionDagNode e && e.Evaluation.
Kind
== BoundKind.DagAssignmentEvaluation);
BoundTree\BoundExpression.cs (5)
37
if ((
Kind
!= BoundKind.Local &&
Kind
!= BoundKind.Parameter) || this.WasConverted)
55
switch (
Kind
)
543
return this.Condition.
Kind
== BoundKind.UnaryOperator && ((BoundUnaryOperator)this.Condition).OperatorKind.IsDynamic();
671
if (argument.
Kind
== BoundKind.TupleLiteral)
BoundTree\BoundExpressionExtensions.cs (9)
22
switch (node.
Kind
)
65
return node is {
Kind
: BoundKind.Literal, ConstantValueOpt: { Discriminator: ConstantValueTypeDiscriminator.Null } };
70
return node.
Kind
== BoundKind.DefaultLiteral;
75
return node.
Kind
== BoundKind.UnconvertedObjectCreationExpression;
91
if (node.
Kind
== BoundKind.DefaultExpression || node.
Kind
== BoundKind.DefaultLiteral)
119
Debug.Assert(expr.
Kind
is BoundKind.MethodGroup or BoundKind.UnboundLambda);
152
switch (node.
Kind
)
224
switch (boundNode.
Kind
)
BoundTree\BoundMethodGroup.cs (1)
61
if (this.ReceiverOpt == null || this.ReceiverOpt.
Kind
== BoundKind.TypeExpression)
BoundTree\BoundNode_Source.cs (1)
341
appendLine(node.
Kind
.ToString());
BoundTree\BoundNodeExtensions.cs (10)
42
if (statement!.
Kind
== BoundKind.ExpressionStatement)
45
if (expression.
Kind
== BoundKind.Sequence && ((BoundSequence)expression).SideEffects.IsDefaultOrEmpty)
51
return expression.
Kind
== BoundKind.Call && ((BoundCall)expression).IsConstructorInitializer();
64
(receiverOpt.
Kind
== BoundKind.ThisReference || receiverOpt.
Kind
== BoundKind.BaseReference);
131
throw ExceptionUtilities.UnexpectedValue(current.Left.
Kind
);
146
throw ExceptionUtilities.UnexpectedValue(current.Right.
Kind
);
214
_ => throw ExceptionUtilities.UnexpectedValue(currentBinary.Left.
Kind
)
225
_ => throw ExceptionUtilities.UnexpectedValue(currentBinary.Right.
Kind
)
256
_ => throw ExceptionUtilities.UnexpectedValue(e.
Kind
),
BoundTree\BoundStatementExtensions.cs (4)
16
switch (node.
Kind
)
23
throw ExceptionUtilities.UnexpectedValue(node.
Kind
);
32
switch (node.
Kind
)
53
throw ExceptionUtilities.UnexpectedValue(node.
Kind
);
BoundTree\BoundTreeRewriter.cs (2)
114
if (child.
Kind
!= BoundKind.BinaryOperator)
129
if (child.
Kind
!= BoundKind.BinaryOperator)
BoundTree\BoundTreeVisitors.cs (1)
31
switch (node.
Kind
)
BoundTree\BoundTreeWalker.cs (2)
106
if (node.Left.
Kind
!= BoundKind.BinaryOperator)
121
while (current.
Kind
== BoundKind.BinaryOperator)
BoundTree\Constructors.cs (1)
67
switch (receiver.
Kind
)
BoundTree\Expression.cs (2)
170
(this.
Kind
== BoundKind.StatementList || this.
Kind
== BoundKind.Scope) ? StaticCast<BoundNode?>.From(this.Statements) : ImmutableArray<BoundNode?>.Empty;
BoundTree\NullabilityRewriter.cs (1)
66
_ => throw ExceptionUtilities.UnexpectedValue(currentBinary.
Kind
),
CodeGen\EmitAddress.cs (4)
28
switch (expression.
Kind
)
89
throw ExceptionUtilities.UnexpectedValue(expression.
Kind
);
350
switch (value.
Kind
)
525
if (receiver.
Kind
!= BoundKind.ConditionalReceiver)
CodeGen\EmitArrayInitializer.cs (4)
345
if (inits[0].
Kind
== BoundKind.ArrayInitialization)
367
Debug.Assert(inits.All((init) => init.
Kind
!= BoundKind.ArrayInitialization) ||
368
inits.All((init) => init.
Kind
== BoundKind.ArrayInitialization),
371
return inits.Length != 0 && inits[0].
Kind
== BoundKind.ArrayInitialization;
CodeGen\EmitExpression.cs (30)
95
switch (expression.
Kind
)
169
throw ExceptionUtilities.UnexpectedValue(expression.
Kind
);
347
Debug.Assert(expression.
Kind
!= BoundKind.BadExpression);
350
throw ExceptionUtilities.UnexpectedValue(expression.
Kind
);
429
(receiver.
Kind
== BoundKind.Local && IsStackLocal(((BoundLocal)receiver).LocalSymbol)) ||
845
Debug.Assert(sequence.Value.
Kind
!= BoundKind.TypeExpression || !used);
846
if (sequence.Value.
Kind
!= BoundKind.TypeExpression)
973
Debug.Assert(arguments[i].
Kind
== BoundKind.ArgListOperator);
1191
else if (receiver.
Kind
== BoundKind.Conversion)
1202
else if (receiver.
Kind
== BoundKind.FieldAccess)
1233
if (receiver.
Kind
== BoundKind.Conversion && ((BoundConversion)receiver).ConversionKind == ConversionKind.Unboxing)
1244
switch (receiver.
Kind
)
1476
Debug.Assert(receiver.
Kind
!= BoundKind.BaseReference, "base should always use call");
1485
switch (receiver.
Kind
)
1558
switch (receiver.
Kind
)
1606
Debug.Assert(receiver.
Kind
== BoundKind.ThisReference);
1908
switch (current.
Kind
)
1991
switch (receiver.
Kind
)
2403
if (objCreation.Arguments.Length > 0 && objCreation.Arguments[0].
Kind
== BoundKind.ConvertedStackAllocExpression)
2437
if (left.
Kind
== BoundKind.ArrayAccess && left.Type.TypeKind == TypeKind.TypeParameter && !left.Type.IsValueType)
2442
if (left.
Kind
== BoundKind.FieldAccess)
2537
switch (left.
Kind
)
2556
switch (assignmentTarget.
Kind
)
2736
throw ExceptionUtilities.UnexpectedValue(assignmentTarget.
Kind
);
2757
throw ExceptionUtilities.UnexpectedValue(assignmentTarget.
Kind
);
2786
Debug.Assert(lhs.
Kind
!= BoundKind.Parameter || exprTempsAfter <= exprTempsBefore);
2788
if (lhs.
Kind
== BoundKind.Local && ((BoundLocal)lhs).LocalSymbol.SynthesizedKind.IsLongLived())
2844
switch (expression.
Kind
)
2944
throw ExceptionUtilities.UnexpectedValue(expression.
Kind
);
3642
switch (expr.
Kind
)
CodeGen\EmitOperators.cs (4)
94
if (child.
Kind
!= BoundKind.BinaryOperator || child.ConstantValueOpt != null)
118
if (child.
Kind
!= BoundKind.BinaryOperator || child.ConstantValueOpt != null)
474
while (condition.
Kind
== BoundKind.UnaryOperator)
493
if (condition.
Kind
== BoundKind.BinaryOperator)
CodeGen\EmitStatement.cs (10)
29
switch (statement.
Kind
)
105
throw ExceptionUtilities.UnexpectedValue(statement.
Kind
);
416
switch (condition.
Kind
)
536
(receiver.
Kind
== BoundKind.Local && IsStackLocal(((BoundLocal)receiver).LocalSymbol)) ||
1110
while (exceptionSource.
Kind
== BoundKind.Sequence)
1118
switch (exceptionSource.
Kind
)
1157
throw ExceptionUtilities.UnexpectedValue(exceptionSource.
Kind
);
1239
if (expression.
Kind
== BoundKind.Sequence)
1247
if (expression.
Kind
== BoundKind.SequencePointExpression)
1254
switch (expression.
Kind
)
CodeGen\Optimizer.cs (18)
451
Debug.Assert(expr.
Kind
!= BoundKind.Label);
761
if (value != null && value.
Kind
== BoundKind.Local && ((BoundLocal)value).LocalSymbol == local)
769
if (lastSideeffect.
Kind
== BoundKind.AssignmentOperator)
773
assignment.Right.
Kind
== BoundKind.Sequence)
949
bool mayPushReceiver = (right.
Kind
== BoundKind.ObjectCreationExpression &&
995
assignmentLocal.Type.IsPointerOrFunctionPointer() && right.
Kind
== BoundKind.Conversion &&
1030
(lhs.
Kind
is BoundKind.Local or BoundKind.Parameter or BoundKind.FieldAccess && lhs.GetRefKind() != RefKind.None),
1033
switch (lhs.
Kind
)
1092
throw ExceptionUtilities.UnexpectedValue(lhs.
Kind
);
1099
if (lhs.
Kind
== BoundKind.FieldAccess)
1358
if (boundExpression.
Kind
== BoundKind.Local)
1410
if (child.
Kind
!= BoundKind.BinaryOperator || child.ConstantValueOpt != null)
1426
if (child.
Kind
!= BoundKind.BinaryOperator || child.ConstantValueOpt != null)
1630
if (exceptionSourceOpt.
Kind
== BoundKind.Local)
1869
top.Item1.
Kind
== BoundKind.Local &&
2004
if (child.
Kind
!= BoundKind.BinaryOperator || child.ConstantValueOpt != null)
2020
if (child.
Kind
!= BoundKind.BinaryOperator || child.ConstantValueOpt != null)
2176
if (exceptionSource.
Kind
== BoundKind.Local)
Compilation\CSharpSemanticModel.cs (14)
1945
else if (highestBoundExpr.
Kind
== BoundKind.TypeOrValueExpression)
1951
else if (highestBoundExpr.
Kind
== BoundKind.UnaryOperator)
2106
var highestBoundExprKind = highestBoundExpr?.
Kind
?? BoundKind.NoOpStatement;
2127
if (tupleLiteralConversion.Operand.
Kind
== BoundKind.ConvertedTupleLiteral)
2193
else if (((BoundConversion)highestBoundExpr).Operand.
Kind
!= BoundKind.Conversion)
2211
else if (boundNodeForSyntacticParent?.
Kind
== BoundKind.DelegateCreationExpression)
2216
switch (boundExpr.
Kind
)
2298
if (boundExpr != null && boundExpr.
Kind
!= BoundKind.TypeExpression)
3348
switch (boundNode.
Kind
)
3392
boundNodeForSyntacticParent.
Kind
== BoundKind.BadExpression &&
3968
switch (boundNodeForSyntacticParent.
Kind
)
3994
throw ExceptionUtilities.UnexpectedValue(boundNodeForSyntacticParent.
Kind
);
4244
switch (boundNodeForSyntacticParent.
Kind
)
4386
switch (boundNodeForSyntacticParent.
Kind
)
Compilation\MemberSemanticModel.cs (5)
1191
Debug.Assert(highestBoundNode.
Kind
!= BoundKind.UnboundLambda);
1733
switch (boundInnerLambdaOrQuery.
Kind
)
1762
switch (node.
Kind
)
1780
while (receiver?.
Kind
== BoundKind.MethodGroup)
1847
if (expr.
Kind
== BoundKind.QueryClause)
Compilation\MemberSemanticModel.NodeMapBuilder.cs (7)
85
if (existing[i].
Kind
!= added[i].
Kind
)
90
if (existing[i].
Kind
== BoundKind.TypeExpression && added[i].
Kind
== BoundKind.TypeOrValueExpression)
98
else if (existing[i].
Kind
== BoundKind.TypeOrValueExpression && added[i].
Kind
== BoundKind.TypeExpression)
170
if (node.
Kind
== BoundKind.UnboundLambda)
Compiler\MethodBodySynthesizer.Lowered.cs (1)
333
if (body.
Kind
!= BoundKind.Block) body = F.Block(body);
Compiler\MethodCompiler.cs (4)
597
(init.
Kind
== BoundKind.FieldEqualsValue) && !((BoundFieldEqualsValue)init).Field.IsMetadataConstant));
1335
if (processedInitializers.LoweredInitializers.
Kind
== BoundKind.StatementList)
1883
switch (methodBody.
Kind
)
1925
throw ExceptionUtilities.UnexpectedValue(methodBody.
Kind
);
FlowAnalysis\AbstractFlowPass.cs (13)
555
switch (node?.
Kind
)
840
switch (node.
Kind
)
865
throw ExceptionUtilities.UnexpectedValue(node.
Kind
);
890
Debug.Assert(false, $"Should Visit{node.
Kind
} be overridden in {this.GetType().Name}?");
1006
throw ExceptionUtilities.UnexpectedValue(pattern.
Kind
);
1048
throw ExceptionUtilities.UnexpectedValue(pattern.
Kind
);
1723
if (pend.Branch.
Kind
!= BoundKind.YieldReturnStatement)
1951
if (expr.
Kind
!= BoundKind.PropertyAccess)
1984
var refKind = node.Left.
Kind
== BoundKind.BadExpression
2065
receiverOpt.
Kind
!= BoundKind.TypeExpression &&
2227
var childKind = child.
Kind
;
2265
switch (binary.
Kind
)
2278
throw ExceptionUtilities.UnexpectedValue(binary.
Kind
);
FlowAnalysis\ControlFlowPass.cs (3)
214
switch (pending.Branch.
Kind
)
242
switch (statement.
Kind
)
304
switch (branch.Branch.
Kind
)
FlowAnalysis\DataFlowsOutWalker.cs (2)
118
switch (node.
Kind
)
239
switch (node.
Kind
)
FlowAnalysis\DefiniteAssignment.cs (21)
242
if (node.
Kind
== BoundKind.Attribute)
428
BoundKind kind = pendingBranch.
Kind
;
764
Debug.Assert(fieldOrEventAccess.
Kind
== BoundKind.FieldAccess || fieldOrEventAccess.
Kind
== BoundKind.EventAccess);
768
switch (n.
Kind
)
891
if (value is { ConstantValueOpt: not null,
Kind
: not BoundKind.InterpolatedString }) return false;
893
switch (value.
Kind
)
928
switch (n.
Kind
)
942
if (n.
Kind
== BoundKind.Local)
1026
switch (expr.
Kind
)
1080
receiver.
Kind
!= BoundKind.TypeExpression &&
1097
receiverOpt.
Kind
!= BoundKind.TypeExpression &&
1321
switch (node.
Kind
)
1418
switch (expression.
Kind
)
1466
switch (node.
Kind
)
1865
switch (pattern.
Kind
)
1967
throw ExceptionUtilities.UnexpectedValue(pattern.
Kind
);
2037
if (stmt.
Kind
!= BoundKind.LocalFunctionStatement)
2285
if (pending.Branch.
Kind
== BoundKind.ReturnStatement)
2359
if (initializer.
Kind
== BoundKind.AddressOfOperator)
2430
switch (expr.
Kind
)
FlowAnalysis\ExitPointsWalker.cs (2)
125
switch (pending.Branch.
Kind
)
148
throw ExceptionUtilities.UnexpectedValue(pending.Branch.
Kind
);
FlowAnalysis\LocalDataFlowPass.cs (1)
208
switch (node.
Kind
)
FlowAnalysis\NullableWalker.cs (35)
398
private bool IsAnalyzingAttribute => methodMainNode.
Kind
== BoundKind.Attribute;
506
Debug.Assert(expression != null || placeholder.
Kind
== BoundKind.InterpolatedStringArgumentPlaceholder);
525
switch (placeholder.
Kind
)
541
throw ExceptionUtilities.UnexpectedValue(placeholder.
Kind
);
1896
switch (expr.
Kind
)
1945
receiver.
Kind
!= BoundKind.TypeExpression &&
1971
switch (node.
Kind
)
2245
(value.WasCompilerGenerated && assignmentKind == AssignmentKind.Argument && value.
Kind
!= BoundKind.InterpolatedStringArgumentPlaceholder) ||
2421
switch (expr.
Kind
)
2877
if (!expr.IsSuppressed && RemoveConversion(expr, includeExplicitConversions: false).expression.
Kind
!= BoundKind.ThrowExpression)
2992
if (stmt.
Kind
!= BoundKind.LocalFunctionStatement)
3561
Debug.Assert(node.
Kind
is BoundKind.ObjectCreationExpression or BoundKind.DynamicObjectCreationExpression or BoundKind.NewT or BoundKind.NoPiaObjectCreationExpression);
3651
switch (initializer.
Kind
)
3666
switch (initializer.
Kind
)
3679
ExceptionUtilities.UnexpectedValue(node.
Kind
);
3696
switch (left.
Kind
)
3952
Debug.Assert(node.ImplicitReceiverOpt.
Kind
== BoundKind.ObjectOrCollectionValuePlaceholder);
4363
if (child.
Kind
== BoundKind.ArrayInitialization)
4885
switch (operand.
Kind
)
5081
while (possiblyConversion.
Kind
== BoundKind.Conversion)
6497
var savedState = (argument.
Kind
== BoundKind.Lambda) ? this.State.Clone() : default(Optional<LocalState>);
7092
switch (expr.
Kind
)
7145
if (argument.
Kind
== BoundKind.Lambda)
7214
if (expr.
Kind
!= BoundKind.Conversion)
7296
switch (value.
Kind
)
8101
if (operandType.Type?.IsTupleType == true || conversionOperand.
Kind
== BoundKind.TupleLiteral)
9060
if (left.
Kind
== BoundKind.EventAccess && ((BoundEventAccess)left).EventSymbol.IsWindowsRuntimeEvent)
9200
switch (expr.
Kind
)
9476
switch (expr.
Kind
)
9494
switch (expr.
Kind
)
9708
if (initializer.
Kind
== BoundKind.AddressOfOperator)
9714
if (node.Expression.
Kind
== BoundKind.AddressOfOperator)
9954
if (node.Expression.
Kind
!= BoundKind.Conversion)
10443
switch (node.
Kind
)
10463
throw ExceptionUtilities.UnexpectedValue(node.
Kind
);
FlowAnalysis\NullableWalker.DebugVerifier.cs (2)
67
if (overrideSkippedExpression || !s_skippedExpressions.Contains(expression.
Kind
))
108
if (!s_skippedExpressions.Contains(child.
Kind
))
FlowAnalysis\NullableWalker.SnapshotManager.cs (1)
109
if (node.
Kind
== BoundKind.TypeExpression || node.WasCompilerGenerated)
FlowAnalysis\NullableWalker_Patterns.cs (4)
543
throw ExceptionUtilities.UnexpectedValue(p.Evaluation.
Kind
);
620
throw ExceptionUtilities.UnexpectedValue(test.
Kind
);
679
throw ExceptionUtilities.UnexpectedValue(dagNode.
Kind
);
818
_ => throw ExceptionUtilities.UnexpectedValue(e.
Kind
)
FlowAnalysis\ReadWriteWalker.cs (4)
142
if (!IsInside && node.Span.Contains(RegionSpan) && (expr.
Kind
== BoundKind.FieldAccess))
173
switch (receiver.
Kind
)
216
switch (node.
Kind
)
271
switch (underlying.
Kind
)
FlowAnalysis\RegionAnalysisContext.cs (1)
49
switch (firstInRegion.
Kind
)
Generated\BoundNodes.xml.Generated.cs (1)
8512
switch (node.
Kind
)
Lowering\AsyncRewriter\AsyncMethodToStateMachineRewriter.cs (3)
313
if (node.Expression.
Kind
== BoundKind.AwaitExpression)
317
else if (node.Expression.
Kind
== BoundKind.AssignmentOperator)
320
if (expression.Right.
Kind
== BoundKind.AwaitExpression)
Lowering\ClosureConversion\ClosureConversion.Analysis.cs (2)
105
switch (node.
Kind
)
125
throw ExceptionUtilities.UnexpectedValue(node.
Kind
);
Lowering\ClosureConversion\ClosureConversion.cs (3)
1088
if (visited.
Kind
!= BoundKind.Call)
1317
if (node.Argument.
Kind
== BoundKind.Lambda)
1364
receiver.
Kind
== BoundKind.TypeExpression &&
Lowering\ClosureConversion\ExpressionLambdaRewriter.cs (7)
140
switch (stmt.
Kind
)
159
throw ExceptionUtilities.UnexpectedValue(stmt.
Kind
);
183
switch (node.
Kind
)
251
throw ExceptionUtilities.UnexpectedValue(node.
Kind
);
467
if (operand.
Kind
== BoundKind.Conversion)
708
if (node.Argument.
Kind
== BoundKind.MethodGroup)
864
switch (node.
Kind
)
Lowering\DiagnosticsPass_ExpressionTrees.cs (8)
242
if (_inExpressionLambda && node.Left.
Kind
!= BoundKind.ObjectInitializerMember && node.Left.
Kind
!= BoundKind.DynamicObjectInitializerMember)
266
bool hasBaseReceiver = node.ReceiverOpt != null && node.ReceiverOpt.
Kind
== BoundKind.BaseReference;
280
bool hasBaseReceiver = node.ReceiverOpt != null && node.ReceiverOpt.
Kind
== BoundKind.BaseReference;
622
if (current.Left.
Kind
== BoundKind.BinaryOperator)
688
if (operand.
Kind
== BoundKind.FieldAccess)
781
if (node.Argument.
Kind
!= BoundKind.MethodGroup)
865
if (node.Expression.
Kind
== BoundKind.MethodGroup)
Lowering\DiagnosticsPass_Warnings.cs (18)
31
switch (argument.
Kind
)
97
if (receiverOpt != null && receiverOpt.
Kind
== BoundKind.FieldAccess)
141
while (receiver.
Kind
== BoundKind.Conversion)
148
return receiver.
Kind
!= BoundKind.ThisReference && receiver.
Kind
!= BoundKind.BaseReference;
196
if (expr1.
Kind
!= expr2.
Kind
)
201
switch (expr1.
Kind
)
317
if (node.Left.ConstantValueOpt != null && node.Right.ConstantValueOpt == null && node.Right.
Kind
== BoundKind.Conversion)
322
if (node.Right.ConstantValueOpt != null && node.Left.ConstantValueOpt == null && node.Left.
Kind
== BoundKind.Conversion)
347
return node.
Kind
== BoundKind.Conversion && ((BoundConversion)node).ExplicitCastInCode;
353
if (node.
Kind
!= BoundKind.Conversion) return false;
577
if (operand.
Kind
== BoundKind.Conversion)
606
if (expr.
Kind
!= BoundKind.Conversion)
865
if (node.
Kind
== BoundKind.Conversion)
889
while (right.
Kind
== BoundKind.Conversion)
904
if (right.
Kind
!= BoundKind.ConvertedTupleLiteral && right.
Kind
!= BoundKind.TupleLiteral)
Lowering\Extensions.cs (4)
51
if (expr.
Kind
== BoundKind.ObjectCreationExpression)
56
else if (expr.
Kind
== BoundKind.Conversion)
97
if (expr.
Kind
== BoundKind.ObjectCreationExpression)
103
if (expr.
Kind
== BoundKind.Conversion)
Lowering\InitializerRewriter.cs (4)
46
(initializer.
Kind
== BoundKind.GlobalStatementInitializer) &&
84
return (statement.
Kind
== BoundKind.ExpressionStatement) && ((ExpressionStatementSyntax)statement.Syntax).SemicolonToken.IsMissing ?
121
switch (initializer.
Kind
)
128
throw ExceptionUtilities.UnexpectedValue(initializer.
Kind
);
Lowering\Instrumentation\CodeCoverageInstrumenter.cs (1)
527
switch (statement.
Kind
)
Lowering\Instrumentation\DebugInfoInjector.cs (1)
83
if (rewritten.
Kind
== BoundKind.Block)
Lowering\Instrumentation\Instrumenter.cs (1)
292
Debug.Assert(original.
Kind
== BoundKind.SwitchStatement);
Lowering\LocalRewriter\LocalRewriter.cs (12)
248
node.
Kind
is not (BoundKind.ImplicitReceiver or BoundKind.ObjectOrCollectionValuePlaceholder or BoundKind.ValuePlaceholder))
271
return node.
Kind
== BoundKind.DeconstructionAssignmentOperator && !((BoundDeconstructionAssignmentOperator)node).IsUsed;
619
if (initializer.
Kind
== BoundKind.Block)
756
switch (initializer.
Kind
)
763
if (initializer.
Kind
== BoundKind.ExpressionStatement)
771
return ((BoundExpressionStatement)initializer).Expression.
Kind
== BoundKind.AssignmentOperator;
788
if (statement.
Kind
!= BoundKind.ExpressionStatement)
799
Debug.Assert(assignment.Left.
Kind
== BoundKind.FieldAccess);
895
switch (expr.
Kind
)
984
throw ExceptionUtilities.UnexpectedValue(expr.
Kind
);
990
Debug.Assert(expr is not BoundValuePlaceholderBase, $"Placeholder kind {expr.
Kind
} must be handled explicitly");
1123
Debug.Assert(false, $"Bound nodes of kind {node.
Kind
} should not survive past local rewriting");
Lowering\LocalRewriter\LocalRewriter.DecisionDagRewriter.cs (6)
89
throw ExceptionUtilities.UnexpectedValue(node.
Kind
);
389
ImmutableArray<BoundDecisionDagNode> nodesToLower = sortedNodes.WhereAsArray(n => n.
Kind
!= BoundKind.WhenDecisionDagNode && n.
Kind
!= BoundKind.LeafDecisionDagNode);
972
if (!sortedNodes.Any(static n => n.
Kind
== BoundKind.WhenDecisionDagNode)) return;
1184
Debug.Assert(left.
Kind
== BoundKind.Local && left == binding.VariableAccess);
1233
throw ExceptionUtilities.UnexpectedValue(node.
Kind
);
Lowering\LocalRewriter\LocalRewriter.PatternLocalRewriter.cs (4)
519
if ((loweredInput.
Kind
== BoundKind.Local || loweredInput.
Kind
== BoundKind.Parameter)
644
if (canShareInputs && (expr.
Kind
== BoundKind.Parameter || expr.
Kind
== BoundKind.Local) && _tempAllocator.TrySetTemp(temp, expr))
Lowering\LocalRewriter\LocalRewriter_AssignmentOperator.cs (5)
27
switch (left.
Kind
)
94
switch (rewrittenLeft.
Kind
)
174
switch (rewrittenLeft.
Kind
)
178
throw ExceptionUtilities.UnexpectedValue(rewrittenLeft.
Kind
);
245
if (sequence.Value.
Kind
== BoundKind.IndexerAccess)
Lowering\LocalRewriter\LocalRewriter_BinaryOperator.cs (13)
282
if (loweredRight.
Kind
== BoundKind.Local || loweredRight.
Kind
== BoundKind.Parameter)
294
if (loweredRight.
Kind
== BoundKind.Local || loweredRight.
Kind
== BoundKind.Parameter)
481
if (loweredLeft.
Kind
== BoundKind.ArrayLength && loweredRight.IsDefaultValue())
496
if (loweredRight.
Kind
== BoundKind.ArrayLength && loweredLeft.IsDefaultValue())
511
if (loweredLeft.
Kind
== BoundKind.ArrayLength && loweredRight.IsDefaultValue())
515
else if (loweredRight.
Kind
== BoundKind.ArrayLength && loweredLeft.IsDefaultValue())
650
if (constantLeft == null && loweredLeft.
Kind
!= BoundKind.Local && loweredLeft.
Kind
!= BoundKind.Parameter)
711
if (expression.
Kind
== BoundKind.Conversion)
1527
if (nonNullRight != null && nonNullRight.ConstantValueOpt != null && left.
Kind
== BoundKind.Sequence)
1530
if (seq.Value.
Kind
== BoundKind.ConditionalOperator)
Lowering\LocalRewriter\LocalRewriter_Block.cs (1)
84
switch (node.
Kind
)
Lowering\LocalRewriter\LocalRewriter_Call.cs (6)
34
switch (node.Expression.
Kind
)
44
Debug.Assert(methodGroup.ReceiverOpt == null || methodGroup.ReceiverOpt.
Kind
!= BoundKind.TypeOrValueExpression);
317
switch (current.
Kind
)
630
var u => throw ExceptionUtilities.UnexpectedValue(u.
Kind
)
1409
if (argument?.
Kind
== BoundKind.Local)
1499
if (argument.
Kind
== BoundKind.Local)
Lowering\LocalRewriter\LocalRewriter_CompoundAssignmentOperator.cs (7)
41
if (node.Left.
Kind
== BoundKind.DynamicMemberAccess &&
188
Debug.Assert(receiverOpt.
Kind
!= BoundKind.TypeExpression);
472
Debug.Assert(receiver.
Kind
!= BoundKind.TypeExpression);
582
switch (originalLHS.
Kind
)
729
throw ExceptionUtilities.UnexpectedValue(originalLHS.
Kind
);
825
switch (expression.
Kind
)
866
switch (expression.
Kind
)
Lowering\LocalRewriter\LocalRewriter_Conversion.cs (4)
31
_ => throw ExceptionUtilities.UnexpectedValue(node.Operand.
Kind
)
226
switch (rewrittenNode.
Kind
)
1158
if (operand.
Kind
== BoundKind.Sequence)
1161
if (seq.Value.
Kind
== BoundKind.ConditionalOperator)
Lowering\LocalRewriter\LocalRewriter_DeconstructionAssignmentOperator.cs (11)
62
if (right.
Kind
== BoundKind.ConditionalOperator)
114
Debug.Assert(right is not ({
Kind
: BoundKind.TupleLiteral } or BoundConversion { Operand.
Kind
: BoundKind.TupleLiteral }));
117
right is {
Kind
: BoundKind.ConvertedTupleLiteral } or BoundConversion { Operand.
Kind
: BoundKind.ConvertedTupleLiteral }
252
if (leftTarget.
Kind
!= BoundKind.DiscardExpression)
285
Debug.Assert(!IsTupleExpression(right.
Kind
));
296
if (IsTupleExpression(right.
Kind
))
304
if (right.
Kind
== BoundKind.Conversion)
308
&& IsTupleExpression(tupleConversion.Operand.
Kind
))
449
switch (variable.
Kind
)
Lowering\LocalRewriter\LocalRewriter_DelegateCreationExpression.cs (1)
26
if (node.Argument.
Kind
== BoundKind.MethodGroup)
Lowering\LocalRewriter\LocalRewriter_ExpressionStatement.cs (1)
48
switch (expression.
Kind
)
Lowering\LocalRewriter\LocalRewriter_Field.cs (1)
66
if (rewrittenReceiver?.
Kind
== BoundKind.DefaultExpression)
Lowering\LocalRewriter\LocalRewriter_FixedStatement.cs (1)
245
Debug.Assert(initializerExpr.
Kind
== BoundKind.AddressOfOperator);
Lowering\LocalRewriter\LocalRewriter_ForStatement.cs (4)
52
Debug.Assert(original.
Kind
== BoundKind.ForStatement || original.
Kind
== BoundKind.ForEachStatement);
147
switch (original.
Kind
)
156
throw ExceptionUtilities.UnexpectedValue(original.
Kind
);
Lowering\LocalRewriter\LocalRewriter_IndexerAccess.cs (6)
264
if (node.LengthOrCountAccess.
Kind
is not BoundKind.Local || receiver.
Kind
is not (BoundKind.Local or BoundKind.Parameter))
305
if (makeOffsetInput.ConstantValueOpt is null && lengthAccess.
Kind
is not BoundKind.ArrayLength)
572
if (node.LengthOrCountAccess.
Kind
is not BoundKind.Local || receiver.
Kind
is not (BoundKind.Local or BoundKind.Parameter))
725
if ((rewriteFlags & captureLength) != 0 && lengthAccess.
Kind
is not BoundKind.Local)
Lowering\LocalRewriter\LocalRewriter_IsOperator.cs (2)
33
if (rewrittenOperand.
Kind
== BoundKind.MethodGroup)
37
if (receiver != null && receiver.
Kind
!= BoundKind.ThisReference)
Lowering\LocalRewriter\LocalRewriter_IsPatternOperator.cs (3)
244
while (node.
Kind
!= BoundKind.LeafDecisionDagNode && node.
Kind
!= BoundKind.WhenDecisionDagNode)
299
throw ExceptionUtilities.UnexpectedValue(node.
Kind
);
Lowering\LocalRewriter\LocalRewriter_NullCoalescingAssignmentOperator.cs (2)
90
Debug.Assert(!_inExpressionLambda && lhsRead.
Kind
!= BoundKind.PropertyAccess);
94
if (lhsRead.
Kind
== BoundKind.Call)
Lowering\LocalRewriter\LocalRewriter_NullCoalescingOperator.cs (2)
183
if (expression.
Kind
!= BoundKind.Call)
212
while (expression.
Kind
== BoundKind.Conversion)
Lowering\LocalRewriter\LocalRewriter_ObjectOrCollectionInitializerExpression.cs (10)
28
throw ExceptionUtilities.UnexpectedValue(initializerExpression.
Kind
);
63
throw ExceptionUtilities.UnexpectedValue(initializerExpression.
Kind
);
71
switch (initializerExpression.
Kind
)
82
throw ExceptionUtilities.UnexpectedValue(initializerExpression.
Kind
);
99
if (initializer.
Kind
== BoundKind.CollectionElementInitializer)
106
Debug.Assert(initializer.
Kind
== BoundKind.DynamicCollectionElementInitializer);
280
if (assignment.Left.
Kind
!= BoundKind.PointerElementAccess)
285
BoundKind rhsKind = assignment.Right.
Kind
;
289
switch ((rewrittenLeft ?? assignment.Left).
Kind
)
447
throw ExceptionUtilities.UnexpectedValue((rewrittenLeft ?? assignment.Left).
Kind
);
Lowering\LocalRewriter\LocalRewriter_StringConcat.cs (2)
156
switch (lowered.
Kind
)
373
if (expr.
Kind
== BoundKind.Conversion)
Lowering\LocalRewriter\LocalRewriter_StringInterpolation.cs (2)
128
throw ExceptionUtilities.UnexpectedValue(part.
Kind
);
325
if (length == 1 && result is not ({
Kind
: BoundKind.InterpolatedString } or { ConstantValueOpt.IsString: true }))
Lowering\LocalRewriter\LocalRewriter_TryStatement.cs (1)
50
switch (statement.
Kind
)
Lowering\LocalRewriter\LocalRewriter_UnaryOperator.cs (5)
45
if (node.Operand.
Kind
== BoundKind.BinaryOperator)
316
if (loweredOperand.
Kind
== BoundKind.Sequence)
319
if (seq.Value.
Kind
== BoundKind.ConditionalOperator)
482
switch (expression.
Kind
)
845
switch (transformedExpression.
Kind
)
Lowering\LocalRewriter\LocalRewriter_UsingStatement.cs (1)
39
BoundBlock tryBlock = rewrittenBody.
Kind
== BoundKind.Block
Lowering\LocalRewriter\LocalRewriter_WhileStatement.cs (4)
49
Debug.Assert(loop.
Kind
== BoundKind.WhileStatement || loop.
Kind
== BoundKind.ForEachStatement);
72
switch (loop.
Kind
)
83
throw ExceptionUtilities.UnexpectedValue(loop.
Kind
);
Lowering\LocalRewriter\LoweredDynamicOperationFactory.cs (4)
225
if (loweredReceiver.
Kind
== BoundKind.TypeExpression)
550
switch (loweredReceiver.
Kind
)
567
throw ExceptionUtilities.UnexpectedValue(loweredReceiver.
Kind
);
687
int discardCount = loweredArguments.Count(a => a.
Kind
== BoundKind.DiscardExpression);
Lowering\MethodToClassRewriter.cs (7)
70
Debug.Fail($"Override the visitor for {node.
Kind
}");
475
if (originalLeft.
Kind
!= BoundKind.Local)
489
Debug.Assert(originalRight.
Kind
!= BoundKind.ConvertedStackAllocExpression);
511
if (rewrittenLeft.
Kind
!= BoundKind.Local && originalRight.
Kind
== BoundKind.ConvertedStackAllocExpression)
723
return originalReceiver is {
Kind
: BoundKind.BaseReference } &&
724
rewrittenReceiver is {
Kind
: not BoundKind.BaseReference };
Lowering\SpillSequenceSpiller.cs (7)
48
Debug.Assert(value?.
Kind
!= SpillSequenceBuilderKind);
248
if (e == null || e.
Kind
!= SpillSequenceBuilderKind)
315
switch (expression.
Kind
)
353
assignment is not { Left.
Kind
: BoundKind.Local, Right.
Kind
: BoundKind.ArrayAccess }) // Optimize for some known to be safe scenarios.
540
if (newList[i].
Kind
== SpillSequenceBuilderKind)
801
switch (left.
Kind
)
Lowering\StateMachineRewriter\IteratorAndAsyncCaptureWalker.cs (1)
269
if (node.ReceiverOpt != null && node.ReceiverOpt.
Kind
== BoundKind.ThisReference)
Lowering\StateMachineRewriter\MethodToStateMachineRewriter.cs (6)
407
if (statement.
Kind
== BoundKind.Block)
411
if (rewrittenStatements.Length == 1 && rewrittenStatements[0].
Kind
== BoundKind.StateMachineScope)
550
switch (expr.
Kind
)
585
if (receiver.
Kind
!= BoundKind.ThisReference && !isFieldOfStruct)
640
throw ExceptionUtilities.UnexpectedValue(expr.
Kind
);
793
if (node.Left.
Kind
!= BoundKind.Local)
Lowering\SyntheticBoundNodeFactory.cs (3)
540
if (body.
Kind
!= BoundKind.Block)
1604
var discardsPresent = arguments.Any(static a => a.
Kind
== BoundKind.DiscardExpression);
1609
(arg, t) => arg.
Kind
== BoundKind.DiscardExpression ? t.factory.MakeTempForDiscard((BoundDiscardExpression)arg, t.builder) : arg,
Operations\CSharpOperationFactory.cs (32)
35
switch (boundNode.
Kind
)
309
switch (boundNode.
Kind
)
330
throw ExceptionUtilities.UnexpectedValue(boundNode.
Kind
);
395
switch (declaration.
Kind
)
413
throw ExceptionUtilities.UnexpectedValue(declaration.
Kind
);
519
switch (declaration.
Kind
)
545
throw ExceptionUtilities.UnexpectedValue(declaration.
Kind
);
605
throw ExceptionUtilities.UnexpectedValue(boundNode.
Kind
);
796
throw ExceptionUtilities.UnexpectedValue(indexer.
Kind
);
811
throw ExceptionUtilities.UnexpectedValue(indexer.
Kind
);
952
if (receiver?.
Kind
== BoundKind.TypeExpression)
1064
Debug.Assert(boundOperand.
Kind
== BoundKind.BadExpression ||
1066
ExpressionOpt?.
Kind
== BoundKind.BadExpression);
1076
if (boundOperand.
Kind
== BoundKind.ConvertedTupleLiteral && TypeSymbol.Equals(boundOperand.Type, boundConversion.Type, TypeCompareKind.ConsiderEverything2))
1090
if (boundConversion.ExplicitCastInCode && conversion.IsIdentity && boundOperand.
Kind
== BoundKind.Conversion)
1096
nestedOperand.
Kind
== BoundKind.ConvertedTupleLiteral &&
1112
if ((boundOperand.
Kind
== BoundKind.Lambda ||
1113
boundOperand.
Kind
== BoundKind.UnboundLambda ||
1114
boundOperand.
Kind
== BoundKind.MethodGroup) &&
1260
boundAssignmentOperator.Right?.
Kind
== BoundKind.ObjectInitializerExpression ||
1261
boundAssignmentOperator.Right?.
Kind
== BoundKind.CollectionInitializerExpression;
1408
{
Kind
: var kind } => throw ExceptionUtilities.UnexpectedValue(kind)
1576
if (boundIndexerAccess.LengthOrCountAccess.
Kind
== BoundKind.ArrayLength)
2136
{
Kind
: var kind } => throw ExceptionUtilities.UnexpectedValue(kind)
2163
if (part.
Kind
== BoundKind.StringInsert)
2223
throw ExceptionUtilities.UnexpectedValue(part.
Kind
);
2239
_ => throw ExceptionUtilities.UnexpectedValue(value.
Kind
),
2336
_ => throw ExceptionUtilities.UnexpectedValue(part.
Kind
)
2359
throw ExceptionUtilities.UnexpectedValue(current.
Kind
);
2422
if (variable == null && boundDeclarationPattern.VariableAccess?.
Kind
== BoundKind.DiscardExpression)
2608
Debug.Assert(boundSwitchLabel.Pattern.
Kind
== BoundKind.DiscardPattern);
2612
boundSwitchLabel.Pattern.
Kind
== BoundKind.ConstantPattern &&
Operations\CSharpOperationFactory_Methods.cs (9)
25
if (statement.
Kind
== BoundKind.StatementList)
100
if (instance == null || instance.
Kind
== BoundKind.TypeExpression)
106
if (symbol != null && symbol.IsStatic && instance.WasCompilerGenerated && instance.
Kind
== BoundKind.ThisReference)
163
if (boundDelegateCreationExpression.Argument.
Kind
== BoundKind.MethodGroup &&
196
switch (containingExpression.
Kind
)
274
throw ExceptionUtilities.UnexpectedValue(containingExpression.
Kind
);
313
|| (receiverOpt.
Kind
!= BoundKind.ThisReference
314
&& receiverOpt.
Kind
!= BoundKind.BaseReference
315
&& receiverOpt.
Kind
!= BoundKind.ObjectOrCollectionValuePlaceholder)))
Symbols\ConstantValueUtils.cs (1)
98
while (unconvertedBoundValue.
Kind
== BoundKind.Conversion)
Symbols\FunctionTypeSymbol.cs (1)
68
Debug.Assert(expression.
Kind
is BoundKind.MethodGroup or BoundKind.UnboundLambda);
Symbols\Source\ParameterHelpers.cs (1)
851
switch (expression.
Kind
)
Symbols\Source\SourceComplexParameterSymbol.cs (1)
393
if (convertedExpression.ConstantValueOpt == null && convertedExpression.
Kind
== BoundKind.Conversion &&
Microsoft.CodeAnalysis.CSharp.ExpressionEvaluator.ExpressionCompiler (6)
Rewriters\CapturedVariableRewriter.cs (1)
120
var boundKind = node.
Kind
;
Rewriters\LocalDeclarationRewriter.cs (1)
33
switch (node.
Kind
)
Rewriters\MayHaveSideEffectsVisitor.cs (1)
73
var expr = (initializer.
Kind
== BoundKind.AssignmentOperator)
Symbols\EEMethodSymbol.cs (3)
543
if (body.
Kind
!= BoundKind.ReturnStatement)
737
switch (bodyOpt.
Kind
)
746
throw ExceptionUtilities.UnexpectedValue(bodyOpt.
Kind
);
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (21)
Semantics\ConstantTests.cs (4)
592
var actual = ParseAndGetConstantFoldingSteps(source, node => node.
Kind
== BoundKind.BinaryOperator);
641
var actual = ParseAndGetConstantFoldingSteps(source, node => node.
Kind
== BoundKind.UnaryOperator);
1448
return ParseAndGetConstantFoldingSteps(source, node => node.
Kind
!= BoundKind.Literal && node.
Kind
!= BoundKind.Local);
Semantics\FieldInitializerBindingTests.cs (1)
274
Assert.Equal(BoundKind.FieldEqualsValue, boundInit.
Kind
);
Semantics\SemanticAnalyzerTests.cs (14)
1332
Assert.Equal(BoundKind.LocalDeclaration, block.Statements[0].
Kind
);
1335
Assert.Equal(BoundKind.ObjectCreationExpression, decl.InitializerOpt.
Kind
);
1360
Assert.Equal(BoundKind.LocalDeclaration, block.Statements[0].
Kind
);
1363
Assert.Equal(BoundKind.ObjectCreationExpression, decl.InitializerOpt.
Kind
);
1388
Assert.Equal(BoundKind.LocalDeclaration, block.Statements[0].
Kind
);
1391
Assert.Equal(BoundKind.ObjectCreationExpression, decl.InitializerOpt.
Kind
);
1425
Assert.Equal(BoundKind.LocalDeclaration, block.Statements[0].
Kind
);
1428
Assert.Equal(BoundKind.ObjectCreationExpression, decl.InitializerOpt.
Kind
);
1459
Assert.Equal(BoundKind.LocalDeclaration, block.Statements[0].
Kind
);
1462
Assert.Equal(BoundKind.ObjectCreationExpression, decl.InitializerOpt.
Kind
);
1494
Assert.Equal(BoundKind.LocalDeclaration, block.Statements[0].
Kind
);
1497
Assert.Equal(BoundKind.ObjectCreationExpression, decl.InitializerOpt.
Kind
);
1529
Assert.Equal(BoundKind.LocalDeclaration, block.Statements[0].
Kind
);
1532
Assert.Equal(BoundKind.ObjectCreationExpression, decl.InitializerOpt.
Kind
);
Semantics\UnsafeTests.cs (2)
2437
_builder.Add($"Yes, {expr.
Kind
} '{text}' requires fixing.");
2441
_builder.Add(string.Concat($"No, {expr.
Kind
} '{text}' does not require fixing.", accessedLocalOrParameterOpt is null