701 references to Kind
Microsoft.CodeAnalysis.CSharp (701)
Binder\Binder.cs (1)
873
RoslynDebug.Assert(statement.
Kind
!= BoundKind.StatementList);
Binder\Binder.ValueChecks.cs (28)
483
switch (expr.
Kind
)
589
if (expr.
Kind
== BoundKind.MethodGroup && valueKind != BindValueKind.RValueOrMethodGroup)
614
if ((object)otherSymbol != null && receiver?.
Kind
== BoundKind.TypeOrValueExpression)
651
switch (expression?.
Kind
)
654
case BoundKind.QueryClause when ((BoundQueryClause)expression).Value.
Kind
== BoundKind.TypeOrValueExpression:
683
switch (expr.
Kind
)
688
case BoundKind.ImplicitIndexerAccess when ((BoundImplicitIndexerAccess)expr).IndexerOrSliceAccess.
Kind
== BoundKind.IndexerAccess:
709
switch (expr.
Kind
)
873
throw ExceptionUtilities.UnexpectedValue(implicitIndexer.IndexerOrSliceAccess.
Kind
);
946
RoslynDebug.Assert(expr is not BoundValuePlaceholderBase, $"Placeholder kind {expr.
Kind
} should be explicitly handled");
991
switch (expr.
Kind
)
1608
return Flags.Includes(BinderFlags.ObjectInitializerMember) && receiver.
Kind
== BoundKind.ObjectOrCollectionValuePlaceholder ||
1772
ReportDiagnosticsIfObsolete(diagnostics, setMethod, node, receiver?.
Kind
== BoundKind.BaseReference);
1822
ReportDiagnosticsIfObsolete(diagnostics, getMethod, node, receiver?.
Kind
== BoundKind.BaseReference);
1905
if (receiverOpt?.
Kind
== BoundKind.BaseReference && member.IsAbstract)
2318
if (argument.
Kind
== BoundKind.ArgListOperator)
3343
switch (expr.
Kind
)
3523
throw ExceptionUtilities.UnexpectedValue(implicitIndexerAccess.IndexerOrSliceAccess.
Kind
);
3658
switch (expr.
Kind
)
3844
throw ExceptionUtilities.UnexpectedValue(implicitIndexerAccess.IndexerOrSliceAccess.
Kind
);
4046
switch (expr.
Kind
)
4218
throw ExceptionUtilities.UnexpectedValue(implicitIndexerAccess.IndexerOrSliceAccess.
Kind
);
4508
RoslynDebug.Assert(false, $"{expr.
Kind
} expression of {expr.Type} type");
4595
if (expr.
Kind
== BoundKind.AssignmentOperator)
4743
switch (expr.
Kind
)
4957
throw ExceptionUtilities.UnexpectedValue(implicitIndexerAccess.IndexerOrSliceAccess.
Kind
);
5309
RoslynDebug.Assert(false, $"{expr.
Kind
} expression of {expr.Type} type");
5639
throw ExceptionUtilities.UnexpectedValue(expression.
Kind
);
Binder\Binder_Attributes.cs (2)
812
switch (assignment.Left.
Kind
)
862
switch (node.
Kind
)
Binder\Binder_Await.cs (4)
78
if (expression.
Kind
!= BoundKind.Call ||
340
if (getAwaiterCall.
Kind
!= BoundKind.Call)
379
if (qualified.
Kind
!= BoundKind.PropertyAccess)
447
if (getAwaiterGetResultCall.
Kind
!= BoundKind.Call)
Binder\Binder_Conversions.cs (4)
138
if (conversion.IsAnonymousFunction && source.
Kind
== BoundKind.UnboundLambda)
209
if (source.
Kind
== BoundKind.UnconvertedSwitchExpression)
231
if (source.
Kind
== BoundKind.UnconvertedCollectionExpression)
253
if (source.
Kind
== BoundKind.UnconvertedConditionalOperator)
Binder\Binder_Deconstruct.cs (7)
212
if (boundRHS.
Kind
== BoundKind.TupleLiteral)
369
switch (expression.
Kind
)
383
throw ExceptionUtilities.UnexpectedValue(expression.
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 (40)
200
BoundKind exprKind = expr.
Kind
;
254
if (valueOrType.
Kind
== BoundKind.TypeExpression)
411
Debug.Assert(expr.
Kind
is BoundKind.UnboundLambda or BoundKind.MethodGroup);
539
if (expr.
Kind
== BoundKind.ArgListOperator)
581
if (IsEarlyAttributeBinder && result.
Kind
== BoundKind.MethodGroup && (!IsInsideNameof || EnclosingNameofArgument != node))
2727
if (operand.
Kind
== BoundKind.UnboundLambda)
2774
switch (operand.
Kind
)
3071
switch (arg.
Kind
)
3529
else if (argument.
Kind
== BoundKind.OutVariablePendingInference)
3533
else if (argument.
Kind
== BoundKind.OutDeconstructVarPendingInference)
3537
else if (argument.
Kind
== BoundKind.DiscardExpression && !argument.HasExpressionType())
5379
else if (argument.
Kind
== BoundKind.MethodGroup)
5816
if (boundMember.
Kind
== BoundKind.PropertyGroup)
5858
BoundKind boundMemberKind = boundMember.
Kind
;
6447
if (addMethodInvocation.
Kind
== BoundKind.DynamicInvocation)
6458
else if (addMethodInvocation.
Kind
== BoundKind.Call)
6487
Debug.Assert(addMethodInvocation.
Kind
== BoundKind.BadExpression);
6964
switch (classCreation.
Kind
)
6977
throw ExceptionUtilities.UnexpectedValue(classCreation.
Kind
);
7449
if (boundValue.
Kind
== BoundKind.Conversion)
7641
if (boundLeft.
Kind
== BoundKind.UnboundLambda)
7686
switch (boundLeft.
Kind
)
7718
if (boundLeft.
Kind
== BoundKind.Literal && ((BoundLiteral)boundLeft).ConstantValueOpt == ConstantValue.Null)
7889
switch (expr.
Kind
)
7946
bool leftIsBaseReference = boundLeft.
Kind
== BoundKind.BaseReference;
8037
if (boundLeft.HasAnyErrors && boundLeft.
Kind
!= BoundKind.TypeOrValueExpression)
8059
else if (boundLeft.
Kind
== BoundKind.TypeExpression ||
8060
boundLeft.
Kind
== BoundKind.BaseReference ||
8276
ReportDiagnosticsIfObsolete(diagnostics, symbol, node, hasBaseReceiver: left.
Kind
== BoundKind.BaseReference);
8679
ReportDiagnosticsIfObsolete(diagnostics, propertySymbol, node, hasBaseReceiver: receiver?.
Kind
== BoundKind.BaseReference);
8782
switch (receiver.
Kind
)
8980
if (receiver.
Kind
== BoundKind.PropertyGroup)
9395
if (index.
Kind
== BoundKind.OutVariablePendingInference)
9399
else if (index.
Kind
== BoundKind.DiscardExpression && !index.HasExpressionType())
9587
LookupOptions lookupOptions = expr.
Kind
== BoundKind.BaseReference ? LookupOptions.UseBaseReferenceAccessibility : LookupOptions.Default;
9701
BoundKind receiverKind = receiver.
Kind
;
9843
ReportDiagnosticsIfObsolete(diagnostics, property, syntax, hasBaseReceiver: receiver != null && receiver.
Kind
== BoundKind.BaseReference);
9853
if (!gotError && receiver != null && receiver.
Kind
== BoundKind.ThisReference && receiver.WasCompilerGenerated)
10958
if (access.
Kind
== BoundKind.MethodGroup)
11117
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)
571
_ => throw ExceptionUtilities.UnexpectedValue(unconvertedExpression.
Kind
)
Binder\Binder_Invocation.cs (27)
107
if (!allowFieldsAndProperties && (boundExpression.
Kind
== BoundKind.FieldAccess || boundExpression.
Kind
== BoundKind.PropertyAccess))
112
if (boundExpression.
Kind
== BoundKind.FieldAccess)
124
Debug.Assert(allowFieldsAndProperties || boundExpression.
Kind
is (BoundKind.MethodGroup or BoundKind.BadExpression));
129
Debug.Assert(!args.Any(static e => e.
Kind
== BoundKind.OutVariablePendingInference ||
130
e.
Kind
== BoundKind.OutDeconstructVarPendingInference ||
131
e.
Kind
== BoundKind.DiscardExpression && !e.HasExpressionType()));
145
if (queryClause != null && result.
Kind
== BoundKind.DynamicInvocation)
161
if (boundExpression.
Kind
== BoundKind.FieldAccess)
246
string name = boundExpression.
Kind
== BoundKind.MethodGroup ? GetName(node.Expression) : null;
274
if (argument.
Kind
== BoundKind.OutVariablePendingInference)
350
else if (boundExpression.
Kind
== BoundKind.MethodGroup)
402
if (expression.
Kind
== BoundKind.MethodGroup)
410
switch (receiver.
Kind
)
585
if (arg.
Kind
== BoundKind.Lambda || arg.
Kind
== BoundKind.UnboundLambda)
591
else if (arg.
Kind
== BoundKind.MethodGroup)
597
else if (arg.
Kind
== BoundKind.ArgListOperator)
1040
switch (expression.
Kind
)
1056
else if (call.ReceiverOpt.
Kind
== BoundKind.BaseReference && this.ContainingType.IsRestrictedType())
1080
throw ExceptionUtilities.UnexpectedValue(expression.
Kind
);
1265
if (!gotError && method.RequiresInstanceReceiver && receiver != null && receiver.
Kind
== BoundKind.ThisReference && receiver.WasCompilerGenerated)
1281
bool hasBaseReceiver = receiver != null && receiver.
Kind
== BoundKind.BaseReference;
1835
switch (receiver.
Kind
)
1901
if ((object)expr != null && expr.
Kind
!= BoundKind.TypeExpression)
2179
var originalMethods = (expr.
Kind
== BoundKind.MethodGroup) ? ((BoundMethodGroup)expr).Methods : ImmutableArray<MethodSymbol>.Empty;
2227
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)
784
_ => throw ExceptionUtilities.UnexpectedValue(current.Right.
Kind
)
834
switch (left.
Kind
, right.
Kind
)
1951
if (left.
Kind
== BoundKind.Conversion && right.
Kind
== BoundKind.Conversion)
2449
switch (expr.
Kind
)
2573
BoundKind exprKind = expr.
Kind
;
3162
switch (operand.
Kind
)
3294
operand.
Kind
== BoundKind.MethodGroup ||
3710
switch (operand.
Kind
)
4023
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 };
686
if (convertedExpression.
Kind
== BoundKind.Conversion)
1561
if (boundMember.
Kind
== BoundKind.PropertyGroup)
1569
switch (boundMember.
Kind
)
Binder\Binder_Query.cs (7)
924
while (ultimateReceiver.
Kind
== BoundKind.QueryClause)
947
else if (ultimateReceiver.
Kind
== BoundKind.NamespaceExpression)
951
else if (ultimateReceiver.
Kind
== BoundKind.Lambda || ultimateReceiver.
Kind
== BoundKind.UnboundLambda)
956
else if (ultimateReceiver.
Kind
== BoundKind.MethodGroup)
977
else if (ultimateReceiver.
Kind
== BoundKind.TypeExpression)
985
else if (ultimateReceiver.
Kind
== BoundKind.TypeOrValueExpression)
Binder\Binder_QueryErrors.cs (1)
220
if (arg.
Kind
== BoundKind.UnboundLambda)
Binder\Binder_Statements.cs (26)
152
(result.
Kind
== BoundKind.Block &&
892
BoundExpression expression = value.
Kind
is BoundKind.UnboundLambda or BoundKind.MethodGroup ?
1245
switch (initializerOpt.
Kind
)
1428
bool discardAssignment = op1.
Kind
== BoundKind.DiscardExpression;
1496
if (op1.
Kind
!= BoundKind.DynamicIndexerAccess &&
1497
op1.
Kind
!= BoundKind.DynamicMemberAccess &&
1498
op1.
Kind
!= BoundKind.DynamicObjectInitializerMember)
1513
if ((op1.
Kind
== BoundKind.EventAccess) &&
1570
else if (op1.
Kind
is BoundKind.Local or BoundKind.Parameter)
1583
Debug.Assert(op1.
Kind
!= BoundKind.Parameter); // If the assert fails, add a corresponding test.
1635
switch (expr.
Kind
)
1668
throw ExceptionUtilities.UnexpectedValue(implicitIndexerAccess.IndexerOrSliceAccess.
Kind
);
1719
_ => throw ExceptionUtilities.UnexpectedValue(e.
Kind
)
1775
(propertyIsStatic || receiver?.
Kind
== BoundKind.ThisReference);
1810
else if (receiver.
Kind
== BoundKind.BaseReference)
1936
if (expression.HasAnyErrors && expression.
Kind
!= BoundKind.UnboundLambda)
2320
switch (operand.
Kind
)
2440
Debug.Assert(operand.HasAnyErrors && operand.
Kind
!= BoundKind.UnboundLambda, "Missing a case in implicit conversion error reporting");
2683
if (expr.
Kind
== BoundKind.AssignmentOperator)
2686
if (assignment.Right.
Kind
== BoundKind.Literal && assignment.Right.ConstantValueOpt.Discriminator == ConstantValueTypeDiscriminator.Boolean)
3160
if (!argument.HasAnyErrors || argument.
Kind
== BoundKind.UnboundLambda)
3434
if (expression.
Kind
== BoundKind.DelegateCreationExpression || expression.
Kind
== BoundKind.NameOfOperator)
3462
if ((refKind != RefKind.None) != (returnRefKind != RefKind.None) && expression.
Kind
!= BoundKind.ThrowExpression)
4116
if (boundAccess.
Kind
!= BoundKind.MethodGroup)
4142
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)
314
throw ExceptionUtilities.UnexpectedValue(pattern.
Kind
);
962
throw ExceptionUtilities.UnexpectedValue(n.
Kind
);
1061
throw ExceptionUtilities.UnexpectedValue(n?.
Kind
);
1737
return $"t{tempIdentifier(a)}={a.
Kind
}({tempName(a.Input)} as {a.Type})";
1739
return $"t{tempIdentifier(e)}={e.
Kind
}({tempName(e.Input)}.{e.Field.Name})";
1741
return $"t{tempIdentifier(e)}={e.
Kind
}({tempName(e.Input)}.{e.Property.Name})";
1743
return $"t{tempIdentifier(e)}={e.
Kind
}({tempName(e.Input)}[{e.Index}])";
1745
return $"{e.
Kind
}({tempName(e.Target)}<--{tempName(e.Input)})";
1747
return $"t{tempIdentifier(e)}={e.
Kind
}({tempName(e.Input)})";
1749
return $"?{d.
Kind
}({tempName(d.Input)} is {b.Type})";
1751
return $"?{d.
Kind
}({tempName(d.Input)} == {v.Value})";
1761
return $"?{d.
Kind
}({tempName(d.Input)} {operatorName} {r.Value})";
1763
return $"?{d.
Kind
}({tempName(d.Input)})";
2431
if (RemainingTests[0] is One { Test: {
Kind
: BoundKind.DagNonNullTest } planA })
2438
case One { Test: {
Kind
: BoundKind.DagTypeTest } planB1 }:
2445
case One { Test: {
Kind
: BoundKind.DagValueTest } planB2 }:
Binder\ForEachLoopBinder.cs (1)
400
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)
541
if (node.Left.
Kind
!= BoundKind.DiscardExpression)
Binder\Semantics\Conversions\ConversionsBase.cs (4)
1059
switch (sourceExpression.
Kind
)
1410
if (sourceExpression.
Kind
== BoundKind.TupleLiteral)
1648
if (source.
Kind
!= BoundKind.UnboundLambda)
1951
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 (14)
609
if (argument.
Kind
== BoundKind.UnboundLambda && target.Type.GetDelegateType() is { })
614
else if (argument.
Kind
== BoundKind.UnconvertedCollectionExpression)
618
else if (argument.
Kind
!= BoundKind.TupleLiteral ||
851
if (argument.
Kind
== BoundKind.TupleLiteral && (object)argument.Type == null)
855
else if (argument.
Kind
== BoundKind.UnconvertedCollectionExpression)
995
if ((isFunctionPointer && argument.
Kind
!= BoundKind.UnconvertedAddressOfOperator) ||
996
(!isFunctionPointer && argument.
Kind
is not (BoundKind.UnboundLambda or BoundKind.MethodGroup)))
1051
if ((isFunctionPointer && argument.
Kind
!= BoundKind.UnconvertedAddressOfOperator) ||
1052
(!isFunctionPointer && argument.
Kind
is not (BoundKind.UnboundLambda or BoundKind.MethodGroup)))
1420
if (source.
Kind
is not (BoundKind.MethodGroup or BoundKind.UnconvertedAddressOfOperator))
1431
if (delegateOrFunctionPointerType.IsFunctionPointer() != (source.
Kind
== BoundKind.UnconvertedAddressOfOperator))
1529
if (source.
Kind
!= BoundKind.UnboundLambda)
1583
if (source.
Kind
!= BoundKind.UnboundLambda)
3060
if (source.
Kind
!= BoundKind.UnboundLambda)
Binder\Semantics\OverloadResolution\OverloadResolution.cs (9)
2900
var nodeKind = node.
Kind
;
3236
if (node.
Kind
== BoundKind.TupleLiteral)
3252
if (node.
Kind
== BoundKind.UnboundLambda &&
3292
if (lambda.Body.Statements[0].
Kind
== BoundKind.ReturnStatement)
3547
if (node?.
Kind
== BoundKind.MethodGroup)
4427
if (argument.
Kind
== BoundKind.ArgListOperator)
4596
if (argument.
Kind
== BoundKind.OutVariablePendingInference ||
4597
argument.
Kind
== BoundKind.OutDeconstructVarPendingInference ||
4598
(argument.
Kind
== BoundKind.DiscardExpression && (object)argType == null))
Binder\Semantics\OverloadResolution\OverloadResolutionResult.cs (12)
659
if (receiverOpt?.
Kind
== BoundKind.QueryClause)
1208
argument.
Kind
!= BoundKind.OutDeconstructVarPendingInference &&
1209
argument.
Kind
!= BoundKind.OutVariablePendingInference &&
1210
argument.
Kind
!= BoundKind.DiscardExpression)
1216
if (argument.
Kind
== BoundKind.UnboundLambda && refArg == refParameter)
1220
else if (argument.
Kind
== BoundKind.MethodGroup && parameterType.TypeKind == TypeKind.Delegate &&
1225
else if (argument.
Kind
== BoundKind.MethodGroup && parameterType.TypeKind == TypeKind.FunctionPointer)
1229
else if (argument.
Kind
== BoundKind.UnconvertedAddressOfOperator &&
1234
else if (argument.
Kind
== BoundKind.UnconvertedCollectionExpression)
1299
Debug.Assert(argument.
Kind
!= BoundKind.OutDeconstructVarPendingInference);
1300
Debug.Assert(argument.
Kind
!= BoundKind.OutVariablePendingInference);
1301
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)
42
throw ExceptionUtilities.UnexpectedValue(node.
Kind
);
205
return this.TopologicallySortedNodes.Any(static node => node is BoundEvaluationDecisionDagNode e && e.Evaluation.
Kind
== BoundKind.DagAssignmentEvaluation);
BoundTree\BoundExpression.cs (5)
56
if ((
Kind
!= BoundKind.Local &&
Kind
!= BoundKind.Parameter) || this.WasConverted)
74
switch (
Kind
)
605
return this.Condition.
Kind
== BoundKind.UnaryOperator && ((BoundUnaryOperator)this.Condition).OperatorKind.IsDynamic();
731
if (argument.
Kind
== BoundKind.TupleLiteral)
BoundTree\BoundExpressionExtensions.cs (9)
22
switch (node.
Kind
)
83
return node is {
Kind
: BoundKind.Literal, ConstantValueOpt: { Discriminator: ConstantValueTypeDiscriminator.Null } };
88
return node.
Kind
== BoundKind.DefaultLiteral;
93
return node.
Kind
== BoundKind.UnconvertedObjectCreationExpression;
109
if (node.
Kind
== BoundKind.DefaultExpression || node.
Kind
== BoundKind.DefaultLiteral)
137
Debug.Assert(expr.
Kind
is BoundKind.MethodGroup or BoundKind.UnboundLambda);
170
switch (node.
Kind
)
242
switch (boundNode.
Kind
)
BoundTree\BoundMethodGroup.cs (1)
61
if (this.ReceiverOpt == null || this.ReceiverOpt.
Kind
== BoundKind.TypeExpression)
BoundTree\BoundNode_Source.cs (1)
362
appendLine(node.
Kind
.ToString());
BoundTree\BoundNodeExtensions.cs (8)
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
);
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 (4)
113
if (child.
Kind
!= BoundKind.BinaryOperator)
128
if (child.
Kind
!= BoundKind.BinaryOperator)
202
if (child.
Kind
!= BoundKind.BinaryPattern)
217
if (child.
Kind
!= BoundKind.BinaryPattern)
BoundTree\BoundTreeVisitors.cs (1)
31
switch (node.
Kind
)
BoundTree\BoundTreeWalker.cs (2)
121
while (current.
Kind
== BoundKind.BinaryOperator)
159
while (current.
Kind
== BoundKind.BinaryPattern)
BoundTree\Constructors.cs (2)
69
switch (receiver.
Kind
)
206
Debug.Assert(method is ErrorMethodSymbol || arguments[i].
Kind
== BoundKind.ArgListOperator);
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)
109
_ => throw ExceptionUtilities.UnexpectedValue(currentBinary.
Kind
),
CodeGen\CodeGenerator_HasHome.cs (2)
51
switch (expression.
Kind
)
257
fieldAccess.ReceiverOpt.
Kind
== BoundKind.ThisReference;
CodeGen\EmitAddress.cs (4)
26
switch (expression.
Kind
)
87
throw ExceptionUtilities.UnexpectedValue(expression.
Kind
);
353
switch (value.
Kind
)
522
if (receiver.
Kind
!= BoundKind.ConditionalReceiver)
CodeGen\EmitArrayInitializer.cs (4)
348
if (inits[0].
Kind
== BoundKind.ArrayInitialization)
370
Debug.Assert(inits.All((init) => init.
Kind
!= BoundKind.ArrayInitialization) ||
371
inits.All((init) => init.
Kind
== BoundKind.ArrayInitialization),
374
return inits.Length != 0 && inits[0].
Kind
== BoundKind.ArrayInitialization;
CodeGen\EmitExpression.cs (30)
96
switch (expression.
Kind
)
174
throw ExceptionUtilities.UnexpectedValue(expression.
Kind
);
362
Debug.Assert(expression.
Kind
!= BoundKind.BadExpression);
365
throw ExceptionUtilities.UnexpectedValue(expression.
Kind
);
444
(receiver.
Kind
== BoundKind.Local && IsStackLocal(((BoundLocal)receiver).LocalSymbol)) ||
859
Debug.Assert(sequence.Value.
Kind
!= BoundKind.TypeExpression || !used);
860
if (sequence.Value.
Kind
!= BoundKind.TypeExpression)
1002
Debug.Assert(arguments[i].
Kind
== BoundKind.ArgListOperator);
1231
else if (receiver.
Kind
== BoundKind.Conversion)
1242
else if (receiver.
Kind
== BoundKind.FieldAccess)
1273
if (receiver.
Kind
== BoundKind.Conversion && ((BoundConversion)receiver).ConversionKind == ConversionKind.Unboxing)
1284
switch (receiver.
Kind
)
1516
Debug.Assert(receiver.
Kind
!= BoundKind.BaseReference, "base should always use call");
1525
switch (receiver.
Kind
)
1598
switch (receiver.
Kind
)
1646
Debug.Assert(receiver.
Kind
== BoundKind.ThisReference);
2128
switch (current.
Kind
)
2211
switch (receiver.
Kind
)
2620
if (objCreation.Arguments.Length > 0 && objCreation.Arguments[0].
Kind
== BoundKind.ConvertedStackAllocExpression)
2654
if (left.
Kind
== BoundKind.ArrayAccess && left.Type.TypeKind == TypeKind.TypeParameter && !left.Type.IsValueType)
2659
if (left.
Kind
== BoundKind.FieldAccess)
2754
switch (left.
Kind
)
2773
switch (assignmentTarget.
Kind
)
2954
throw ExceptionUtilities.UnexpectedValue(assignmentTarget.
Kind
);
2975
throw ExceptionUtilities.UnexpectedValue(assignmentTarget.
Kind
);
3004
Debug.Assert(lhs.
Kind
!= BoundKind.Parameter || exprTempsAfter <= exprTempsBefore);
3006
if (lhs.
Kind
== BoundKind.Local && ((BoundLocal)lhs).LocalSymbol.SynthesizedKind.IsLongLived())
3062
switch (expression.
Kind
)
3162
throw ExceptionUtilities.UnexpectedValue(expression.
Kind
);
3916
switch (expr.
Kind
)
CodeGen\EmitOperators.cs (3)
94
if (child.
Kind
!= BoundKind.BinaryOperator || child.ConstantValueOpt != null)
118
if (child.
Kind
!= BoundKind.BinaryOperator || child.ConstantValueOpt != null)
507
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)) ||
1135
while (exceptionSource.
Kind
== BoundKind.Sequence)
1143
switch (exceptionSource.
Kind
)
1182
throw ExceptionUtilities.UnexpectedValue(exceptionSource.
Kind
);
1264
if (expression.
Kind
== BoundKind.Sequence)
1272
if (expression.
Kind
== BoundKind.SequencePointExpression)
1279
switch (expression.
Kind
)
CodeGen\Optimizer.cs (17)
451
Debug.Assert(expr.
Kind
!= BoundKind.Label);
762
if (value != null && value.
Kind
== BoundKind.Local && ((BoundLocal)value).LocalSymbol == local)
770
if (lastSideeffect.
Kind
== BoundKind.AssignmentOperator)
774
assignment.Right.
Kind
== BoundKind.Sequence)
950
bool mayPushReceiver = (right.
Kind
== BoundKind.ObjectCreationExpression &&
996
assignmentLocal.Type.IsPointerOrFunctionPointer() && right.
Kind
== BoundKind.Conversion &&
1031
(lhs.
Kind
is BoundKind.Local or BoundKind.Parameter or BoundKind.FieldAccess && lhs.GetRefKind() != RefKind.None),
1034
switch (lhs.
Kind
)
1093
throw ExceptionUtilities.UnexpectedValue(lhs.
Kind
);
1100
if (lhs.
Kind
== BoundKind.FieldAccess)
1425
if (boundExpression.
Kind
== BoundKind.Local)
1477
if (child.
Kind
!= BoundKind.BinaryOperator || child.ConstantValueOpt != null)
1493
if (child.
Kind
!= BoundKind.BinaryOperator || child.ConstantValueOpt != null)
1697
if (exceptionSourceOpt.
Kind
== BoundKind.Local)
2071
if (child.
Kind
!= BoundKind.BinaryOperator || child.ConstantValueOpt != null)
2087
if (child.
Kind
!= BoundKind.BinaryOperator || child.ConstantValueOpt != null)
2299
if (exceptionSource.
Kind
== BoundKind.Local)
Compilation\CSharpSemanticModel.cs (14)
1924
else if (highestBoundExpr.
Kind
== BoundKind.TypeOrValueExpression)
1930
else if (highestBoundExpr.
Kind
== BoundKind.UnaryOperator)
2085
var highestBoundExprKind = highestBoundExpr?.
Kind
?? BoundKind.NoOpStatement;
2106
if (tupleLiteralConversion.Operand.
Kind
== BoundKind.ConvertedTupleLiteral)
2195
else if (((BoundConversion)highestBoundExpr).Operand.
Kind
!= BoundKind.Conversion)
2213
else if (boundNodeForSyntacticParent?.
Kind
== BoundKind.DelegateCreationExpression)
2218
switch (boundExpr.
Kind
)
2300
if (boundExpr != null && boundExpr.
Kind
!= BoundKind.TypeExpression)
3355
switch (boundNode.
Kind
)
3399
boundNodeForSyntacticParent.
Kind
== BoundKind.BadExpression &&
3980
switch (boundNodeForSyntacticParent.
Kind
)
4006
throw ExceptionUtilities.UnexpectedValue(boundNodeForSyntacticParent.
Kind
);
4259
switch (boundNodeForSyntacticParent.
Kind
)
4408
switch (boundNodeForSyntacticParent.
Kind
)
Compilation\MemberSemanticModel.cs (5)
1200
Debug.Assert(highestBoundNode.
Kind
!= BoundKind.UnboundLambda);
1742
switch (boundInnerLambdaOrQuery.
Kind
)
1771
switch (node.
Kind
)
1789
while (receiver?.
Kind
== BoundKind.MethodGroup)
1856
if (expr.
Kind
== BoundKind.QueryClause)
Compilation\MemberSemanticModel.NodeMapBuilder.cs (1)
169
if (node.
Kind
== BoundKind.UnboundLambda)
Compiler\MethodBodySynthesizer.Lowered.cs (1)
333
if (body.
Kind
!= BoundKind.Block) body = F.Block(body);
Compiler\MethodCompiler.cs (4)
598
(init.
Kind
== BoundKind.FieldEqualsValue) && !((BoundFieldEqualsValue)init).Field.IsMetadataConstant));
1292
if (processedInitializers.LoweredInitializers.
Kind
== BoundKind.StatementList)
1848
switch (methodBody.
Kind
)
1890
throw ExceptionUtilities.UnexpectedValue(methodBody.
Kind
);
FlowAnalysis\AbstractFlowPass.cs (11)
554
switch (node?.
Kind
)
897
RoslynDebug.Assert(false, $"Should Visit{node.
Kind
} be overridden in {this.GetType().Name}?");
1023
throw ExceptionUtilities.UnexpectedValue(pattern.
Kind
);
1076
throw ExceptionUtilities.UnexpectedValue(pattern.
Kind
);
1864
if (pend.Branch.
Kind
!= BoundKind.YieldReturnStatement)
2124
if (expr.
Kind
!= BoundKind.PropertyAccess)
2157
var refKind = node.Left.
Kind
== BoundKind.BadExpression
2238
receiverOpt.
Kind
!= BoundKind.TypeExpression &&
2419
var childKind = child.
Kind
;
2457
switch (binary.
Kind
)
2470
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)
241
if (node.
Kind
== BoundKind.Attribute)
427
BoundKind kind = pendingBranch.
Kind
;
785
Debug.Assert(fieldOrEventAccess.
Kind
== BoundKind.FieldAccess || fieldOrEventAccess.
Kind
== BoundKind.EventAccess);
789
switch (n.
Kind
)
921
if (value is { ConstantValueOpt: not null,
Kind
: not BoundKind.InterpolatedString }) return false;
923
switch (value.
Kind
)
961
switch (n.
Kind
)
978
if (n.
Kind
== BoundKind.Local)
1070
switch (expr.
Kind
)
1124
receiver.
Kind
!= BoundKind.TypeExpression &&
1141
receiverOpt.
Kind
!= BoundKind.TypeExpression &&
1382
switch (node.
Kind
)
1485
switch (expression.
Kind
)
1537
switch (node.
Kind
)
1991
switch (pattern.
Kind
)
2118
throw ExceptionUtilities.UnexpectedValue(pattern.
Kind
);
2193
if (stmt.
Kind
!= BoundKind.LocalFunctionStatement)
2449
if (pending.Branch.
Kind
== BoundKind.ReturnStatement)
2523
if (initializer.
Kind
== BoundKind.AddressOfOperator)
2594
switch (expr.
Kind
)
FlowAnalysis\ExitPointsWalker.cs (2)
125
switch (pending.Branch.
Kind
)
148
throw ExceptionUtilities.UnexpectedValue(pending.Branch.
Kind
);
FlowAnalysis\LocalDataFlowPass.cs (1)
213
switch (node.
Kind
)
FlowAnalysis\NullableWalker.cs (33)
431
private bool IsAnalyzingAttribute => methodMainNode.
Kind
== BoundKind.Attribute;
540
Debug.Assert(expression != null || placeholder.
Kind
== BoundKind.InterpolatedStringArgumentPlaceholder);
559
switch (placeholder.
Kind
)
575
throw ExceptionUtilities.UnexpectedValue(placeholder.
Kind
);
2005
switch (expr.
Kind
)
2054
receiver.
Kind
!= BoundKind.TypeExpression &&
2080
switch (node.
Kind
)
2549
switch (expr.
Kind
)
3016
if (!expr.IsSuppressed && RemoveConversion(expr, includeExplicitConversions: false).expression.
Kind
!= BoundKind.ThrowExpression)
4022
Debug.Assert(node.
Kind
is BoundKind.ObjectCreationExpression or BoundKind.DynamicObjectCreationExpression or BoundKind.NewT or BoundKind.NoPiaObjectCreationExpression);
4112
switch (initializer.
Kind
)
4127
switch (initializer.
Kind
)
4140
ExceptionUtilities.UnexpectedValue(node.
Kind
);
4157
switch (left.
Kind
)
4413
Debug.Assert(node.ImplicitReceiverOpt.
Kind
== BoundKind.ObjectOrCollectionValuePlaceholder);
4828
if (child.
Kind
== BoundKind.ArrayInitialization)
5392
switch (operand.
Kind
)
5588
while (possiblyConversion.
Kind
== BoundKind.Conversion)
7349
return (argument.
Kind
== BoundKind.Lambda);
7954
switch (expr.
Kind
)
8006
if (argument.
Kind
== BoundKind.Lambda)
8015
if (argument.
Kind
== BoundKind.CollectionExpression)
8107
if (expr.
Kind
!= BoundKind.Conversion)
8190
switch (value.
Kind
)
9029
if (operandType.Type?.IsTupleType == true || conversionOperand.
Kind
== BoundKind.TupleLiteral)
10006
if (left.
Kind
== BoundKind.EventAccess && ((BoundEventAccess)left).EventSymbol.IsWindowsRuntimeEvent)
10421
switch (expr.
Kind
)
10439
switch (expr.
Kind
)
10638
if (initializer.
Kind
== BoundKind.AddressOfOperator)
10644
if (node.Expression.
Kind
== BoundKind.AddressOfOperator)
10896
if (node.Expression.
Kind
!= BoundKind.Conversion)
11422
switch (node.
Kind
)
11442
throw ExceptionUtilities.UnexpectedValue(node.
Kind
);
FlowAnalysis\NullableWalker.DebugVerifier.cs (2)
73
else if (overrideSkippedExpression || !s_skippedExpressions.Contains(expression.
Kind
))
164
if (!s_skippedExpressions.Contains(child.
Kind
))
FlowAnalysis\NullableWalker.SnapshotManager.cs (1)
106
if (node.
Kind
== BoundKind.TypeExpression || node.WasCompilerGenerated)
FlowAnalysis\NullableWalker_Patterns.cs (4)
583
throw ExceptionUtilities.UnexpectedValue(p.Evaluation.
Kind
);
660
throw ExceptionUtilities.UnexpectedValue(test.
Kind
);
719
throw ExceptionUtilities.UnexpectedValue(dagNode.
Kind
);
858
_ => throw ExceptionUtilities.UnexpectedValue(e.
Kind
)
FlowAnalysis\ReadWriteWalker.cs (4)
142
if (!IsInside && node.Span.Contains(RegionSpan) && (expr.
Kind
== BoundKind.FieldAccess))
183
switch (receiver.
Kind
)
233
switch (node.
Kind
)
299
switch (underlying.
Kind
)
FlowAnalysis\RegionAnalysisContext.cs (1)
49
switch (firstInRegion.
Kind
)
Generated\BoundNodes.xml.Generated.cs (1)
8867
switch (node.
Kind
)
Lowering\AsyncRewriter\AsyncMethodToStateMachineRewriter.cs (3)
310
if (node.Expression.
Kind
== BoundKind.AwaitExpression)
314
else if (node.Expression.
Kind
== BoundKind.AssignmentOperator)
317
if (expression.Right.
Kind
== BoundKind.AwaitExpression)
Lowering\ClosureConversion\ClosureConversion.Analysis.cs (2)
108
switch (node.
Kind
)
128
throw ExceptionUtilities.UnexpectedValue(node.
Kind
);
Lowering\ClosureConversion\ClosureConversion.cs (3)
1104
if (visited.
Kind
!= BoundKind.Call)
1333
if (node.Argument.
Kind
== BoundKind.Lambda)
1380
receiver.
Kind
== BoundKind.TypeExpression &&
Lowering\ClosureConversion\ExpressionLambdaRewriter.cs (7)
138
switch (stmt.
Kind
)
157
throw ExceptionUtilities.UnexpectedValue(stmt.
Kind
);
181
switch (node.
Kind
)
249
throw ExceptionUtilities.UnexpectedValue(node.
Kind
);
533
if (operand.
Kind
== BoundKind.Conversion)
787
if (node.Argument.
Kind
== BoundKind.MethodGroup)
943
switch (node.
Kind
)
Lowering\DiagnosticsPass_ExpressionTrees.cs (8)
253
if (_inExpressionLambda && node.Left.
Kind
!= BoundKind.ObjectInitializerMember && node.Left.
Kind
!= BoundKind.DynamicObjectInitializerMember)
277
bool hasBaseReceiver = node.ReceiverOpt != null && node.ReceiverOpt.
Kind
== BoundKind.BaseReference;
291
bool hasBaseReceiver = node.ReceiverOpt != null && node.ReceiverOpt.
Kind
== BoundKind.BaseReference;
665
if (current.Left.
Kind
== BoundKind.BinaryOperator)
753
if (operand.
Kind
== BoundKind.FieldAccess)
853
if (node.Argument.
Kind
!= BoundKind.MethodGroup)
937
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)
123
if (rewritten.
Kind
== BoundKind.Block)
Lowering\Instrumentation\Instrumenter.cs (1)
307
Debug.Assert(original.
Kind
== BoundKind.SwitchStatement);
Lowering\LocalRewriter\LocalRewriter.cs (12)
286
node.
Kind
is not (BoundKind.ImplicitReceiver or BoundKind.ObjectOrCollectionValuePlaceholder or BoundKind.ValuePlaceholder))
309
return node.
Kind
== BoundKind.DeconstructionAssignmentOperator && !((BoundDeconstructionAssignmentOperator)node).IsUsed;
709
if (initializer.
Kind
== BoundKind.Block)
879
switch (initializer.
Kind
)
886
if (initializer.
Kind
== BoundKind.ExpressionStatement)
894
return ((BoundExpressionStatement)initializer).Expression.
Kind
== BoundKind.AssignmentOperator;
911
if (statement.
Kind
!= BoundKind.ExpressionStatement)
922
Debug.Assert(assignment.Left.
Kind
== BoundKind.FieldAccess);
1018
switch (expr.
Kind
)
1114
throw ExceptionUtilities.UnexpectedValue(expr.
Kind
);
1120
RoslynDebug.Assert(expr is not BoundValuePlaceholderBase, $"Placeholder kind {expr.
Kind
} must be handled explicitly");
1258
RoslynDebug.Assert(false, $"Bound nodes of kind {node.
Kind
} should not survive past local rewriting");
Lowering\LocalRewriter\LocalRewriter.DecisionDagRewriter.cs (4)
89
throw ExceptionUtilities.UnexpectedValue(node.
Kind
);
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
)
173
switch (rewrittenLeft.
Kind
)
177
throw ExceptionUtilities.UnexpectedValue(rewrittenLeft.
Kind
);
241
if (sequence.Value.
Kind
== BoundKind.IndexerAccess)
Lowering\LocalRewriter\LocalRewriter_BinaryOperator.cs (13)
284
if (loweredRight.
Kind
== BoundKind.Local || loweredRight.
Kind
== BoundKind.Parameter)
296
if (loweredRight.
Kind
== BoundKind.Local || loweredRight.
Kind
== BoundKind.Parameter)
483
if (loweredLeft.
Kind
== BoundKind.ArrayLength && loweredRight.IsDefaultValue())
498
if (loweredRight.
Kind
== BoundKind.ArrayLength && loweredLeft.IsDefaultValue())
513
if (loweredLeft.
Kind
== BoundKind.ArrayLength && loweredRight.IsDefaultValue())
517
else if (loweredRight.
Kind
== BoundKind.ArrayLength && loweredLeft.IsDefaultValue())
652
if (constantLeft == null && loweredLeft.
Kind
!= BoundKind.Local && loweredLeft.
Kind
!= BoundKind.Parameter)
713
if (expression.
Kind
== BoundKind.Conversion)
1608
if (nonNullRight != null && nonNullRight.ConstantValueOpt != null && left.
Kind
== BoundKind.Sequence)
1611
if (seq.Value.
Kind
== BoundKind.ConditionalOperator)
Lowering\LocalRewriter\LocalRewriter_Block.cs (1)
109
switch (node.
Kind
)
Lowering\LocalRewriter\LocalRewriter_Call.cs (5)
33
switch (node.Expression.
Kind
)
43
Debug.Assert(methodGroup.ReceiverOpt == null || methodGroup.ReceiverOpt.
Kind
!= BoundKind.TypeOrValueExpression);
550
switch (current.
Kind
)
1537
if (argument.
Kind
== BoundKind.Local)
1626
if (argument.
Kind
== BoundKind.Local)
Lowering\LocalRewriter\LocalRewriter_CompoundAssignmentOperator.cs (7)
41
if (node.Left.
Kind
== BoundKind.DynamicMemberAccess &&
189
Debug.Assert(receiverOpt.
Kind
!= BoundKind.TypeExpression);
480
Debug.Assert(receiver.
Kind
!= BoundKind.TypeExpression);
590
switch (originalLHS.
Kind
)
741
throw ExceptionUtilities.UnexpectedValue(originalLHS.
Kind
);
840
switch (expression.
Kind
)
882
switch (expression.
Kind
)
Lowering\LocalRewriter\LocalRewriter_Conversion.cs (4)
31
_ => throw ExceptionUtilities.UnexpectedValue(node.Operand.
Kind
)
233
switch (rewrittenNode.
Kind
)
1305
if (operand.
Kind
== BoundKind.Sequence)
1308
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)
28
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 (3)
51
Debug.Assert(original.
Kind
is BoundKind.ForStatement or BoundKind.ForEachStatement or BoundKind.CollectionExpressionSpreadElement);
146
switch (original.
Kind
)
159
throw ExceptionUtilities.UnexpectedValue(original.
Kind
);
Lowering\LocalRewriter\LocalRewriter_IndexerAccess.cs (6)
497
if (node.LengthOrCountAccess.
Kind
is not BoundKind.Local || receiver.
Kind
is not (BoundKind.Local or BoundKind.Parameter))
539
if (makeOffsetInput.ConstantValueOpt is null && lengthAccess.
Kind
is not BoundKind.ArrayLength)
799
if (node.LengthOrCountAccess.
Kind
is not BoundKind.Local || receiver.
Kind
is not (BoundKind.Local or BoundKind.Parameter))
950
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)
192
if (expression.
Kind
!= BoundKind.Call)
221
while (expression.
Kind
== BoundKind.Conversion)
Lowering\LocalRewriter\LocalRewriter_ObjectOrCollectionInitializerExpression.cs (11)
27
throw ExceptionUtilities.UnexpectedValue(initializerExpression.
Kind
);
62
throw ExceptionUtilities.UnexpectedValue(initializerExpression.
Kind
);
70
switch (initializerExpression.
Kind
)
81
throw ExceptionUtilities.UnexpectedValue(initializerExpression.
Kind
);
98
if (initializer.
Kind
== BoundKind.CollectionElementInitializer)
105
Debug.Assert(initializer.
Kind
== BoundKind.DynamicCollectionElementInitializer);
281
bool isRhsNestedInitializer = right.
Kind
is BoundKind.ObjectInitializerExpression or BoundKind.CollectionInitializerExpression;
292
switch (left.
Kind
)
432
throw ExceptionUtilities.UnexpectedValue(rewrittenArrayAccess.
Kind
);
514
throw ExceptionUtilities.UnexpectedValue(left.
Kind
);
576
throw ExceptionUtilities.UnexpectedValue(lhs.
Kind
);
Lowering\LocalRewriter\LocalRewriter_StringConcat.cs (1)
615
if (expr.
Kind
== BoundKind.Conversion)
Lowering\LocalRewriter\LocalRewriter_StringInterpolation.cs (2)
84
throw ExceptionUtilities.UnexpectedValue(part.
Kind
);
191
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)
321
if (loweredOperand.
Kind
== BoundKind.Sequence)
324
if (seq.Value.
Kind
== BoundKind.ConditionalOperator)
486
switch (expression.
Kind
)
862
switch (transformedExpression.
Kind
)
Lowering\LocalRewriter\LocalRewriter_UsingStatement.cs (1)
40
BoundBlock tryBlock = rewrittenBody.
Kind
== BoundKind.Block
Lowering\LocalRewriter\LocalRewriter_WhileStatement.cs (3)
49
Debug.Assert(loop.
Kind
is BoundKind.WhileStatement or BoundKind.ForEachStatement or BoundKind.CollectionExpressionSpreadElement);
72
switch (loop.
Kind
)
88
throw ExceptionUtilities.UnexpectedValue(loop.
Kind
);
Lowering\LocalRewriter\LoweredDynamicOperationFactory.cs (1)
225
if (loweredReceiver.
Kind
== BoundKind.TypeExpression)
Lowering\MethodToClassRewriter.cs (7)
70
Debug.Fail($"Override the visitor for {node.
Kind
}");
484
if (originalLeft.
Kind
!= BoundKind.Local)
498
Debug.Assert(originalRight.
Kind
!= BoundKind.ConvertedStackAllocExpression);
520
if (rewrittenLeft.
Kind
!= BoundKind.Local && originalRight.
Kind
== BoundKind.ConvertedStackAllocExpression)
727
return originalReceiver is {
Kind
: BoundKind.BaseReference } &&
728
rewrittenReceiver is {
Kind
: not BoundKind.BaseReference };
Lowering\SpillSequenceSpiller.cs (7)
47
Debug.Assert(value?.
Kind
!= SpillSequenceBuilderKind);
247
if (e == null || e.
Kind
!= SpillSequenceBuilderKind)
314
switch (expression.
Kind
)
352
assignment is not { Left.
Kind
: BoundKind.Local, Right.
Kind
: BoundKind.ArrayAccess }) // Optimize for some known to be safe scenarios.
611
if (newList[i].
Kind
== SpillSequenceBuilderKind)
872
switch (left.
Kind
)
Lowering\StateMachineRewriter\IteratorAndAsyncCaptureWalker.cs (1)
295
if (node.ReceiverOpt != null && node.ReceiverOpt.
Kind
== BoundKind.ThisReference)
Lowering\StateMachineRewriter\MethodToStateMachineRewriter.cs (6)
413
if (statement.
Kind
== BoundKind.Block)
417
if (rewrittenStatements.Length == 1 && rewrittenStatements[0].
Kind
== BoundKind.StateMachineScope)
583
switch (expr.
Kind
)
618
if (receiver.
Kind
!= BoundKind.ThisReference && !isFieldOfStruct)
675
throw ExceptionUtilities.UnexpectedValue(expr.
Kind
);
829
if (node.Left.
Kind
!= BoundKind.Local)
Lowering\SyntheticBoundNodeFactory.cs (2)
572
if (body.
Kind
!= BoundKind.Block)
1728
var discardsPresent = arguments.Any(static a => a.
Kind
== BoundKind.DiscardExpression);
Operations\CSharpOperationFactory.cs (31)
35
switch (boundNode.
Kind
)
312
switch (boundNode.
Kind
)
333
throw ExceptionUtilities.UnexpectedValue(boundNode.
Kind
);
398
switch (declaration.
Kind
)
416
throw ExceptionUtilities.UnexpectedValue(declaration.
Kind
);
522
switch (declaration.
Kind
)
548
throw ExceptionUtilities.UnexpectedValue(declaration.
Kind
);
608
throw ExceptionUtilities.UnexpectedValue(boundNode.
Kind
);
799
throw ExceptionUtilities.UnexpectedValue(indexer.
Kind
);
815
throw ExceptionUtilities.UnexpectedValue(indexer.
Kind
);
958
if (receiver?.
Kind
== BoundKind.TypeExpression)
1070
Debug.Assert(boundOperand.
Kind
== BoundKind.BadExpression ||
1072
ExpressionOpt?.
Kind
== BoundKind.BadExpression);
1082
if (boundOperand.
Kind
== BoundKind.ConvertedTupleLiteral && TypeSymbol.Equals(boundOperand.Type, boundConversion.Type, TypeCompareKind.ConsiderEverything2))
1096
if (boundConversion.ExplicitCastInCode && conversion.IsIdentity && boundOperand.
Kind
== BoundKind.Conversion)
1102
nestedOperand.
Kind
== BoundKind.ConvertedTupleLiteral &&
1118
if ((boundOperand.
Kind
== BoundKind.Lambda ||
1119
boundOperand.
Kind
== BoundKind.UnboundLambda ||
1120
boundOperand.
Kind
== BoundKind.MethodGroup) &&
1327
boundAssignmentOperator.Right?.
Kind
== BoundKind.ObjectInitializerExpression ||
1328
boundAssignmentOperator.Right?.
Kind
== BoundKind.CollectionInitializerExpression;
1475
{
Kind
: var kind } => throw ExceptionUtilities.UnexpectedValue(kind)
1643
if (boundIndexerAccess.LengthOrCountAccess.
Kind
== BoundKind.ArrayLength)
2247
{
Kind
: var kind } => throw ExceptionUtilities.UnexpectedValue(kind)
2280
if (part.
Kind
== BoundKind.StringInsert)
2340
throw ExceptionUtilities.UnexpectedValue(part.
Kind
);
2356
_ => throw ExceptionUtilities.UnexpectedValue(value.
Kind
),
2476
throw ExceptionUtilities.UnexpectedValue(current.
Kind
);
2539
if (variable == null && boundDeclarationPattern.VariableAccess?.
Kind
== BoundKind.DiscardExpression)
2753
Debug.Assert(boundSwitchLabel.Pattern.
Kind
== BoundKind.DiscardPattern);
2757
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
)
260
throw ExceptionUtilities.UnexpectedValue(containingExpression.
Kind
);
393
|| (receiverOpt.
Kind
!= BoundKind.ThisReference
394
&& receiverOpt.
Kind
!= BoundKind.BaseReference
395
&& receiverOpt.
Kind
!= BoundKind.ObjectOrCollectionValuePlaceholder)))
Symbols\ConstantValueUtils.cs (1)
97
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)
884
switch (expression.
Kind
)
Symbols\Source\SourceComplexParameterSymbol.cs (1)
400
if (convertedExpression.ConstantValueOpt == null && convertedExpression.
Kind
== BoundKind.Conversion &&