769 references to Kind
Microsoft.CodeAnalysis.CSharp (748)
Binder\Binder.cs (1)
888
RoslynDebug.Assert(statement.
Kind
!= BoundKind.StatementList);
Binder\Binder.ValueChecks.cs (29)
736
switch (expr.
Kind
)
855
if (expr.
Kind
== BoundKind.MethodGroup && valueKind != BindValueKind.RValueOrMethodGroup)
881
if ((object)otherSymbol != null && receiver?.
Kind
== BoundKind.TypeOrValueExpression)
919
switch (expression?.
Kind
)
922
case BoundKind.QueryClause when ((BoundQueryClause)expression).Value.
Kind
== BoundKind.TypeOrValueExpression:
951
switch (expr.
Kind
)
956
case BoundKind.ImplicitIndexerAccess when ((BoundImplicitIndexerAccess)expr).IndexerOrSliceAccess.
Kind
== BoundKind.IndexerAccess:
977
switch (expr.
Kind
)
1141
throw ExceptionUtilities.UnexpectedValue(implicitIndexer.IndexerOrSliceAccess.
Kind
);
1215
RoslynDebug.Assert(expr is not BoundValuePlaceholderBase, $"Placeholder kind {expr.
Kind
} should be explicitly handled");
1260
switch (expr.
Kind
)
1915
return Flags.Includes(BinderFlags.ObjectInitializerMember) && receiver.
Kind
== BoundKind.ObjectOrCollectionValuePlaceholder ||
2079
ReportDiagnosticsIfObsolete(diagnostics, setMethod, node, receiver?.
Kind
== BoundKind.BaseReference);
2130
ReportDiagnosticsIfObsolete(diagnostics, getMethod, node, receiver?.
Kind
== BoundKind.BaseReference);
2214
if (receiverOpt?.
Kind
== BoundKind.BaseReference && member.IsAbstract)
2696
if (argument.
Kind
== BoundKind.ArgListOperator)
3735
switch (expr.
Kind
)
3890
throw ExceptionUtilities.UnexpectedValue(implicitIndexerAccess.IndexerOrSliceAccess.
Kind
);
4019
switch (expr.
Kind
)
4187
throw ExceptionUtilities.UnexpectedValue(implicitIndexerAccess.IndexerOrSliceAccess.
Kind
);
4375
switch (expr.
Kind
)
4524
throw ExceptionUtilities.UnexpectedValue(implicitIndexerAccess.IndexerOrSliceAccess.
Kind
);
4775
RoslynDebug.Assert(false, $"{expr.
Kind
} expression of {expr.Type} type");
4883
if (expr.
Kind
== BoundKind.AssignmentOperator)
5035
switch (expr.
Kind
)
5226
throw ExceptionUtilities.UnexpectedValue(implicitIndexerAccess.IndexerOrSliceAccess.
Kind
);
5536
RoslynDebug.Assert(false, $"{expr.
Kind
} expression of {expr.Type} type");
5868
throw ExceptionUtilities.UnexpectedValue(expression.
Kind
);
5911
throw ExceptionUtilities.UnexpectedValue(expression.
Kind
);
Binder\Binder_Attributes.cs (2)
820
switch (assignment.Left.
Kind
)
870
switch (node.
Kind
)
Binder\Binder_Await.cs (3)
81
if (expression.
Kind
!= BoundKind.Call ||
600
if (getAwaiterCall.
Kind
!= BoundKind.Call)
716
if (getAwaiterGetResultCall.
Kind
!= BoundKind.Call)
Binder\Binder_Conversions.cs (15)
141
if (conversion.IsAnonymousFunction && source.
Kind
== BoundKind.UnboundLambda)
215
if (source.
Kind
== BoundKind.UnconvertedSwitchExpression)
237
if (source.
Kind
== BoundKind.UnconvertedCollectionExpression)
260
if (source.
Kind
== BoundKind.UnconvertedConditionalOperator)
1832
if (boundExpression.
Kind
== BoundKind.FieldAccess || boundExpression.
Kind
== BoundKind.PropertyAccess)
1839
if (boundExpression.
Kind
!= BoundKind.MethodGroup)
2640
Debug.Assert(source.
Kind
is BoundKind.MethodGroup or BoundKind.UnboundLambda);
2647
if (source.
Kind
== BoundKind.UnboundLambda &&
2656
source.
Kind
== BoundKind.MethodGroup &&
3047
if (node.
Kind
!= BoundKind.MethodGroup)
3190
if (receiverOpt.
Kind
== BoundKind.QueryClause)
3292
while (receiverOpt.
Kind
== BoundKind.QueryClause)
3297
return receiverOpt.
Kind
== BoundKind.TypeExpression;
3307
switch (receiverOpt.
Kind
)
Binder\Binder_Deconstruct.cs (8)
213
if (boundRHS.
Kind
== BoundKind.TupleLiteral)
371
switch (expression.
Kind
)
385
throw ExceptionUtilities.UnexpectedValue(expression.
Kind
);
406
switch (variable.Single.
Kind
)
490
if (element.
Kind
== BoundKind.TupleLiteral)
599
if (expression.
Kind
== BoundKind.DiscardExpression)
663
if (memberAccess.
Kind
!= BoundKind.MethodGroup)
795
if (expression == null && checkedVariable.
Kind
!= BoundKind.DiscardExpression)
Binder\Binder_Expressions.cs (41)
224
BoundKind exprKind = expr.
Kind
;
278
if (valueOrType.
Kind
== BoundKind.TypeExpression)
448
Debug.Assert(expr.
Kind
is BoundKind.UnboundLambda or BoundKind.MethodGroup);
578
if (expr.
Kind
== BoundKind.ArgListOperator)
620
if (IsEarlyAttributeBinder && result.
Kind
== BoundKind.MethodGroup && (!IsInsideNameof || EnclosingNameofArgument != node))
2848
if (operand.
Kind
== BoundKind.UnboundLambda)
2895
switch (operand.
Kind
)
3192
switch (arg.
Kind
)
3585
else if (argument.
Kind
== BoundKind.OutVariablePendingInference)
3589
else if (argument.
Kind
== BoundKind.OutDeconstructVarPendingInference)
3593
else if (argument.
Kind
== BoundKind.DiscardExpression && !argument.HasExpressionType())
3628
Debug.Assert(arguments[arg].
Kind
is not
5602
else if (argument.
Kind
== BoundKind.MethodGroup)
6039
if (boundMember.
Kind
== BoundKind.PropertyGroup)
6081
BoundKind boundMemberKind = boundMember.
Kind
;
6669
if (addMethodInvocation.
Kind
== BoundKind.DynamicInvocation)
6680
else if (addMethodInvocation.
Kind
== BoundKind.Call)
6709
Debug.Assert(addMethodInvocation.
Kind
== BoundKind.BadExpression);
7188
switch (classCreation.
Kind
)
7201
throw ExceptionUtilities.UnexpectedValue(classCreation.
Kind
);
7933
if (boundLeft.
Kind
== BoundKind.UnboundLambda)
7978
switch (boundLeft.
Kind
)
8010
if (boundLeft.
Kind
== BoundKind.Literal && ((BoundLiteral)boundLeft).ConstantValueOpt == ConstantValue.Null)
8198
switch (expr.
Kind
)
8325
bool leftIsBaseReference = boundLeft.
Kind
== BoundKind.BaseReference;
8432
if (boundLeft.HasAnyErrors && boundLeft.
Kind
!= BoundKind.TypeOrValueExpression)
8453
else if (boundLeft.
Kind
== BoundKind.TypeExpression ||
8454
boundLeft.
Kind
== BoundKind.BaseReference ||
8464
else if (boundLeft.
Kind
== BoundKind.AwaitableValuePlaceholder && boundLeft.Type.IsIAsyncEnumerableType(Compilation))
8695
ReportDiagnosticsIfObsolete(diagnostics, symbol, node, hasBaseReceiver: left.
Kind
== BoundKind.BaseReference);
9312
ReportDiagnosticsIfObsolete(diagnostics, propertySymbol, node, hasBaseReceiver: receiver?.
Kind
== BoundKind.BaseReference);
9426
switch (receiver.
Kind
)
9632
if (receiver.
Kind
== BoundKind.PropertyGroup)
10048
if (index.
Kind
== BoundKind.OutVariablePendingInference)
10052
else if (index.
Kind
== BoundKind.DiscardExpression && !index.HasExpressionType())
10240
LookupOptions lookupOptions = expr.
Kind
== BoundKind.BaseReference ? LookupOptions.UseBaseReferenceAccessibility : LookupOptions.Default;
10354
BoundKind receiverKind = receiver.
Kind
;
10496
ReportDiagnosticsIfObsolete(diagnostics, property, syntax, hasBaseReceiver: receiver != null && receiver.
Kind
== BoundKind.BaseReference);
10507
if (!gotError && receiver != null && receiver.
Kind
== BoundKind.ThisReference && receiver.WasCompilerGenerated)
11659
if (access.
Kind
== BoundKind.MethodGroup)
11826
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 (30)
108
if (!allowFieldsAndProperties && (boundExpression.
Kind
== BoundKind.FieldAccess || boundExpression.
Kind
== BoundKind.PropertyAccess))
113
if (boundExpression.
Kind
== BoundKind.FieldAccess)
125
Debug.Assert(allowFieldsAndProperties || boundExpression.
Kind
is (BoundKind.MethodGroup or BoundKind.BadExpression));
130
Debug.Assert(!args.Any(static e => e.
Kind
== BoundKind.OutVariablePendingInference ||
131
e.
Kind
== BoundKind.OutDeconstructVarPendingInference ||
132
e.
Kind
== BoundKind.DiscardExpression && !e.HasExpressionType()));
146
if (queryClause != null && result.
Kind
== BoundKind.DynamicInvocation)
162
if (boundExpression.
Kind
== BoundKind.FieldAccess)
247
string name = boundExpression.
Kind
== BoundKind.MethodGroup ? GetName(node.Expression) : null;
281
if (argument.
Kind
== BoundKind.OutVariablePendingInference)
358
else if (boundExpression.
Kind
== BoundKind.MethodGroup)
411
if (expression.
Kind
== BoundKind.MethodGroup)
419
switch (receiver.
Kind
)
594
if (arg.
Kind
== BoundKind.Lambda || arg.
Kind
== BoundKind.UnboundLambda)
600
else if (arg.
Kind
== BoundKind.MethodGroup)
606
else if (arg.
Kind
== BoundKind.ArgListOperator)
735
Debug.Assert(extensionMemberAccess.
Kind
!= BoundKind.MethodGroup);
1080
switch (expression.
Kind
)
1096
else if (call.ReceiverOpt.
Kind
== BoundKind.BaseReference && this.ContainingType.IsRestrictedType())
1120
throw ExceptionUtilities.UnexpectedValue(expression.
Kind
);
1314
if (!gotError && method.RequiresInstanceReceiver && receiver != null && receiver.
Kind
== BoundKind.ThisReference && receiver.WasCompilerGenerated)
1330
bool hasBaseReceiver = receiver != null && receiver.
Kind
== BoundKind.BaseReference;
1962
switch (receiver.
Kind
)
2028
if ((object)expr != null && expr.
Kind
!= BoundKind.TypeExpression)
2167
switch (argument.
Kind
)
2215
if (argument.
Kind
== BoundKind.OutVariablePendingInference)
2226
else if (argument.
Kind
== BoundKind.DiscardExpression)
2334
var originalMethods = (expr.
Kind
== BoundKind.MethodGroup) ? ((BoundMethodGroup)expr).Methods : ImmutableArray<MethodSymbol>.Empty;
Binder\Binder_Operators.cs (17)
43
if (left.
Kind
== BoundKind.EventAccess)
111
if (left.
Kind
== BoundKind.EventAccess && !CheckEventValueKind((BoundEventAccess)left, BindValueKind.Assignable, diagnostics))
312
Debug.Assert(left.
Kind
!= BoundKind.EventAccess || hasError);
907
if (result.
Kind
== BoundKind.TypeExpression
912
else if (result.
Kind
== BoundKind.BadExpression)
1269
_ => throw ExceptionUtilities.UnexpectedValue(current.Right.
Kind
)
1333
switch (left.
Kind
, right.
Kind
)
2917
if (left.
Kind
== BoundKind.Conversion && right.
Kind
== BoundKind.Conversion)
4035
switch (expr.
Kind
)
4166
BoundKind exprKind = expr.
Kind
;
4760
switch (operand.
Kind
)
4892
operand.
Kind
== BoundKind.MethodGroup ||
5308
switch (operand.
Kind
)
5621
if (leftOperand.
Kind
== BoundKind.UnboundLambda || leftOperand.
Kind
== BoundKind.MethodGroup)
Binder\Binder_Patterns.cs (6)
520
wasExpression = expression.
Kind
!= BoundKind.TypeExpression;
527
Debug.Assert(expression is {
Kind
: BoundKind.TypeExpression, Type: { } });
549
wasExpression = expression.
Kind
switch { BoundKind.BadExpression => false, BoundKind.TypeExpression => false, _ => true };
698
if (convertedExpression.
Kind
== BoundKind.Conversion)
1577
if (boundMember.
Kind
== BoundKind.PropertyGroup)
1585
switch (boundMember.
Kind
)
Binder\Binder_Query.cs (7)
929
while (ultimateReceiver.
Kind
== BoundKind.QueryClause)
936
Debug.Assert(ultimateReceiver.
Kind
!= BoundKind.MethodGroup || ultimateReceiver.HasAnyErrors);
954
else if (ultimateReceiver.
Kind
== BoundKind.NamespaceExpression)
958
else if (ultimateReceiver.
Kind
== BoundKind.Lambda || ultimateReceiver.
Kind
== BoundKind.UnboundLambda)
966
else if (ultimateReceiver.
Kind
== BoundKind.TypeExpression)
974
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 &&
899
BoundExpression expression = value.
Kind
is BoundKind.UnboundLambda or BoundKind.MethodGroup ?
1250
switch (initializerOpt.
Kind
)
1434
bool discardAssignment = op1.
Kind
== BoundKind.DiscardExpression;
1513
if (op1.
Kind
!= BoundKind.DynamicIndexerAccess &&
1514
op1.
Kind
!= BoundKind.DynamicMemberAccess &&
1515
op1.
Kind
!= BoundKind.DynamicObjectInitializerMember)
1531
if ((op1.
Kind
== BoundKind.EventAccess) &&
1588
else if (op1.
Kind
is BoundKind.Local or BoundKind.Parameter)
1601
Debug.Assert(op1.
Kind
!= BoundKind.Parameter); // If the assert fails, add a corresponding test.
1676
switch (expr.
Kind
)
1709
throw ExceptionUtilities.UnexpectedValue(implicitIndexerAccess.IndexerOrSliceAccess.
Kind
);
1761
_ => throw ExceptionUtilities.UnexpectedValue(e.
Kind
)
1817
(propertyIsStatic || receiver?.
Kind
== BoundKind.ThisReference);
1852
else if (receiver.
Kind
== BoundKind.BaseReference)
1978
if (expression.HasAnyErrors && expression.
Kind
!= BoundKind.UnboundLambda)
2366
switch (operand.
Kind
)
2486
Debug.Assert(operand.HasAnyErrors && operand.
Kind
!= BoundKind.UnboundLambda, "Missing a case in implicit conversion error reporting");
2729
if (expr.
Kind
== BoundKind.AssignmentOperator)
2732
if (assignment.Right.
Kind
== BoundKind.Literal && assignment.Right.ConstantValueOpt.Discriminator == ConstantValueTypeDiscriminator.Boolean)
3210
if (!argument.HasAnyErrors || argument.
Kind
== BoundKind.UnboundLambda)
3501
if (expression.
Kind
== BoundKind.DelegateCreationExpression || expression.
Kind
== BoundKind.NameOfOperator)
3529
if ((refKind != RefKind.None) != (returnRefKind != RefKind.None) && expression.
Kind
!= BoundKind.ThrowExpression)
4187
if (boundAccess.
Kind
!= BoundKind.MethodGroup)
4215
if (patternMethodCall.
Kind
!= BoundKind.Call)
Binder\Binder_TupleOperators.cs (2)
224
Debug.Assert((object)left.Type != null || left.
Kind
== BoundKind.TupleLiteral);
225
Debug.Assert((object)right.Type != null || right.
Kind
== BoundKind.TupleLiteral);
Binder\DecisionDagBuilder.cs (16)
360
throw ExceptionUtilities.UnexpectedValue(pattern.
Kind
);
1004
throw ExceptionUtilities.UnexpectedValue(n.
Kind
);
1272
throw ExceptionUtilities.UnexpectedValue(n?.
Kind
);
2005
return $"t{tempIdentifier(a)}={a.
Kind
}({tempName(a.Input)} as {a.Type})";
2007
return $"t{tempIdentifier(e)}={e.
Kind
}({tempName(e.Input)}.{e.Field.Name})";
2009
return $"t{tempIdentifier(e)}={e.
Kind
}({tempName(e.Input)}.{e.Property.Name})";
2011
return $"t{tempIdentifier(e)}={e.
Kind
}({tempName(e.Input)}[{e.Index}])";
2013
return $"{e.
Kind
}({tempName(e.Target)}<--{tempName(e.Input)})";
2015
return $"t{tempIdentifier(e)}={e.
Kind
}({tempName(e.Input)})";
2017
return $"?{d.
Kind
}({tempName(d.Input)} is {b.Type})";
2019
return $"?{d.
Kind
}({tempName(d.Input)} == {v.Value})";
2029
return $"?{d.
Kind
}({tempName(d.Input)} {operatorName} {r.Value})";
2031
return $"?{d.
Kind
}({tempName(d.Input)})";
3623
if (RemainingTests[0] is One { Test: {
Kind
: BoundKind.DagNonNullTest } planA })
3630
case One { Test: {
Kind
: BoundKind.DagTypeTest } planB1 }:
3637
case One { Test: {
Kind
: BoundKind.DagValueTest } planB2 }:
Binder\DecisionDagBuilder_ListPatterns.cs (1)
19
list.Subpatterns.Count(p => p.
Kind
== BoundKind.SlicePattern) == (list.HasSlice ? 1 : 0) &&
Binder\ForEachLoopBinder.cs (1)
410
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)
200
throw ExceptionUtilities.UnexpectedValue(currentNode.
Kind
);
Binder\RefSafetyAnalysis.cs (1)
602
if (node.Left.
Kind
!= BoundKind.DiscardExpression)
Binder\Semantics\Conversions\ConversionsBase.cs (4)
1059
switch (sourceExpression.
Kind
)
1410
if (sourceExpression.
Kind
== BoundKind.TupleLiteral)
1646
if (source.
Kind
!= BoundKind.UnboundLambda)
1949
if (sourceExpressionOpt?.
Kind
== BoundKind.TupleLiteral)
Binder\Semantics\Operators\BinaryOperatorOverloadResolution.cs (1)
469
&& nonDelegate.
Kind
== BoundKind.UnboundLambda)
Binder\Semantics\OverloadResolution\MethodGroup.cs (1)
117
if (this.Receiver.
Kind
== BoundKind.TypeExpression)
Binder\Semantics\OverloadResolution\MethodTypeInference.cs (14)
637
if (argument.
Kind
== BoundKind.UnboundLambda && target.Type.GetDelegateType() is { })
642
else if (argument.
Kind
== BoundKind.UnconvertedCollectionExpression)
646
else if (argument.
Kind
!= BoundKind.TupleLiteral ||
879
if (argument.
Kind
== BoundKind.TupleLiteral && (object)argument.Type == null)
883
else if (argument.
Kind
== BoundKind.UnconvertedCollectionExpression)
1023
if ((isFunctionPointer && argument.
Kind
!= BoundKind.UnconvertedAddressOfOperator) ||
1024
(!isFunctionPointer && argument.
Kind
is not (BoundKind.UnboundLambda or BoundKind.MethodGroup)))
1079
if ((isFunctionPointer && argument.
Kind
!= BoundKind.UnconvertedAddressOfOperator) ||
1080
(!isFunctionPointer && argument.
Kind
is not (BoundKind.UnboundLambda or BoundKind.MethodGroup)))
1448
if (source.
Kind
is not (BoundKind.MethodGroup or BoundKind.UnconvertedAddressOfOperator))
1459
if (delegateOrFunctionPointerType.IsFunctionPointer() != (source.
Kind
== BoundKind.UnconvertedAddressOfOperator))
1559
if (source.
Kind
!= BoundKind.UnboundLambda)
1613
if (source.
Kind
!= BoundKind.UnboundLambda)
3091
if (source.
Kind
!= BoundKind.UnboundLambda)
Binder\Semantics\OverloadResolution\OverloadResolution.cs (13)
2173
var argumentKind = arguments[i].
Kind
;
2315
var argumentKind = arguments[i].
Kind
;
2479
if (arguments[i].
Kind
== BoundKind.ArgListOperator)
2625
if (arguments[i].
Kind
!= BoundKind.ArgListOperator)
2952
var nodeKind = node.
Kind
;
3275
if (node.
Kind
== BoundKind.TupleLiteral)
3291
if (node.
Kind
== BoundKind.UnboundLambda &&
3331
if (lambda.Body.Statements[0].
Kind
== BoundKind.ReturnStatement)
3607
if (node?.
Kind
== BoundKind.MethodGroup)
4557
if (argument.
Kind
== BoundKind.ArgListOperator)
4732
if (argument.
Kind
== BoundKind.OutVariablePendingInference ||
4733
argument.
Kind
== BoundKind.OutDeconstructVarPendingInference ||
4734
(argument.
Kind
== BoundKind.DiscardExpression && (object)argType == null))
Binder\Semantics\OverloadResolution\OverloadResolutionResult.cs (13)
682
if (receiverOpt?.
Kind
== BoundKind.QueryClause)
1109
if (argument.
Kind
== BoundKind.UnboundLambda)
1249
argument.
Kind
!= BoundKind.OutDeconstructVarPendingInference &&
1250
argument.
Kind
!= BoundKind.OutVariablePendingInference &&
1251
argument.
Kind
!= BoundKind.DiscardExpression)
1257
if (argument.
Kind
== BoundKind.UnboundLambda && refArg == refParameter)
1261
else if (argument.
Kind
== BoundKind.MethodGroup && parameterType.TypeKind == TypeKind.Delegate &&
1266
else if (argument.
Kind
== BoundKind.MethodGroup && parameterType.TypeKind == TypeKind.FunctionPointer)
1270
else if (argument.
Kind
== BoundKind.UnconvertedAddressOfOperator &&
1275
else if (argument.
Kind
== BoundKind.UnconvertedCollectionExpression)
1340
Debug.Assert(argument.
Kind
!= BoundKind.OutDeconstructVarPendingInference);
1341
Debug.Assert(argument.
Kind
!= BoundKind.OutVariablePendingInference);
1342
Debug.Assert(argument.
Kind
!= BoundKind.DiscardExpression || argument.HasExpressionType());
BoundTree\BoundDagEvaluation.cs (5)
34
return Hash.Combine((int)
Kind
, this.Symbol?.GetHashCode() ?? 0);
43
this.
Kind
== other.
Kind
&&
61
_ => throw ExceptionUtilities.UnexpectedValue(this.
Kind
)
206
return Hash.Combine(DecisionDagBuilder.OriginalInput(input), Hash.Combine((int)
Kind
, index));
BoundTree\BoundDagTest.cs (5)
21
if (other is null || this.
Kind
!= other.
Kind
)
47
return Hash.Combine(((int)
Kind
).GetHashCode(), Input.GetHashCode());
90
return $"{e.GetOutputTempDebuggerDisplay()} = {e.
Kind
}({e.Input.GetDebuggerDisplay()})";
111
return $"{this.
Kind
}({this.Input.GetDebuggerDisplay()})";
BoundTree\BoundDecisionDag.cs (1)
42
throw ExceptionUtilities.UnexpectedValue(node.
Kind
);
BoundTree\BoundExpression.cs (5)
61
if ((
Kind
!= BoundKind.Local &&
Kind
!= BoundKind.Parameter) || this.WasConverted)
79
switch (
Kind
)
623
return this.Condition.
Kind
== BoundKind.UnaryOperator && ((BoundUnaryOperator)this.Condition).OperatorKind.IsDynamic();
689
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);
180
switch (node.
Kind
)
252
switch (boundNode.
Kind
)
BoundTree\BoundMethodGroup.cs (1)
61
if (this.ReceiverOpt == null || this.ReceiverOpt.
Kind
== BoundKind.TypeExpression)
BoundTree\BoundNode_Source.cs (1)
477
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 (4)
250
if (child.
Kind
!= BoundKind.BinaryOperator)
265
if (child.
Kind
!= BoundKind.BinaryOperator)
344
if (child.
Kind
!= BoundKind.BinaryPattern)
359
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
)
213
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)
121
_ => 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)
347
if (inits[0].
Kind
== BoundKind.ArrayInitialization)
369
Debug.Assert(inits.All((init) => init.
Kind
!= BoundKind.ArrayInitialization) ||
370
inits.All((init) => init.
Kind
== BoundKind.ArrayInitialization),
373
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)) ||
870
Debug.Assert(sequence.Value.
Kind
!= BoundKind.TypeExpression || !used);
871
if (sequence.Value.
Kind
!= BoundKind.TypeExpression)
1013
Debug.Assert(arguments[i].
Kind
== BoundKind.ArgListOperator);
1242
else if (receiver.
Kind
== BoundKind.Conversion)
1253
else if (receiver.
Kind
== BoundKind.FieldAccess)
1284
if (receiver.
Kind
== BoundKind.Conversion && ((BoundConversion)receiver).ConversionKind == ConversionKind.Unboxing)
1295
switch (receiver.
Kind
)
1527
Debug.Assert(receiver.
Kind
!= BoundKind.BaseReference, "base should always use call");
1536
switch (receiver.
Kind
)
1609
switch (receiver.
Kind
)
1657
Debug.Assert(receiver.
Kind
== BoundKind.ThisReference);
2159
switch (current.
Kind
)
2242
switch (receiver.
Kind
)
2656
if (objCreation.Arguments.Length > 0 && objCreation.Arguments[0].
Kind
== BoundKind.ConvertedStackAllocExpression)
2690
if (left.
Kind
== BoundKind.ArrayAccess && left.Type.TypeKind == TypeKind.TypeParameter && !left.Type.IsValueType)
2695
if (left.
Kind
== BoundKind.FieldAccess)
2797
switch (left.
Kind
)
2816
switch (assignmentTarget.
Kind
)
2997
throw ExceptionUtilities.UnexpectedValue(assignmentTarget.
Kind
);
3018
throw ExceptionUtilities.UnexpectedValue(assignmentTarget.
Kind
);
3047
Debug.Assert(lhs.
Kind
!= BoundKind.Parameter || exprTempsAfter <= exprTempsBefore);
3049
if (lhs.
Kind
== BoundKind.Local && ((BoundLocal)lhs).LocalSymbol.SynthesizedKind.IsLongLived())
3105
switch (expression.
Kind
)
3205
throw ExceptionUtilities.UnexpectedValue(expression.
Kind
);
3958
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)) ||
1158
while (exceptionSource.
Kind
== BoundKind.Sequence)
1166
switch (exceptionSource.
Kind
)
1205
throw ExceptionUtilities.UnexpectedValue(exceptionSource.
Kind
);
1291
if (expression.
Kind
== BoundKind.Sequence)
1299
if (expression.
Kind
== BoundKind.SequencePointExpression)
1306
switch (expression.
Kind
)
CodeGen\Optimizer.cs (19)
450
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 &&
1006
right.
Kind
== BoundKind.PointerIndirectionOperator)
1040
(lhs.
Kind
is BoundKind.Local or BoundKind.Parameter or BoundKind.FieldAccess && lhs.GetRefKind() != RefKind.None),
1043
switch (lhs.
Kind
)
1102
throw ExceptionUtilities.UnexpectedValue(lhs.
Kind
);
1109
if (lhs.
Kind
== BoundKind.FieldAccess)
1434
if (boundExpression.
Kind
== BoundKind.Local)
1486
if (child.
Kind
!= BoundKind.BinaryOperator || child.ConstantValueOpt != null)
1502
if (child.
Kind
!= BoundKind.BinaryOperator || child.ConstantValueOpt != null)
1708
if (exceptionSourceOpt.
Kind
== BoundKind.Local)
1947
top.Item1.
Kind
== BoundKind.Local &&
2082
if (child.
Kind
!= BoundKind.BinaryOperator || child.ConstantValueOpt != null)
2098
if (child.
Kind
!= BoundKind.BinaryOperator || child.ConstantValueOpt != null)
2311
if (exceptionSource.
Kind
== BoundKind.Local)
Compilation\CSharpSemanticModel.cs (12)
2096
var highestBoundExprKind = highestBoundExpr?.
Kind
?? BoundKind.NoOpStatement;
2117
if (tupleLiteralConversion.Operand.
Kind
== BoundKind.ConvertedTupleLiteral)
2206
else if (((BoundConversion)highestBoundExpr).Operand.
Kind
!= BoundKind.Conversion)
2224
else if (boundNodeForSyntacticParent?.
Kind
== BoundKind.DelegateCreationExpression)
2229
switch (boundExpr.
Kind
)
2311
if (boundExpr != null && boundExpr.
Kind
!= BoundKind.TypeExpression)
3366
switch (boundNode.
Kind
)
3411
boundNodeForSyntacticParent.
Kind
== BoundKind.BadExpression &&
3998
switch (boundNodeForSyntacticParent.
Kind
)
4024
throw ExceptionUtilities.UnexpectedValue(boundNodeForSyntacticParent.
Kind
);
4277
switch (boundNodeForSyntacticParent.
Kind
)
4426
switch (boundNodeForSyntacticParent.
Kind
)
Compilation\MemberSemanticModel.cs (5)
1239
Debug.Assert(highestBoundNode.
Kind
!= BoundKind.UnboundLambda);
1781
switch (boundInnerLambdaOrQuery.
Kind
)
1810
switch (node.
Kind
)
1828
while (receiver?.
Kind
== BoundKind.MethodGroup)
1895
if (expr.
Kind
== BoundKind.QueryClause)
Compilation\MemberSemanticModel.NodeMapBuilder.cs (7)
88
if (existing[i].
Kind
!= nodesToAdd[i].
Kind
)
93
if (existing[i].
Kind
== BoundKind.TypeExpression && nodesToAdd[i].
Kind
== BoundKind.TypeOrValueExpression)
101
else if (existing[i].
Kind
== BoundKind.TypeOrValueExpression && nodesToAdd[i].
Kind
== BoundKind.TypeExpression)
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)
623
(init.
Kind
== BoundKind.FieldEqualsValue) && !((BoundFieldEqualsValue)init).Field.IsMetadataConstant));
1342
if (processedInitializers.LoweredInitializers.
Kind
== BoundKind.StatementList)
1998
switch (methodBody.
Kind
)
2040
throw ExceptionUtilities.UnexpectedValue(methodBody.
Kind
);
FlowAnalysis\AbstractFlowPass.cs (16)
553
switch (node?.
Kind
)
846
switch (node.
Kind
)
871
throw ExceptionUtilities.UnexpectedValue(node.
Kind
);
896
RoslynDebug.Assert(false, $"Should Visit{node.
Kind
} be overridden in {this.GetType().Name}?");
1022
throw ExceptionUtilities.UnexpectedValue(pattern.
Kind
);
1075
throw ExceptionUtilities.UnexpectedValue(pattern.
Kind
);
1869
if (pend.Branch.
Kind
!= BoundKind.YieldReturnStatement)
2131
if (expr.
Kind
!= BoundKind.PropertyAccess)
2164
var refKind = node.Left.
Kind
== BoundKind.BadExpression
2245
receiverOpt.
Kind
!= BoundKind.TypeExpression &&
2426
var childKind = child.
Kind
;
2466
switch (binary.
Kind
)
2477
throw ExceptionUtilities.UnexpectedValue(binary.
Kind
);
2486
switch (binary.
Kind
)
2499
throw ExceptionUtilities.UnexpectedValue(binary.
Kind
);
2505
Debug.Assert(!isBool || binary.
Kind
!= BoundKind.UserDefinedConditionalLogicalOperator);
FlowAnalysis\ControlFlowPass.cs (3)
213
switch (pending.Branch.
Kind
)
241
switch (statement.
Kind
)
304
switch (branch.Branch.
Kind
)
FlowAnalysis\DataFlowsOutWalker.cs (2)
118
switch (node.
Kind
)
239
switch (node.
Kind
)
FlowAnalysis\DefiniteAssignment.cs (20)
242
if (node.
Kind
== BoundKind.Attribute)
737
Debug.Assert(fieldOrEventAccess.
Kind
== BoundKind.FieldAccess || fieldOrEventAccess.
Kind
== BoundKind.EventAccess);
741
switch (n.
Kind
)
873
if (value is { ConstantValueOpt: not null,
Kind
: not BoundKind.InterpolatedString }) return false;
875
switch (value.
Kind
)
913
switch (n.
Kind
)
930
if (n.
Kind
== BoundKind.Local)
1022
switch (expr.
Kind
)
1076
receiver.
Kind
!= BoundKind.TypeExpression &&
1093
receiverOpt.
Kind
!= BoundKind.TypeExpression &&
1334
switch (node.
Kind
)
1437
switch (expression.
Kind
)
1489
switch (node.
Kind
)
1955
switch (pattern.
Kind
)
2082
throw ExceptionUtilities.UnexpectedValue(pattern.
Kind
);
2157
if (stmt.
Kind
!= BoundKind.LocalFunctionStatement)
2405
if (pending.Branch.
Kind
== BoundKind.ReturnStatement)
2479
if (initializer.
Kind
== BoundKind.AddressOfOperator)
2550
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)
392
|| expr.
Kind
== BoundKind.ExpressionWithNullability
462
private bool IsAnalyzingAttribute => methodMainNode.
Kind
== BoundKind.Attribute;
573
Debug.Assert(expression != null || placeholder.
Kind
== BoundKind.InterpolatedStringArgumentPlaceholder);
592
switch (placeholder.
Kind
)
608
throw ExceptionUtilities.UnexpectedValue(placeholder.
Kind
);
2067
switch (expr.
Kind
)
2116
receiver.
Kind
!= BoundKind.TypeExpression &&
2142
switch (node.
Kind
)
2611
switch (expr.
Kind
)
3138
if (!expr.IsSuppressed && RemoveConversion(expr, includeExplicitConversions: false).expression.
Kind
!= BoundKind.ThrowExpression)
4330
Debug.Assert(node.
Kind
is BoundKind.ObjectCreationExpression or BoundKind.DynamicObjectCreationExpression or BoundKind.NewT or BoundKind.NoPiaObjectCreationExpression);
4421
switch (initializer.
Kind
)
4436
switch (initializer.
Kind
)
4449
ExceptionUtilities.UnexpectedValue(node.
Kind
);
4466
switch (left.
Kind
)
5200
if (child.
Kind
== BoundKind.ArrayInitialization)
5821
switch (operand.
Kind
)
6017
while (possiblyConversion.
Kind
== BoundKind.Conversion)
7996
return (argument.
Kind
== BoundKind.Lambda);
8652
switch (expr.
Kind
)
8704
if (argument.
Kind
== BoundKind.Lambda)
8713
if (argument.
Kind
== BoundKind.CollectionExpression)
8849
if (expr.
Kind
!= BoundKind.Conversion)
8932
switch (value.
Kind
)
9773
if (operandType.Type?.IsTupleType == true || conversionOperand.
Kind
== BoundKind.TupleLiteral)
10783
if (left.
Kind
== BoundKind.EventAccess && ((BoundEventAccess)left).EventSymbol.IsWindowsRuntimeEvent)
11199
switch (expr.
Kind
)
11217
switch (expr.
Kind
)
11570
if (initializer.
Kind
== BoundKind.AddressOfOperator)
11576
if (node.Expression.
Kind
== BoundKind.AddressOfOperator)
11862
if (node.Expression.
Kind
!= BoundKind.Conversion)
12428
throw ExceptionUtilities.UnexpectedValue(binary.
Kind
);
12443
throw ExceptionUtilities.UnexpectedValue(binary.
Kind
);
FlowAnalysis\NullableWalker.DebugVerifier.cs (2)
73
else if (overrideSkippedExpression || !s_skippedExpressions.Contains(expression.
Kind
))
176
if (!s_skippedExpressions.Contains(child.
Kind
))
FlowAnalysis\NullableWalker.SnapshotManager.cs (1)
106
if (node.
Kind
== BoundKind.TypeExpression || node.WasCompilerGenerated)
FlowAnalysis\NullableWalker_Patterns.cs (5)
530
throw ExceptionUtilities.UnexpectedValue(p.Evaluation.
Kind
);
607
throw ExceptionUtilities.UnexpectedValue(test.
Kind
);
666
throw ExceptionUtilities.UnexpectedValue(dagNode.
Kind
);
819
throw ExceptionUtilities.UnexpectedValue(evaluation.
Kind
);
958
_ => throw ExceptionUtilities.UnexpectedValue(e.
Kind
)
FlowAnalysis\ReadWriteWalker.cs (4)
147
if (!IsInside && node.Span.Contains(RegionSpan) && (expr.
Kind
== BoundKind.FieldAccess))
188
switch (receiver.
Kind
)
238
switch (node.
Kind
)
304
switch (underlying.
Kind
)
FlowAnalysis\RegionAnalysisContext.cs (1)
49
switch (firstInRegion.
Kind
)
FlowAnalysis\VariablesDeclaredWalker.cs (1)
159
throw ExceptionUtilities.UnexpectedValue(pattern.
Kind
);
Generated\BoundNodes.xml.Generated.cs (1)
8973
switch (node.
Kind
)
Lowering\AsyncRewriter\AsyncMethodToStateMachineRewriter.cs (3)
315
if (node.Expression.
Kind
== BoundKind.AwaitExpression)
319
else if (node.Expression.
Kind
== BoundKind.AssignmentOperator)
322
if (expression.Right.
Kind
== BoundKind.AwaitExpression)
Lowering\BoundTreeToDifferentEnclosingContextRewriter.cs (1)
40
Debug.Fail($"Override the visitor for {node.
Kind
}");
Lowering\ClosureConversion\ClosureConversion.Analysis.cs (2)
109
switch (node.
Kind
)
129
throw ExceptionUtilities.UnexpectedValue(node.
Kind
);
Lowering\ClosureConversion\ClosureConversion.cs (3)
1109
if (visited.
Kind
!= BoundKind.Call)
1336
if (node.Argument.
Kind
== BoundKind.Lambda)
1383
receiver.
Kind
== BoundKind.TypeExpression &&
Lowering\ClosureConversion\ExpressionLambdaRewriter.cs (7)
139
switch (stmt.
Kind
)
158
throw ExceptionUtilities.UnexpectedValue(stmt.
Kind
);
185
switch (node.
Kind
)
256
throw ExceptionUtilities.UnexpectedValue(node.
Kind
);
540
if (operand.
Kind
== BoundKind.Conversion)
805
if (node.Argument.
Kind
== BoundKind.MethodGroup)
987
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;
292
bool hasBaseReceiver = node.ReceiverOpt != null && node.ReceiverOpt.
Kind
== BoundKind.BaseReference;
711
if (current.Left.
Kind
== BoundKind.BinaryOperator)
815
if (operand.
Kind
== BoundKind.FieldAccess)
915
if (node.Argument.
Kind
!= BoundKind.MethodGroup)
999
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
)
316
if (node.Left.ConstantValueOpt != null && node.Right.ConstantValueOpt == null && node.Right.
Kind
== BoundKind.Conversion)
321
if (node.Right.ConstantValueOpt != null && node.Left.ConstantValueOpt == null && node.Left.
Kind
== BoundKind.Conversion)
346
return node.
Kind
== BoundKind.Conversion && ((BoundConversion)node).ExplicitCastInCode;
352
if (node.
Kind
!= BoundKind.Conversion) return false;
576
if (operand.
Kind
== BoundKind.Conversion)
605
if (expr.
Kind
!= BoundKind.Conversion)
864
if (node.
Kind
== BoundKind.Conversion)
888
while (right.
Kind
== BoundKind.Conversion)
903
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 (11)
290
node.
Kind
is not (BoundKind.ImplicitReceiver or BoundKind.ObjectOrCollectionValuePlaceholder or BoundKind.ValuePlaceholder or BoundKind.CollectionBuilderElementsPlaceholder))
313
return node.
Kind
== BoundKind.DeconstructionAssignmentOperator && !((BoundDeconstructionAssignmentOperator)node).IsUsed;
718
if (initializer.
Kind
== BoundKind.Block)
888
switch (initializer.
Kind
)
895
if (initializer.
Kind
== BoundKind.ExpressionStatement)
903
return ((BoundExpressionStatement)initializer).Expression.
Kind
== BoundKind.AssignmentOperator;
920
if (statement.
Kind
!= BoundKind.ExpressionStatement)
931
Debug.Assert(assignment.Left.
Kind
== BoundKind.FieldAccess);
1027
switch (expr.
Kind
)
1128
throw ExceptionUtilities.UnexpectedValue(expr.
Kind
);
1134
RoslynDebug.Assert(expr is not BoundValuePlaceholderBase, $"Placeholder kind {expr.
Kind
} must be handled explicitly");
Lowering\LocalRewriter\LocalRewriter.DecisionDagRewriter.cs (6)
89
throw ExceptionUtilities.UnexpectedValue(node.
Kind
);
388
ImmutableArray<BoundDecisionDagNode> nodesToLower = sortedNodes.WhereAsArray(n => n.
Kind
!= BoundKind.WhenDecisionDagNode && n.
Kind
!= BoundKind.LeafDecisionDagNode);
980
if (!sortedNodes.Any(static n => n.
Kind
== BoundKind.WhenDecisionDagNode)) return;
1192
Debug.Assert(left.
Kind
== BoundKind.Local && left == binding.VariableAccess);
1241
throw ExceptionUtilities.UnexpectedValue(node.
Kind
);
Lowering\LocalRewriter\LocalRewriter.PatternLocalRewriter.cs (4)
534
if ((loweredInput.
Kind
== BoundKind.Local || loweredInput.
Kind
== BoundKind.Parameter)
659
if (canShareInputs && (expr.
Kind
== BoundKind.Parameter || expr.
Kind
== BoundKind.Local) && _tempAllocator.TrySetTemp(temp, expr))
Lowering\LocalRewriter\LocalRewriter_AssignmentOperator.cs (5)
27
switch (left.
Kind
)
103
switch (rewrittenLeft.
Kind
)
183
switch (rewrittenLeft.
Kind
)
187
throw ExceptionUtilities.UnexpectedValue(rewrittenLeft.
Kind
);
253
if (sequence.Value.
Kind
== BoundKind.IndexerAccess)
Lowering\LocalRewriter\LocalRewriter_BinaryOperator.cs (13)
291
if (loweredRight.
Kind
== BoundKind.Local || loweredRight.
Kind
== BoundKind.Parameter)
303
if (loweredRight.
Kind
== BoundKind.Local || loweredRight.
Kind
== BoundKind.Parameter)
490
if (loweredLeft.
Kind
== BoundKind.ArrayLength && loweredRight.IsDefaultValue())
505
if (loweredRight.
Kind
== BoundKind.ArrayLength && loweredLeft.IsDefaultValue())
520
if (loweredLeft.
Kind
== BoundKind.ArrayLength && loweredRight.IsDefaultValue())
524
else if (loweredRight.
Kind
== BoundKind.ArrayLength && loweredLeft.IsDefaultValue())
660
if (constantLeft == null && loweredLeft.
Kind
!= BoundKind.Local && loweredLeft.
Kind
!= BoundKind.Parameter)
721
if (expression.
Kind
== BoundKind.Conversion)
1627
if (nonNullRight != null && nonNullRight.ConstantValueOpt != null && left.
Kind
== BoundKind.Sequence)
1630
if (seq.Value.
Kind
== BoundKind.ConditionalOperator)
Lowering\LocalRewriter\LocalRewriter_Block.cs (1)
109
switch (node.
Kind
)
Lowering\LocalRewriter\LocalRewriter_Call.cs (6)
33
switch (node.Expression.
Kind
)
43
Debug.Assert(methodGroup.ReceiverOpt == null || methodGroup.ReceiverOpt.
Kind
!= BoundKind.TypeOrValueExpression);
568
switch (current.
Kind
)
891
var u => throw ExceptionUtilities.UnexpectedValue(u.
Kind
)
1621
if (argument.
Kind
== BoundKind.Local)
1710
if (argument.
Kind
== BoundKind.Local)
Lowering\LocalRewriter\LocalRewriter_CompoundAssignmentOperator.cs (7)
99
if (node.Left.
Kind
== BoundKind.DynamicMemberAccess &&
289
Debug.Assert(receiverOpt.
Kind
!= BoundKind.TypeExpression);
611
Debug.Assert(receiver.
Kind
!= BoundKind.TypeExpression);
721
switch (originalLHS.
Kind
)
872
throw ExceptionUtilities.UnexpectedValue(originalLHS.
Kind
);
971
switch (expression.
Kind
)
1013
switch (expression.
Kind
)
Lowering\LocalRewriter\LocalRewriter_Conversion.cs (4)
31
_ => throw ExceptionUtilities.UnexpectedValue(node.Operand.
Kind
)
231
switch (rewrittenNode.
Kind
)
1320
if (operand.
Kind
== BoundKind.Sequence)
1323
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)
536
if (node.LengthOrCountAccess.
Kind
is not BoundKind.Local || receiver.
Kind
is not (BoundKind.Local or BoundKind.Parameter))
578
if (makeOffsetInput.ConstantValueOpt is null && lengthAccess.
Kind
is not BoundKind.ArrayLength)
839
if (node.LengthOrCountAccess.
Kind
is not BoundKind.Local || receiver.
Kind
is not (BoundKind.Local or BoundKind.Parameter))
990
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)
103
Debug.Assert(!_inExpressionLambda && lhsRead.
Kind
!= BoundKind.PropertyAccess);
107
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 (13)
27
throw ExceptionUtilities.UnexpectedValue(initializerExpression.
Kind
);
62
throw ExceptionUtilities.UnexpectedValue(initializerExpression.
Kind
);
70
switch (initializerExpression.
Kind
)
81
throw ExceptionUtilities.UnexpectedValue(initializerExpression.
Kind
);
91
if (initializer.
Kind
!= BoundKind.CollectionElementInitializer)
93
throw ExceptionUtilities.UnexpectedValue(initializer.
Kind
);
137
if (initializer.
Kind
== BoundKind.CollectionElementInitializer)
144
Debug.Assert(initializer.
Kind
== BoundKind.DynamicCollectionElementInitializer);
314
bool isRhsNestedInitializer = right.
Kind
is BoundKind.ObjectInitializerExpression or BoundKind.CollectionInitializerExpression;
325
switch (left.
Kind
)
465
throw ExceptionUtilities.UnexpectedValue(rewrittenArrayAccess.
Kind
);
547
throw ExceptionUtilities.UnexpectedValue(left.
Kind
);
609
throw ExceptionUtilities.UnexpectedValue(lhs.
Kind
);
Lowering\LocalRewriter\LocalRewriter_StringConcat.cs (1)
627
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)
46
if (node.Operand.
Kind
== BoundKind.BinaryOperator)
322
if (loweredOperand.
Kind
== BoundKind.Sequence)
325
if (seq.Value.
Kind
== BoundKind.ConditionalOperator)
634
switch (expression.
Kind
)
1021
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 (2)
226
if (loweredReceiver.
Kind
== BoundKind.TypeExpression)
673
int discardCount = loweredArguments.Count(a => a.
Kind
== BoundKind.DiscardExpression);
Lowering\LocalRewriter\PipelinePhaseValidator.cs (3)
100
if (_completedPhase >= DoesNotSurvive(node.
Kind
))
101
Debug.Assert(false, $"Bound nodes of kind {node.
Kind
} should not survive past {DoesNotSurvive(node.
Kind
)}");
Lowering\MethodToClassRewriter.cs (6)
259
if (originalLeft.
Kind
!= BoundKind.Local)
273
Debug.Assert(originalRight.
Kind
!= BoundKind.ConvertedStackAllocExpression);
295
if (rewrittenLeft.
Kind
!= BoundKind.Local && originalRight.
Kind
== BoundKind.ConvertedStackAllocExpression)
377
return originalReceiver is {
Kind
: BoundKind.BaseReference } &&
378
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.
612
if (newList[i].
Kind
== SpillSequenceBuilderKind)
883
switch (left.
Kind
)
Lowering\StateMachineRewriter\IteratorAndAsyncCaptureWalker.cs (1)
316
if (node.ReceiverOpt != null && node.ReceiverOpt.
Kind
== BoundKind.ThisReference)
Lowering\StateMachineRewriter\MethodToStateMachineRewriter.cs (3)
417
if (statement.
Kind
== BoundKind.Block)
421
if (rewrittenStatements.Length == 1 && rewrittenStatements[0].
Kind
== BoundKind.StateMachineScope)
620
if (node.Left.
Kind
!= BoundKind.Local)
Lowering\StateMachineRewriter\RefInitializationHoister.cs (3)
147
switch (expr.
Kind
)
216
if (receiver.
Kind
!= BoundKind.ThisReference && !isFieldOfStruct)
299
throw ExceptionUtilities.UnexpectedValue(expr.
Kind
);
Lowering\SyntheticBoundNodeFactory.cs (3)
586
if (body.
Kind
!= BoundKind.Block)
1742
var discardsPresent = arguments.Any(static a => a.
Kind
== BoundKind.DiscardExpression);
1747
(arg, t) => arg.
Kind
== BoundKind.DiscardExpression ? t.factory.MakeTempForDiscard((BoundDiscardExpression)arg, t.builder) : arg,
Operations\CSharpOperationFactory.cs (32)
34
switch (boundNode.
Kind
)
311
switch (boundNode.
Kind
)
340
throw ExceptionUtilities.UnexpectedValue(boundNode.
Kind
);
405
switch (declaration.
Kind
)
423
throw ExceptionUtilities.UnexpectedValue(declaration.
Kind
);
529
switch (declaration.
Kind
)
555
throw ExceptionUtilities.UnexpectedValue(declaration.
Kind
);
615
throw ExceptionUtilities.UnexpectedValue(boundNode.
Kind
);
814
throw ExceptionUtilities.UnexpectedValue(indexer.
Kind
);
830
throw ExceptionUtilities.UnexpectedValue(indexer.
Kind
);
973
if (receiver?.
Kind
== BoundKind.TypeExpression)
1085
Debug.Assert(boundOperand.
Kind
== BoundKind.BadExpression ||
1087
ExpressionOpt?.
Kind
== BoundKind.BadExpression);
1097
if (boundOperand.
Kind
== BoundKind.ConvertedTupleLiteral && TypeSymbol.Equals(boundOperand.Type, boundConversion.Type, TypeCompareKind.ConsiderEverything2))
1111
if (boundConversion.ExplicitCastInCode && conversion.IsIdentity && boundOperand.
Kind
== BoundKind.Conversion)
1117
nestedOperand.
Kind
== BoundKind.ConvertedTupleLiteral &&
1133
if ((boundOperand.
Kind
== BoundKind.Lambda ||
1134
boundOperand.
Kind
== BoundKind.UnboundLambda ||
1135
boundOperand.
Kind
== BoundKind.MethodGroup) &&
1377
boundAssignmentOperator.Right?.
Kind
== BoundKind.ObjectInitializerExpression ||
1378
boundAssignmentOperator.Right?.
Kind
== BoundKind.CollectionInitializerExpression;
1525
{
Kind
: var kind } => throw ExceptionUtilities.UnexpectedValue(kind)
1684
if (boundIndexerAccess.LengthOrCountAccess.
Kind
== BoundKind.ArrayLength)
2288
{
Kind
: var kind } => throw ExceptionUtilities.UnexpectedValue(kind)
2321
if (part.
Kind
== BoundKind.StringInsert)
2381
throw ExceptionUtilities.UnexpectedValue(part.
Kind
);
2397
_ => throw ExceptionUtilities.UnexpectedValue(value.
Kind
),
2494
_ => throw ExceptionUtilities.UnexpectedValue(part.
Kind
)
2517
throw ExceptionUtilities.UnexpectedValue(current.
Kind
);
2580
if (variable == null && boundDeclarationPattern.VariableAccess?.
Kind
== BoundKind.DiscardExpression)
2794
Debug.Assert(boundSwitchLabel.Pattern.
Kind
== BoundKind.DiscardPattern);
2798
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)
1105
switch (expression.
Kind
)
Symbols\Source\SourceComplexParameterSymbol.cs (1)
407
if (convertedExpression.ConstantValueOpt == null && convertedExpression.
Kind
== BoundKind.Conversion &&
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)
5250
_builder.Add($"Yes, {expr.
Kind
} '{text}' requires fixing.");
5254
_builder.Add(string.Concat($"No, {expr.
Kind
} '{text}' does not require fixing.", accessedLocalOrParameterOpt is null