767 references to Kind
Microsoft.CodeAnalysis.CSharp (746)
Binder\Binder.cs (1)
886RoslynDebug.Assert(statement.Kind != BoundKind.StatementList);
Binder\Binder.ValueChecks.cs (29)
734switch (expr.Kind) 835if (expr.Kind == BoundKind.MethodGroup && valueKind != BindValueKind.RValueOrMethodGroup) 861if ((object)otherSymbol != null && receiver?.Kind == BoundKind.TypeOrValueExpression) 898switch (expression?.Kind) 901case BoundKind.QueryClause when ((BoundQueryClause)expression).Value.Kind == BoundKind.TypeOrValueExpression: 930switch (expr.Kind) 935case BoundKind.ImplicitIndexerAccess when ((BoundImplicitIndexerAccess)expr).IndexerOrSliceAccess.Kind == BoundKind.IndexerAccess: 956switch (expr.Kind) 1120throw ExceptionUtilities.UnexpectedValue(implicitIndexer.IndexerOrSliceAccess.Kind); 1193RoslynDebug.Assert(expr is not BoundValuePlaceholderBase, $"Placeholder kind {expr.Kind} should be explicitly handled"); 1238switch (expr.Kind) 1863return Flags.Includes(BinderFlags.ObjectInitializerMember) && receiver.Kind == BoundKind.ObjectOrCollectionValuePlaceholder || 2027ReportDiagnosticsIfObsolete(diagnostics, setMethod, node, receiver?.Kind == BoundKind.BaseReference); 2077ReportDiagnosticsIfObsolete(diagnostics, getMethod, node, receiver?.Kind == BoundKind.BaseReference); 2160if (receiverOpt?.Kind == BoundKind.BaseReference && member.IsAbstract) 2649if (argument.Kind == BoundKind.ArgListOperator) 3685switch (expr.Kind) 3835throw ExceptionUtilities.UnexpectedValue(implicitIndexerAccess.IndexerOrSliceAccess.Kind); 3965switch (expr.Kind) 4127throw ExceptionUtilities.UnexpectedValue(implicitIndexerAccess.IndexerOrSliceAccess.Kind); 4318switch (expr.Kind) 4460throw ExceptionUtilities.UnexpectedValue(implicitIndexerAccess.IndexerOrSliceAccess.Kind); 4724RoslynDebug.Assert(false, $"{expr.Kind} expression of {expr.Type} type"); 4825if (expr.Kind == BoundKind.AssignmentOperator) 4977switch (expr.Kind) 5161throw ExceptionUtilities.UnexpectedValue(implicitIndexerAccess.IndexerOrSliceAccess.Kind); 5480RoslynDebug.Assert(false, $"{expr.Kind} expression of {expr.Type} type"); 5813throw ExceptionUtilities.UnexpectedValue(expression.Kind); 5857throw ExceptionUtilities.UnexpectedValue(expression.Kind);
Binder\Binder_Attributes.cs (2)
812switch (assignment.Left.Kind) 862switch (node.Kind)
Binder\Binder_Await.cs (3)
81if (expression.Kind != BoundKind.Call || 586if (getAwaiterCall.Kind != BoundKind.Call) 693if (getAwaiterGetResultCall.Kind != BoundKind.Call)
Binder\Binder_Conversions.cs (15)
138if (conversion.IsAnonymousFunction && source.Kind == BoundKind.UnboundLambda) 209if (source.Kind == BoundKind.UnconvertedSwitchExpression) 231if (source.Kind == BoundKind.UnconvertedCollectionExpression) 253if (source.Kind == BoundKind.UnconvertedConditionalOperator) 1308if (boundExpression.Kind == BoundKind.FieldAccess || boundExpression.Kind == BoundKind.PropertyAccess) 1315if (boundExpression.Kind != BoundKind.MethodGroup) 2166Debug.Assert(source.Kind is BoundKind.MethodGroup or BoundKind.UnboundLambda); 2173if (source.Kind == BoundKind.UnboundLambda && 2182source.Kind == BoundKind.MethodGroup && 2534if (node.Kind != BoundKind.MethodGroup) 2677if (receiverOpt.Kind == BoundKind.QueryClause) 2779while (receiverOpt.Kind == BoundKind.QueryClause) 2784return receiverOpt.Kind == BoundKind.TypeExpression; 2794switch (receiverOpt.Kind)
Binder\Binder_Deconstruct.cs (8)
212if (boundRHS.Kind == BoundKind.TupleLiteral) 369switch (expression.Kind) 383throw ExceptionUtilities.UnexpectedValue(expression.Kind); 404switch (variable.Single.Kind) 488if (element.Kind == BoundKind.TupleLiteral) 597if (expression.Kind == BoundKind.DiscardExpression) 661if (memberAccess.Kind != BoundKind.MethodGroup) 793if (expression == null && checkedVariable.Kind != BoundKind.DiscardExpression)
Binder\Binder_Expressions.cs (41)
205BoundKind exprKind = expr.Kind; 259if (valueOrType.Kind == BoundKind.TypeExpression) 416Debug.Assert(expr.Kind is BoundKind.UnboundLambda or BoundKind.MethodGroup); 546if (expr.Kind == BoundKind.ArgListOperator) 588if (IsEarlyAttributeBinder && result.Kind == BoundKind.MethodGroup && (!IsInsideNameof || EnclosingNameofArgument != node)) 2774if (operand.Kind == BoundKind.UnboundLambda) 2821switch (operand.Kind) 3118switch (arg.Kind) 3511else if (argument.Kind == BoundKind.OutVariablePendingInference) 3515else if (argument.Kind == BoundKind.OutDeconstructVarPendingInference) 3519else if (argument.Kind == BoundKind.DiscardExpression && !argument.HasExpressionType()) 3554Debug.Assert(arguments[arg].Kind is not 5439else if (argument.Kind == BoundKind.MethodGroup) 5876if (boundMember.Kind == BoundKind.PropertyGroup) 5918BoundKind boundMemberKind = boundMember.Kind; 6507if (addMethodInvocation.Kind == BoundKind.DynamicInvocation) 6518else if (addMethodInvocation.Kind == BoundKind.Call) 6547Debug.Assert(addMethodInvocation.Kind == BoundKind.BadExpression); 7024switch (classCreation.Kind) 7037throw ExceptionUtilities.UnexpectedValue(classCreation.Kind); 7509if (boundValue.Kind == BoundKind.Conversion) 7701if (boundLeft.Kind == BoundKind.UnboundLambda) 7746switch (boundLeft.Kind) 7778if (boundLeft.Kind == BoundKind.Literal && ((BoundLiteral)boundLeft).ConstantValueOpt == ConstantValue.Null) 7965switch (expr.Kind) 8092bool leftIsBaseReference = boundLeft.Kind == BoundKind.BaseReference; 8199if (boundLeft.HasAnyErrors && boundLeft.Kind != BoundKind.TypeOrValueExpression) 8220else if (boundLeft.Kind == BoundKind.TypeExpression || 8221boundLeft.Kind == BoundKind.BaseReference || 8458ReportDiagnosticsIfObsolete(diagnostics, symbol, node, hasBaseReceiver: left.Kind == BoundKind.BaseReference); 9020ReportDiagnosticsIfObsolete(diagnostics, propertySymbol, node, hasBaseReceiver: receiver?.Kind == BoundKind.BaseReference); 9123switch (receiver.Kind) 9321if (receiver.Kind == BoundKind.PropertyGroup) 9736if (index.Kind == BoundKind.OutVariablePendingInference) 9740else if (index.Kind == BoundKind.DiscardExpression && !index.HasExpressionType()) 9928LookupOptions lookupOptions = expr.Kind == BoundKind.BaseReference ? LookupOptions.UseBaseReferenceAccessibility : LookupOptions.Default; 10042BoundKind receiverKind = receiver.Kind; 10184ReportDiagnosticsIfObsolete(diagnostics, property, syntax, hasBaseReceiver: receiver != null && receiver.Kind == BoundKind.BaseReference); 10194if (!gotError && receiver != null && receiver.Kind == BoundKind.ThisReference && receiver.WasCompilerGenerated) 11344if (access.Kind == BoundKind.MethodGroup) 11508if (receiver.Kind == BoundKind.UnboundLambda)
Binder\Binder_Initializers.cs (2)
268if (statement.Kind == BoundKind.LabeledStatement) 271while (labeledStatementBody.Kind == BoundKind.LabeledStatement)
Binder\Binder_InterpolatedString.cs (1)
571_ => throw ExceptionUtilities.UnexpectedValue(unconvertedExpression.Kind)
Binder\Binder_Invocation.cs (30)
107if (!allowFieldsAndProperties && (boundExpression.Kind == BoundKind.FieldAccess || boundExpression.Kind == BoundKind.PropertyAccess)) 112if (boundExpression.Kind == BoundKind.FieldAccess) 124Debug.Assert(allowFieldsAndProperties || boundExpression.Kind is (BoundKind.MethodGroup or BoundKind.BadExpression)); 129Debug.Assert(!args.Any(static e => e.Kind == BoundKind.OutVariablePendingInference || 130e.Kind == BoundKind.OutDeconstructVarPendingInference || 131e.Kind == BoundKind.DiscardExpression && !e.HasExpressionType())); 145if (queryClause != null && result.Kind == BoundKind.DynamicInvocation) 161if (boundExpression.Kind == BoundKind.FieldAccess) 246string name = boundExpression.Kind == BoundKind.MethodGroup ? GetName(node.Expression) : null; 280if (argument.Kind == BoundKind.OutVariablePendingInference) 357else if (boundExpression.Kind == BoundKind.MethodGroup) 410if (expression.Kind == BoundKind.MethodGroup) 418switch (receiver.Kind) 593if (arg.Kind == BoundKind.Lambda || arg.Kind == BoundKind.UnboundLambda) 599else if (arg.Kind == BoundKind.MethodGroup) 605else if (arg.Kind == BoundKind.ArgListOperator) 734Debug.Assert(extensionMemberAccess.Kind != BoundKind.MethodGroup); 1063switch (expression.Kind) 1079else if (call.ReceiverOpt.Kind == BoundKind.BaseReference && this.ContainingType.IsRestrictedType()) 1103throw ExceptionUtilities.UnexpectedValue(expression.Kind); 1314if (!gotError && method.RequiresInstanceReceiver && receiver != null && receiver.Kind == BoundKind.ThisReference && receiver.WasCompilerGenerated) 1330bool hasBaseReceiver = receiver != null && receiver.Kind == BoundKind.BaseReference; 1898switch (receiver.Kind) 1964if ((object)expr != null && expr.Kind != BoundKind.TypeExpression) 2102switch (argument.Kind) 2148if (argument.Kind == BoundKind.OutVariablePendingInference) 2159else if (argument.Kind == BoundKind.DiscardExpression) 2267var originalMethods = (expr.Kind == BoundKind.MethodGroup) ? ((BoundMethodGroup)expr).Methods : ImmutableArray<MethodSymbol>.Empty;
Binder\Binder_Operators.cs (17)
36if (left.Kind == BoundKind.EventAccess) 104if (left.Kind == BoundKind.EventAccess && !CheckEventValueKind((BoundEventAccess)left, BindValueKind.Assignable, diagnostics)) 307Debug.Assert(left.Kind != BoundKind.EventAccess || hasError); 873if (result.Kind == BoundKind.TypeExpression 878else if (result.Kind == BoundKind.BadExpression) 1234_ => throw ExceptionUtilities.UnexpectedValue(current.Right.Kind) 1287switch (left.Kind, right.Kind) 2794if (left.Kind == BoundKind.Conversion && right.Kind == BoundKind.Conversion) 3871switch (expr.Kind) 3995BoundKind exprKind = expr.Kind; 4584switch (operand.Kind) 4716operand.Kind == BoundKind.MethodGroup || 5132switch (operand.Kind) 5445if (leftOperand.Kind == BoundKind.UnboundLambda || leftOperand.Kind == BoundKind.MethodGroup)
Binder\Binder_Patterns.cs (6)
509wasExpression = expression.Kind != BoundKind.TypeExpression; 516Debug.Assert(expression is { Kind: BoundKind.TypeExpression, Type: { } }); 538wasExpression = expression.Kind switch { BoundKind.BadExpression => false, BoundKind.TypeExpression => false, _ => true }; 687if (convertedExpression.Kind == BoundKind.Conversion) 1562if (boundMember.Kind == BoundKind.PropertyGroup) 1570switch (boundMember.Kind)
Binder\Binder_Query.cs (7)
930while (ultimateReceiver.Kind == BoundKind.QueryClause) 937Debug.Assert(ultimateReceiver.Kind != BoundKind.MethodGroup || ultimateReceiver.HasAnyErrors); 955else if (ultimateReceiver.Kind == BoundKind.NamespaceExpression) 959else if (ultimateReceiver.Kind == BoundKind.Lambda || ultimateReceiver.Kind == BoundKind.UnboundLambda) 967else if (ultimateReceiver.Kind == BoundKind.TypeExpression) 975else if (ultimateReceiver.Kind == BoundKind.TypeOrValueExpression)
Binder\Binder_QueryErrors.cs (1)
220if (arg.Kind == BoundKind.UnboundLambda)
Binder\Binder_Statements.cs (26)
152(result.Kind == BoundKind.Block && 894BoundExpression expression = value.Kind is BoundKind.UnboundLambda or BoundKind.MethodGroup ? 1245switch (initializerOpt.Kind) 1428bool discardAssignment = op1.Kind == BoundKind.DiscardExpression; 1507if (op1.Kind != BoundKind.DynamicIndexerAccess && 1508op1.Kind != BoundKind.DynamicMemberAccess && 1509op1.Kind != BoundKind.DynamicObjectInitializerMember) 1525if ((op1.Kind == BoundKind.EventAccess) && 1582else if (op1.Kind is BoundKind.Local or BoundKind.Parameter) 1595Debug.Assert(op1.Kind != BoundKind.Parameter); // If the assert fails, add a corresponding test. 1670switch (expr.Kind) 1703throw ExceptionUtilities.UnexpectedValue(implicitIndexerAccess.IndexerOrSliceAccess.Kind); 1754_ => throw ExceptionUtilities.UnexpectedValue(e.Kind) 1810(propertyIsStatic || receiver?.Kind == BoundKind.ThisReference); 1845else if (receiver.Kind == BoundKind.BaseReference) 1971if (expression.HasAnyErrors && expression.Kind != BoundKind.UnboundLambda) 2359switch (operand.Kind) 2479Debug.Assert(operand.HasAnyErrors && operand.Kind != BoundKind.UnboundLambda, "Missing a case in implicit conversion error reporting"); 2722if (expr.Kind == BoundKind.AssignmentOperator) 2725if (assignment.Right.Kind == BoundKind.Literal && assignment.Right.ConstantValueOpt.Discriminator == ConstantValueTypeDiscriminator.Boolean) 3197if (!argument.HasAnyErrors || argument.Kind == BoundKind.UnboundLambda) 3473if (expression.Kind == BoundKind.DelegateCreationExpression || expression.Kind == BoundKind.NameOfOperator) 3501if ((refKind != RefKind.None) != (returnRefKind != RefKind.None) && expression.Kind != BoundKind.ThrowExpression) 4155if (boundAccess.Kind != BoundKind.MethodGroup) 4183if (patternMethodCall.Kind != BoundKind.Call)
Binder\Binder_TupleOperators.cs (2)
217Debug.Assert((object)left.Type != null || left.Kind == BoundKind.TupleLiteral); 218Debug.Assert((object)right.Type != null || right.Kind == BoundKind.TupleLiteral);
Binder\DecisionDagBuilder.cs (16)
314throw ExceptionUtilities.UnexpectedValue(pattern.Kind); 962throw ExceptionUtilities.UnexpectedValue(n.Kind); 1061throw ExceptionUtilities.UnexpectedValue(n?.Kind); 1737return $"t{tempIdentifier(a)}={a.Kind}({tempName(a.Input)} as {a.Type})"; 1739return $"t{tempIdentifier(e)}={e.Kind}({tempName(e.Input)}.{e.Field.Name})"; 1741return $"t{tempIdentifier(e)}={e.Kind}({tempName(e.Input)}.{e.Property.Name})"; 1743return $"t{tempIdentifier(e)}={e.Kind}({tempName(e.Input)}[{e.Index}])"; 1745return $"{e.Kind}({tempName(e.Target)}<--{tempName(e.Input)})"; 1747return $"t{tempIdentifier(e)}={e.Kind}({tempName(e.Input)})"; 1749return $"?{d.Kind}({tempName(d.Input)} is {b.Type})"; 1751return $"?{d.Kind}({tempName(d.Input)} == {v.Value})"; 1761return $"?{d.Kind}({tempName(d.Input)} {operatorName} {r.Value})"; 1763return $"?{d.Kind}({tempName(d.Input)})"; 2431if (RemainingTests[0] is One { Test: { Kind: BoundKind.DagNonNullTest } planA }) 2438case One { Test: { Kind: BoundKind.DagTypeTest } planB1 }: 2445case One { Test: { Kind: BoundKind.DagValueTest } planB2 }:
Binder\DecisionDagBuilder_ListPatterns.cs (1)
19list.Subpatterns.Count(p => p.Kind == BoundKind.SlicePattern) == (list.HasSlice ? 1 : 0) &&
Binder\ForEachLoopBinder.cs (1)
410if (iterationErrorExpression.Kind == BoundKind.DiscardExpression)
Binder\ForLoopBinder.cs (2)
108Debug.Assert(increment.Kind != BoundKind.StatementList || ((BoundStatementList)increment).Statements.Length > 1); 113if (increment.Kind == BoundKind.StatementList)
Binder\LockOrUsingBinder.cs (1)
59switch (expression.Kind)
Binder\PatternExplainer.cs (1)
164throw ExceptionUtilities.UnexpectedValue(currentNode.Kind);
Binder\RefSafetyAnalysis.cs (1)
582if (node.Left.Kind != BoundKind.DiscardExpression)
Binder\Semantics\Conversions\ConversionsBase.cs (4)
1059switch (sourceExpression.Kind) 1410if (sourceExpression.Kind == BoundKind.TupleLiteral) 1646if (source.Kind != BoundKind.UnboundLambda) 1949if (sourceExpressionOpt?.Kind == BoundKind.TupleLiteral)
Binder\Semantics\Operators\BinaryOperatorOverloadResolution.cs (1)
469&& nonDelegate.Kind == BoundKind.UnboundLambda)
Binder\Semantics\OverloadResolution\MethodGroup.cs (1)
117if (this.Receiver.Kind == BoundKind.TypeExpression)
Binder\Semantics\OverloadResolution\MethodTypeInference.cs (14)
635if (argument.Kind == BoundKind.UnboundLambda && target.Type.GetDelegateType() is { }) 640else if (argument.Kind == BoundKind.UnconvertedCollectionExpression) 644else if (argument.Kind != BoundKind.TupleLiteral || 877if (argument.Kind == BoundKind.TupleLiteral && (object)argument.Type == null) 881else if (argument.Kind == BoundKind.UnconvertedCollectionExpression) 1021if ((isFunctionPointer && argument.Kind != BoundKind.UnconvertedAddressOfOperator) || 1022(!isFunctionPointer && argument.Kind is not (BoundKind.UnboundLambda or BoundKind.MethodGroup))) 1077if ((isFunctionPointer && argument.Kind != BoundKind.UnconvertedAddressOfOperator) || 1078(!isFunctionPointer && argument.Kind is not (BoundKind.UnboundLambda or BoundKind.MethodGroup))) 1446if (source.Kind is not (BoundKind.MethodGroup or BoundKind.UnconvertedAddressOfOperator)) 1457if (delegateOrFunctionPointerType.IsFunctionPointer() != (source.Kind == BoundKind.UnconvertedAddressOfOperator)) 1557if (source.Kind != BoundKind.UnboundLambda) 1611if (source.Kind != BoundKind.UnboundLambda) 3088if (source.Kind != BoundKind.UnboundLambda)
Binder\Semantics\OverloadResolution\OverloadResolution.cs (13)
2166var argumentKind = arguments[i].Kind; 2308var argumentKind = arguments[i].Kind; 2472if (arguments[i].Kind == BoundKind.ArgListOperator) 2618if (arguments[i].Kind != BoundKind.ArgListOperator) 2932var nodeKind = node.Kind; 3255if (node.Kind == BoundKind.TupleLiteral) 3271if (node.Kind == BoundKind.UnboundLambda && 3311if (lambda.Body.Statements[0].Kind == BoundKind.ReturnStatement) 3587if (node?.Kind == BoundKind.MethodGroup) 4537if (argument.Kind == BoundKind.ArgListOperator) 4712if (argument.Kind == BoundKind.OutVariablePendingInference || 4713argument.Kind == BoundKind.OutDeconstructVarPendingInference || 4714(argument.Kind == BoundKind.DiscardExpression && (object)argType == null))
Binder\Semantics\OverloadResolution\OverloadResolutionResult.cs (13)
659if (receiverOpt?.Kind == BoundKind.QueryClause) 1070if (argument.Kind == BoundKind.UnboundLambda) 1210argument.Kind != BoundKind.OutDeconstructVarPendingInference && 1211argument.Kind != BoundKind.OutVariablePendingInference && 1212argument.Kind != BoundKind.DiscardExpression) 1218if (argument.Kind == BoundKind.UnboundLambda && refArg == refParameter) 1222else if (argument.Kind == BoundKind.MethodGroup && parameterType.TypeKind == TypeKind.Delegate && 1227else if (argument.Kind == BoundKind.MethodGroup && parameterType.TypeKind == TypeKind.FunctionPointer) 1231else if (argument.Kind == BoundKind.UnconvertedAddressOfOperator && 1236else if (argument.Kind == BoundKind.UnconvertedCollectionExpression) 1301Debug.Assert(argument.Kind != BoundKind.OutDeconstructVarPendingInference); 1302Debug.Assert(argument.Kind != BoundKind.OutVariablePendingInference); 1303Debug.Assert(argument.Kind != BoundKind.DiscardExpression || argument.HasExpressionType());
BoundTree\BoundDagEvaluation.cs (3)
27this.Kind == other.Kind && 45_ => throw ExceptionUtilities.UnexpectedValue(this.Kind)
BoundTree\BoundDagTest.cs (5)
20if (other is null || this.Kind != other.Kind) 46return Hash.Combine(((int)Kind).GetHashCode(), Input.GetHashCode()); 81return $"{e.GetOutputTempDebuggerDisplay()} = {e.Kind}({e.Input.GetDebuggerDisplay()})"; 102return $"{this.Kind}({this.Input.GetDebuggerDisplay()})";
BoundTree\BoundDecisionDag.cs (2)
42throw ExceptionUtilities.UnexpectedValue(node.Kind); 205return this.TopologicallySortedNodes.Any(static node => node is BoundEvaluationDecisionDagNode e && e.Evaluation.Kind == BoundKind.DagAssignmentEvaluation);
BoundTree\BoundExpression.cs (5)
56if ((Kind != BoundKind.Local && Kind != BoundKind.Parameter) || this.WasConverted) 74switch (Kind) 612return this.Condition.Kind == BoundKind.UnaryOperator && ((BoundUnaryOperator)this.Condition).OperatorKind.IsDynamic(); 738if (argument.Kind == BoundKind.TupleLiteral)
BoundTree\BoundExpressionExtensions.cs (9)
22switch (node.Kind) 83return node is { Kind: BoundKind.Literal, ConstantValueOpt: { Discriminator: ConstantValueTypeDiscriminator.Null } }; 88return node.Kind == BoundKind.DefaultLiteral; 93return node.Kind == BoundKind.UnconvertedObjectCreationExpression; 109if (node.Kind == BoundKind.DefaultExpression || node.Kind == BoundKind.DefaultLiteral) 137Debug.Assert(expr.Kind is BoundKind.MethodGroup or BoundKind.UnboundLambda); 170switch (node.Kind) 242switch (boundNode.Kind)
BoundTree\BoundMethodGroup.cs (1)
61if (this.ReceiverOpt == null || this.ReceiverOpt.Kind == BoundKind.TypeExpression)
BoundTree\BoundNode_Source.cs (1)
362appendLine(node.Kind.ToString());
BoundTree\BoundNodeExtensions.cs (10)
42if (statement!.Kind == BoundKind.ExpressionStatement) 45if (expression.Kind == BoundKind.Sequence && ((BoundSequence)expression).SideEffects.IsDefaultOrEmpty) 51return expression.Kind == BoundKind.Call && ((BoundCall)expression).IsConstructorInitializer(); 64(receiverOpt.Kind == BoundKind.ThisReference || receiverOpt.Kind == BoundKind.BaseReference); 131throw ExceptionUtilities.UnexpectedValue(current.Left.Kind); 146throw 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)
16switch (node.Kind) 23throw ExceptionUtilities.UnexpectedValue(node.Kind); 32switch (node.Kind) 53throw ExceptionUtilities.UnexpectedValue(node.Kind);
BoundTree\BoundTreeRewriter.cs (4)
250if (child.Kind != BoundKind.BinaryOperator) 265if (child.Kind != BoundKind.BinaryOperator) 344if (child.Kind != BoundKind.BinaryPattern) 359if (child.Kind != BoundKind.BinaryPattern)
BoundTree\BoundTreeVisitors.cs (1)
31switch (node.Kind)
BoundTree\BoundTreeWalker.cs (2)
121while (current.Kind == BoundKind.BinaryOperator) 159while (current.Kind == BoundKind.BinaryPattern)
BoundTree\Constructors.cs (2)
69switch (receiver.Kind) 206Debug.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)
51switch (expression.Kind) 257fieldAccess.ReceiverOpt.Kind == BoundKind.ThisReference;
CodeGen\EmitAddress.cs (4)
26switch (expression.Kind) 87throw ExceptionUtilities.UnexpectedValue(expression.Kind); 353switch (value.Kind) 522if (receiver.Kind != BoundKind.ConditionalReceiver)
CodeGen\EmitArrayInitializer.cs (4)
347if (inits[0].Kind == BoundKind.ArrayInitialization) 369Debug.Assert(inits.All((init) => init.Kind != BoundKind.ArrayInitialization) || 370inits.All((init) => init.Kind == BoundKind.ArrayInitialization), 373return inits.Length != 0 && inits[0].Kind == BoundKind.ArrayInitialization;
CodeGen\EmitExpression.cs (30)
96switch (expression.Kind) 174throw ExceptionUtilities.UnexpectedValue(expression.Kind); 362Debug.Assert(expression.Kind != BoundKind.BadExpression); 365throw ExceptionUtilities.UnexpectedValue(expression.Kind); 444(receiver.Kind == BoundKind.Local && IsStackLocal(((BoundLocal)receiver).LocalSymbol)) || 870Debug.Assert(sequence.Value.Kind != BoundKind.TypeExpression || !used); 871if (sequence.Value.Kind != BoundKind.TypeExpression) 1013Debug.Assert(arguments[i].Kind == BoundKind.ArgListOperator); 1242else if (receiver.Kind == BoundKind.Conversion) 1253else if (receiver.Kind == BoundKind.FieldAccess) 1284if (receiver.Kind == BoundKind.Conversion && ((BoundConversion)receiver).ConversionKind == ConversionKind.Unboxing) 1295switch (receiver.Kind) 1527Debug.Assert(receiver.Kind != BoundKind.BaseReference, "base should always use call"); 1536switch (receiver.Kind) 1609switch (receiver.Kind) 1657Debug.Assert(receiver.Kind == BoundKind.ThisReference); 2155switch (current.Kind) 2238switch (receiver.Kind) 2652if (objCreation.Arguments.Length > 0 && objCreation.Arguments[0].Kind == BoundKind.ConvertedStackAllocExpression) 2686if (left.Kind == BoundKind.ArrayAccess && left.Type.TypeKind == TypeKind.TypeParameter && !left.Type.IsValueType) 2691if (left.Kind == BoundKind.FieldAccess) 2793switch (left.Kind) 2812switch (assignmentTarget.Kind) 2993throw ExceptionUtilities.UnexpectedValue(assignmentTarget.Kind); 3014throw ExceptionUtilities.UnexpectedValue(assignmentTarget.Kind); 3043Debug.Assert(lhs.Kind != BoundKind.Parameter || exprTempsAfter <= exprTempsBefore); 3045if (lhs.Kind == BoundKind.Local && ((BoundLocal)lhs).LocalSymbol.SynthesizedKind.IsLongLived()) 3101switch (expression.Kind) 3201throw ExceptionUtilities.UnexpectedValue(expression.Kind); 3954switch (expr.Kind)
CodeGen\EmitOperators.cs (3)
94if (child.Kind != BoundKind.BinaryOperator || child.ConstantValueOpt != null) 118if (child.Kind != BoundKind.BinaryOperator || child.ConstantValueOpt != null) 507if (condition.Kind == BoundKind.BinaryOperator)
CodeGen\EmitStatement.cs (10)
29switch (statement.Kind) 105throw ExceptionUtilities.UnexpectedValue(statement.Kind); 416switch (condition.Kind) 536(receiver.Kind == BoundKind.Local && IsStackLocal(((BoundLocal)receiver).LocalSymbol)) || 1135while (exceptionSource.Kind == BoundKind.Sequence) 1143switch (exceptionSource.Kind) 1182throw ExceptionUtilities.UnexpectedValue(exceptionSource.Kind); 1264if (expression.Kind == BoundKind.Sequence) 1272if (expression.Kind == BoundKind.SequencePointExpression) 1279switch (expression.Kind)
CodeGen\Optimizer.cs (19)
450Debug.Assert(expr.Kind != BoundKind.Label); 761if (value != null && value.Kind == BoundKind.Local && ((BoundLocal)value).LocalSymbol == local) 769if (lastSideeffect.Kind == BoundKind.AssignmentOperator) 773assignment.Right.Kind == BoundKind.Sequence) 949bool mayPushReceiver = (right.Kind == BoundKind.ObjectCreationExpression && 995assignmentLocal.Type.IsPointerOrFunctionPointer() && right.Kind == BoundKind.Conversion && 1006right.Kind == BoundKind.PointerIndirectionOperator) 1040(lhs.Kind is BoundKind.Local or BoundKind.Parameter or BoundKind.FieldAccess && lhs.GetRefKind() != RefKind.None), 1043switch (lhs.Kind) 1102throw ExceptionUtilities.UnexpectedValue(lhs.Kind); 1109if (lhs.Kind == BoundKind.FieldAccess) 1434if (boundExpression.Kind == BoundKind.Local) 1486if (child.Kind != BoundKind.BinaryOperator || child.ConstantValueOpt != null) 1502if (child.Kind != BoundKind.BinaryOperator || child.ConstantValueOpt != null) 1706if (exceptionSourceOpt.Kind == BoundKind.Local) 1945top.Item1.Kind == BoundKind.Local && 2080if (child.Kind != BoundKind.BinaryOperator || child.ConstantValueOpt != null) 2096if (child.Kind != BoundKind.BinaryOperator || child.ConstantValueOpt != null) 2308if (exceptionSource.Kind == BoundKind.Local)
Compilation\CSharpSemanticModel.cs (14)
1935else if (highestBoundExpr.Kind == BoundKind.TypeOrValueExpression) 1941else if (highestBoundExpr.Kind == BoundKind.UnaryOperator) 2096var highestBoundExprKind = highestBoundExpr?.Kind ?? BoundKind.NoOpStatement; 2117if (tupleLiteralConversion.Operand.Kind == BoundKind.ConvertedTupleLiteral) 2206else if (((BoundConversion)highestBoundExpr).Operand.Kind != BoundKind.Conversion) 2224else if (boundNodeForSyntacticParent?.Kind == BoundKind.DelegateCreationExpression) 2229switch (boundExpr.Kind) 2311if (boundExpr != null && boundExpr.Kind != BoundKind.TypeExpression) 3366switch (boundNode.Kind) 3411boundNodeForSyntacticParent.Kind == BoundKind.BadExpression && 3992switch (boundNodeForSyntacticParent.Kind) 4018throw ExceptionUtilities.UnexpectedValue(boundNodeForSyntacticParent.Kind); 4271switch (boundNodeForSyntacticParent.Kind) 4420switch (boundNodeForSyntacticParent.Kind)
Compilation\MemberSemanticModel.cs (5)
1202Debug.Assert(highestBoundNode.Kind != BoundKind.UnboundLambda); 1744switch (boundInnerLambdaOrQuery.Kind) 1773switch (node.Kind) 1791while (receiver?.Kind == BoundKind.MethodGroup) 1858if (expr.Kind == BoundKind.QueryClause)
Compilation\MemberSemanticModel.NodeMapBuilder.cs (7)
88if (existing[i].Kind != nodesToAdd[i].Kind) 93if (existing[i].Kind == BoundKind.TypeExpression && nodesToAdd[i].Kind == BoundKind.TypeOrValueExpression) 101else if (existing[i].Kind == BoundKind.TypeOrValueExpression && nodesToAdd[i].Kind == BoundKind.TypeExpression) 169if (node.Kind == BoundKind.UnboundLambda)
Compiler\MethodBodySynthesizer.Lowered.cs (1)
333if (body.Kind != BoundKind.Block) body = F.Block(body);
Compiler\MethodCompiler.cs (4)
623(init.Kind == BoundKind.FieldEqualsValue) && !((BoundFieldEqualsValue)init).Field.IsMetadataConstant)); 1340if (processedInitializers.LoweredInitializers.Kind == BoundKind.StatementList) 1982switch (methodBody.Kind) 2024throw ExceptionUtilities.UnexpectedValue(methodBody.Kind);
FlowAnalysis\AbstractFlowPass.cs (16)
553switch (node?.Kind) 846switch (node.Kind) 871throw ExceptionUtilities.UnexpectedValue(node.Kind); 896RoslynDebug.Assert(false, $"Should Visit{node.Kind} be overridden in {this.GetType().Name}?"); 1022throw ExceptionUtilities.UnexpectedValue(pattern.Kind); 1075throw ExceptionUtilities.UnexpectedValue(pattern.Kind); 1871if (pend.Branch.Kind != BoundKind.YieldReturnStatement) 2131if (expr.Kind != BoundKind.PropertyAccess) 2164var refKind = node.Left.Kind == BoundKind.BadExpression 2245receiverOpt.Kind != BoundKind.TypeExpression && 2426var childKind = child.Kind; 2466switch (binary.Kind) 2477throw ExceptionUtilities.UnexpectedValue(binary.Kind); 2486switch (binary.Kind) 2499throw ExceptionUtilities.UnexpectedValue(binary.Kind); 2505Debug.Assert(!isBool || binary.Kind != BoundKind.UserDefinedConditionalLogicalOperator);
FlowAnalysis\ControlFlowPass.cs (3)
213switch (pending.Branch.Kind) 241switch (statement.Kind) 303switch (branch.Branch.Kind)
FlowAnalysis\DataFlowsOutWalker.cs (2)
118switch (node.Kind) 239switch (node.Kind)
FlowAnalysis\DefiniteAssignment.cs (21)
242if (node.Kind == BoundKind.Attribute) 436BoundKind kind = pendingBranch.Kind; 786Debug.Assert(fieldOrEventAccess.Kind == BoundKind.FieldAccess || fieldOrEventAccess.Kind == BoundKind.EventAccess); 790switch (n.Kind) 922if (value is { ConstantValueOpt: not null, Kind: not BoundKind.InterpolatedString }) return false; 924switch (value.Kind) 962switch (n.Kind) 979if (n.Kind == BoundKind.Local) 1071switch (expr.Kind) 1125receiver.Kind != BoundKind.TypeExpression && 1142receiverOpt.Kind != BoundKind.TypeExpression && 1383switch (node.Kind) 1486switch (expression.Kind) 1538switch (node.Kind) 2004switch (pattern.Kind) 2131throw ExceptionUtilities.UnexpectedValue(pattern.Kind); 2206if (stmt.Kind != BoundKind.LocalFunctionStatement) 2454if (pending.Branch.Kind == BoundKind.ReturnStatement) 2528if (initializer.Kind == BoundKind.AddressOfOperator) 2599switch (expr.Kind)
FlowAnalysis\ExitPointsWalker.cs (2)
125switch (pending.Branch.Kind) 148throw ExceptionUtilities.UnexpectedValue(pending.Branch.Kind);
FlowAnalysis\LocalDataFlowPass.cs (1)
213switch (node.Kind)
FlowAnalysis\NullableWalker.cs (33)
373|| expr.Kind == BoundKind.ExpressionWithNullability 443private bool IsAnalyzingAttribute => methodMainNode.Kind == BoundKind.Attribute; 554Debug.Assert(expression != null || placeholder.Kind == BoundKind.InterpolatedStringArgumentPlaceholder); 573switch (placeholder.Kind) 589throw ExceptionUtilities.UnexpectedValue(placeholder.Kind); 2048switch (expr.Kind) 2097receiver.Kind != BoundKind.TypeExpression && 2123switch (node.Kind) 2592switch (expr.Kind) 3119if (!expr.IsSuppressed && RemoveConversion(expr, includeExplicitConversions: false).expression.Kind != BoundKind.ThrowExpression) 4181Debug.Assert(node.Kind is BoundKind.ObjectCreationExpression or BoundKind.DynamicObjectCreationExpression or BoundKind.NewT or BoundKind.NoPiaObjectCreationExpression); 4272switch (initializer.Kind) 4287switch (initializer.Kind) 4300ExceptionUtilities.UnexpectedValue(node.Kind); 4317switch (left.Kind) 4991if (child.Kind == BoundKind.ArrayInitialization) 5612switch (operand.Kind) 5808while (possiblyConversion.Kind == BoundKind.Conversion) 7747return (argument.Kind == BoundKind.Lambda); 8357switch (expr.Kind) 8409if (argument.Kind == BoundKind.Lambda) 8418if (argument.Kind == BoundKind.CollectionExpression) 8543if (expr.Kind != BoundKind.Conversion) 8626switch (value.Kind) 9467if (operandType.Type?.IsTupleType == true || conversionOperand.Kind == BoundKind.TupleLiteral) 10478if (left.Kind == BoundKind.EventAccess && ((BoundEventAccess)left).EventSymbol.IsWindowsRuntimeEvent) 10896switch (expr.Kind) 10914switch (expr.Kind) 11261if (initializer.Kind == BoundKind.AddressOfOperator) 11267if (node.Expression.Kind == BoundKind.AddressOfOperator) 11545if (node.Expression.Kind != BoundKind.Conversion) 12106throw ExceptionUtilities.UnexpectedValue(binary.Kind); 12121throw ExceptionUtilities.UnexpectedValue(binary.Kind);
FlowAnalysis\NullableWalker.DebugVerifier.cs (2)
73else if (overrideSkippedExpression || !s_skippedExpressions.Contains(expression.Kind)) 162if (!s_skippedExpressions.Contains(child.Kind))
FlowAnalysis\NullableWalker.SnapshotManager.cs (1)
106if (node.Kind == BoundKind.TypeExpression || node.WasCompilerGenerated)
FlowAnalysis\NullableWalker_Patterns.cs (4)
585throw ExceptionUtilities.UnexpectedValue(p.Evaluation.Kind); 662throw ExceptionUtilities.UnexpectedValue(test.Kind); 721throw ExceptionUtilities.UnexpectedValue(dagNode.Kind); 860_ => throw ExceptionUtilities.UnexpectedValue(e.Kind)
FlowAnalysis\ReadWriteWalker.cs (4)
147if (!IsInside && node.Span.Contains(RegionSpan) && (expr.Kind == BoundKind.FieldAccess)) 188switch (receiver.Kind) 238switch (node.Kind) 304switch (underlying.Kind)
FlowAnalysis\RegionAnalysisContext.cs (1)
49switch (firstInRegion.Kind)
Generated\BoundNodes.xml.Generated.cs (1)
8866switch (node.Kind)
Lowering\AsyncRewriter\AsyncMethodToStateMachineRewriter.cs (3)
315if (node.Expression.Kind == BoundKind.AwaitExpression) 319else if (node.Expression.Kind == BoundKind.AssignmentOperator) 322if (expression.Right.Kind == BoundKind.AwaitExpression)
Lowering\BoundTreeToDifferentEnclosingContextRewriter.cs (1)
40Debug.Fail($"Override the visitor for {node.Kind}");
Lowering\ClosureConversion\ClosureConversion.Analysis.cs (2)
109switch (node.Kind) 129throw ExceptionUtilities.UnexpectedValue(node.Kind);
Lowering\ClosureConversion\ClosureConversion.cs (3)
1109if (visited.Kind != BoundKind.Call) 1336if (node.Argument.Kind == BoundKind.Lambda) 1383receiver.Kind == BoundKind.TypeExpression &&
Lowering\ClosureConversion\ExpressionLambdaRewriter.cs (7)
138switch (stmt.Kind) 157throw ExceptionUtilities.UnexpectedValue(stmt.Kind); 181switch (node.Kind) 249throw ExceptionUtilities.UnexpectedValue(node.Kind); 533if (operand.Kind == BoundKind.Conversion) 787if (node.Argument.Kind == BoundKind.MethodGroup) 943switch (node.Kind)
Lowering\DiagnosticsPass_ExpressionTrees.cs (8)
253if (_inExpressionLambda && node.Left.Kind != BoundKind.ObjectInitializerMember && node.Left.Kind != BoundKind.DynamicObjectInitializerMember) 277bool hasBaseReceiver = node.ReceiverOpt != null && node.ReceiverOpt.Kind == BoundKind.BaseReference; 291bool hasBaseReceiver = node.ReceiverOpt != null && node.ReceiverOpt.Kind == BoundKind.BaseReference; 709if (current.Left.Kind == BoundKind.BinaryOperator) 813if (operand.Kind == BoundKind.FieldAccess) 913if (node.Argument.Kind != BoundKind.MethodGroup) 997if (node.Expression.Kind == BoundKind.MethodGroup)
Lowering\DiagnosticsPass_Warnings.cs (18)
31switch (argument.Kind) 97if (receiverOpt != null && receiverOpt.Kind == BoundKind.FieldAccess) 141while (receiver.Kind == BoundKind.Conversion) 148return receiver.Kind != BoundKind.ThisReference && receiver.Kind != BoundKind.BaseReference; 196if (expr1.Kind != expr2.Kind) 201switch (expr1.Kind) 317if (node.Left.ConstantValueOpt != null && node.Right.ConstantValueOpt == null && node.Right.Kind == BoundKind.Conversion) 322if (node.Right.ConstantValueOpt != null && node.Left.ConstantValueOpt == null && node.Left.Kind == BoundKind.Conversion) 347return node.Kind == BoundKind.Conversion && ((BoundConversion)node).ExplicitCastInCode; 353if (node.Kind != BoundKind.Conversion) return false; 577if (operand.Kind == BoundKind.Conversion) 606if (expr.Kind != BoundKind.Conversion) 865if (node.Kind == BoundKind.Conversion) 889while (right.Kind == BoundKind.Conversion) 904if (right.Kind != BoundKind.ConvertedTupleLiteral && right.Kind != BoundKind.TupleLiteral)
Lowering\Extensions.cs (4)
51if (expr.Kind == BoundKind.ObjectCreationExpression) 56else if (expr.Kind == BoundKind.Conversion) 97if (expr.Kind == BoundKind.ObjectCreationExpression) 103if (expr.Kind == BoundKind.Conversion)
Lowering\InitializerRewriter.cs (4)
46(initializer.Kind == BoundKind.GlobalStatementInitializer) && 84return (statement.Kind == BoundKind.ExpressionStatement) && ((ExpressionStatementSyntax)statement.Syntax).SemicolonToken.IsMissing ? 121switch (initializer.Kind) 128throw ExceptionUtilities.UnexpectedValue(initializer.Kind);
Lowering\Instrumentation\CodeCoverageInstrumenter.cs (1)
527switch (statement.Kind)
Lowering\Instrumentation\DebugInfoInjector.cs (1)
123if (rewritten.Kind == BoundKind.Block)
Lowering\Instrumentation\Instrumenter.cs (1)
307Debug.Assert(original.Kind == BoundKind.SwitchStatement);
Lowering\LocalRewriter\LocalRewriter.cs (12)
286node.Kind is not (BoundKind.ImplicitReceiver or BoundKind.ObjectOrCollectionValuePlaceholder or BoundKind.ValuePlaceholder)) 309return node.Kind == BoundKind.DeconstructionAssignmentOperator && !((BoundDeconstructionAssignmentOperator)node).IsUsed; 709if (initializer.Kind == BoundKind.Block) 879switch (initializer.Kind) 886if (initializer.Kind == BoundKind.ExpressionStatement) 894return ((BoundExpressionStatement)initializer).Expression.Kind == BoundKind.AssignmentOperator; 911if (statement.Kind != BoundKind.ExpressionStatement) 922Debug.Assert(assignment.Left.Kind == BoundKind.FieldAccess); 1018switch (expr.Kind) 1119throw ExceptionUtilities.UnexpectedValue(expr.Kind); 1125RoslynDebug.Assert(expr is not BoundValuePlaceholderBase, $"Placeholder kind {expr.Kind} must be handled explicitly"); 1282RoslynDebug.Assert(false, $"Bound nodes of kind {node.Kind} should not survive past local rewriting");
Lowering\LocalRewriter\LocalRewriter.DecisionDagRewriter.cs (6)
89throw ExceptionUtilities.UnexpectedValue(node.Kind); 388ImmutableArray<BoundDecisionDagNode> nodesToLower = sortedNodes.WhereAsArray(n => n.Kind != BoundKind.WhenDecisionDagNode && n.Kind != BoundKind.LeafDecisionDagNode); 972if (!sortedNodes.Any(static n => n.Kind == BoundKind.WhenDecisionDagNode)) return; 1184Debug.Assert(left.Kind == BoundKind.Local && left == binding.VariableAccess); 1233throw ExceptionUtilities.UnexpectedValue(node.Kind);
Lowering\LocalRewriter\LocalRewriter.PatternLocalRewriter.cs (4)
523if ((loweredInput.Kind == BoundKind.Local || loweredInput.Kind == BoundKind.Parameter) 648if (canShareInputs && (expr.Kind == BoundKind.Parameter || expr.Kind == BoundKind.Local) && _tempAllocator.TrySetTemp(temp, expr))
Lowering\LocalRewriter\LocalRewriter_AssignmentOperator.cs (5)
27switch (left.Kind) 103switch (rewrittenLeft.Kind) 183switch (rewrittenLeft.Kind) 187throw ExceptionUtilities.UnexpectedValue(rewrittenLeft.Kind); 253if (sequence.Value.Kind == BoundKind.IndexerAccess)
Lowering\LocalRewriter\LocalRewriter_BinaryOperator.cs (13)
291if (loweredRight.Kind == BoundKind.Local || loweredRight.Kind == BoundKind.Parameter) 303if (loweredRight.Kind == BoundKind.Local || loweredRight.Kind == BoundKind.Parameter) 490if (loweredLeft.Kind == BoundKind.ArrayLength && loweredRight.IsDefaultValue()) 505if (loweredRight.Kind == BoundKind.ArrayLength && loweredLeft.IsDefaultValue()) 520if (loweredLeft.Kind == BoundKind.ArrayLength && loweredRight.IsDefaultValue()) 524else if (loweredRight.Kind == BoundKind.ArrayLength && loweredLeft.IsDefaultValue()) 659if (constantLeft == null && loweredLeft.Kind != BoundKind.Local && loweredLeft.Kind != BoundKind.Parameter) 720if (expression.Kind == BoundKind.Conversion) 1626if (nonNullRight != null && nonNullRight.ConstantValueOpt != null && left.Kind == BoundKind.Sequence) 1629if (seq.Value.Kind == BoundKind.ConditionalOperator)
Lowering\LocalRewriter\LocalRewriter_Block.cs (1)
109switch (node.Kind)
Lowering\LocalRewriter\LocalRewriter_Call.cs (6)
33switch (node.Expression.Kind) 43Debug.Assert(methodGroup.ReceiverOpt == null || methodGroup.ReceiverOpt.Kind != BoundKind.TypeOrValueExpression); 568switch (current.Kind) 891var u => throw ExceptionUtilities.UnexpectedValue(u.Kind) 1612if (argument.Kind == BoundKind.Local) 1701if (argument.Kind == BoundKind.Local)
Lowering\LocalRewriter\LocalRewriter_CompoundAssignmentOperator.cs (7)
99if (node.Left.Kind == BoundKind.DynamicMemberAccess && 289Debug.Assert(receiverOpt.Kind != BoundKind.TypeExpression); 611Debug.Assert(receiver.Kind != BoundKind.TypeExpression); 721switch (originalLHS.Kind) 872throw ExceptionUtilities.UnexpectedValue(originalLHS.Kind); 971switch (expression.Kind) 1013switch (expression.Kind)
Lowering\LocalRewriter\LocalRewriter_Conversion.cs (4)
31_ => throw ExceptionUtilities.UnexpectedValue(node.Operand.Kind) 231switch (rewrittenNode.Kind) 1307if (operand.Kind == BoundKind.Sequence) 1310if (seq.Value.Kind == BoundKind.ConditionalOperator)
Lowering\LocalRewriter\LocalRewriter_DeconstructionAssignmentOperator.cs (11)
62if (right.Kind == BoundKind.ConditionalOperator) 114Debug.Assert(right is not ({ Kind: BoundKind.TupleLiteral } or BoundConversion { Operand.Kind: BoundKind.TupleLiteral })); 117right is { Kind: BoundKind.ConvertedTupleLiteral } or BoundConversion { Operand.Kind: BoundKind.ConvertedTupleLiteral } 252if (leftTarget.Kind != BoundKind.DiscardExpression) 285Debug.Assert(!IsTupleExpression(right.Kind)); 296if (IsTupleExpression(right.Kind)) 304if (right.Kind == BoundKind.Conversion) 308&& IsTupleExpression(tupleConversion.Operand.Kind)) 449switch (variable.Kind)
Lowering\LocalRewriter\LocalRewriter_DelegateCreationExpression.cs (1)
28if (node.Argument.Kind == BoundKind.MethodGroup)
Lowering\LocalRewriter\LocalRewriter_ExpressionStatement.cs (1)
48switch (expression.Kind)
Lowering\LocalRewriter\LocalRewriter_Field.cs (1)
66if (rewrittenReceiver?.Kind == BoundKind.DefaultExpression)
Lowering\LocalRewriter\LocalRewriter_FixedStatement.cs (1)
245Debug.Assert(initializerExpr.Kind == BoundKind.AddressOfOperator);
Lowering\LocalRewriter\LocalRewriter_ForStatement.cs (3)
51Debug.Assert(original.Kind is BoundKind.ForStatement or BoundKind.ForEachStatement or BoundKind.CollectionExpressionSpreadElement); 146switch (original.Kind) 159throw ExceptionUtilities.UnexpectedValue(original.Kind);
Lowering\LocalRewriter\LocalRewriter_IndexerAccess.cs (6)
536if (node.LengthOrCountAccess.Kind is not BoundKind.Local || receiver.Kind is not (BoundKind.Local or BoundKind.Parameter)) 578if (makeOffsetInput.ConstantValueOpt is null && lengthAccess.Kind is not BoundKind.ArrayLength) 839if (node.LengthOrCountAccess.Kind is not BoundKind.Local || receiver.Kind is not (BoundKind.Local or BoundKind.Parameter)) 990if ((rewriteFlags & captureLength) != 0 && lengthAccess.Kind is not BoundKind.Local)
Lowering\LocalRewriter\LocalRewriter_IsOperator.cs (2)
33if (rewrittenOperand.Kind == BoundKind.MethodGroup) 37if (receiver != null && receiver.Kind != BoundKind.ThisReference)
Lowering\LocalRewriter\LocalRewriter_IsPatternOperator.cs (3)
244while (node.Kind != BoundKind.LeafDecisionDagNode && node.Kind != BoundKind.WhenDecisionDagNode) 299throw ExceptionUtilities.UnexpectedValue(node.Kind);
Lowering\LocalRewriter\LocalRewriter_NullCoalescingAssignmentOperator.cs (2)
103Debug.Assert(!_inExpressionLambda && lhsRead.Kind != BoundKind.PropertyAccess); 107if (lhsRead.Kind == BoundKind.Call)
Lowering\LocalRewriter\LocalRewriter_NullCoalescingOperator.cs (2)
192if (expression.Kind != BoundKind.Call) 221while (expression.Kind == BoundKind.Conversion)
Lowering\LocalRewriter\LocalRewriter_ObjectOrCollectionInitializerExpression.cs (13)
27throw ExceptionUtilities.UnexpectedValue(initializerExpression.Kind); 62throw ExceptionUtilities.UnexpectedValue(initializerExpression.Kind); 70switch (initializerExpression.Kind) 81throw ExceptionUtilities.UnexpectedValue(initializerExpression.Kind); 91if (initializer.Kind != BoundKind.CollectionElementInitializer) 93throw ExceptionUtilities.UnexpectedValue(initializer.Kind); 137if (initializer.Kind == BoundKind.CollectionElementInitializer) 144Debug.Assert(initializer.Kind == BoundKind.DynamicCollectionElementInitializer); 314bool isRhsNestedInitializer = right.Kind is BoundKind.ObjectInitializerExpression or BoundKind.CollectionInitializerExpression; 325switch (left.Kind) 465throw ExceptionUtilities.UnexpectedValue(rewrittenArrayAccess.Kind); 547throw ExceptionUtilities.UnexpectedValue(left.Kind); 609throw ExceptionUtilities.UnexpectedValue(lhs.Kind);
Lowering\LocalRewriter\LocalRewriter_StringConcat.cs (1)
580if (expr.Kind == BoundKind.Conversion)
Lowering\LocalRewriter\LocalRewriter_StringInterpolation.cs (2)
84throw ExceptionUtilities.UnexpectedValue(part.Kind); 191if (length == 1 && result is not ({ Kind: BoundKind.InterpolatedString } or { ConstantValueOpt.IsString: true }))
Lowering\LocalRewriter\LocalRewriter_TryStatement.cs (1)
50switch (statement.Kind)
Lowering\LocalRewriter\LocalRewriter_UnaryOperator.cs (5)
46if (node.Operand.Kind == BoundKind.BinaryOperator) 322if (loweredOperand.Kind == BoundKind.Sequence) 325if (seq.Value.Kind == BoundKind.ConditionalOperator) 634switch (expression.Kind) 1021switch (transformedExpression.Kind)
Lowering\LocalRewriter\LocalRewriter_UsingStatement.cs (1)
40BoundBlock tryBlock = rewrittenBody.Kind == BoundKind.Block
Lowering\LocalRewriter\LocalRewriter_WhileStatement.cs (3)
49Debug.Assert(loop.Kind is BoundKind.WhileStatement or BoundKind.ForEachStatement or BoundKind.CollectionExpressionSpreadElement); 72switch (loop.Kind) 88throw ExceptionUtilities.UnexpectedValue(loop.Kind);
Lowering\LocalRewriter\LoweredDynamicOperationFactory.cs (2)
226if (loweredReceiver.Kind == BoundKind.TypeExpression) 673int discardCount = loweredArguments.Count(a => a.Kind == BoundKind.DiscardExpression);
Lowering\MethodToClassRewriter.cs (6)
258if (originalLeft.Kind != BoundKind.Local) 272Debug.Assert(originalRight.Kind != BoundKind.ConvertedStackAllocExpression); 294if (rewrittenLeft.Kind != BoundKind.Local && originalRight.Kind == BoundKind.ConvertedStackAllocExpression) 418return originalReceiver is { Kind: BoundKind.BaseReference } && 419rewrittenReceiver is { Kind: not BoundKind.BaseReference };
Lowering\SpillSequenceSpiller.cs (7)
47Debug.Assert(value?.Kind != SpillSequenceBuilderKind); 247if (e == null || e.Kind != SpillSequenceBuilderKind) 314switch (expression.Kind) 352assignment is not { Left.Kind: BoundKind.Local, Right.Kind: BoundKind.ArrayAccess }) // Optimize for some known to be safe scenarios. 612if (newList[i].Kind == SpillSequenceBuilderKind) 883switch (left.Kind)
Lowering\StateMachineRewriter\IteratorAndAsyncCaptureWalker.cs (1)
316if (node.ReceiverOpt != null && node.ReceiverOpt.Kind == BoundKind.ThisReference)
Lowering\StateMachineRewriter\MethodToStateMachineRewriter.cs (6)
413if (statement.Kind == BoundKind.Block) 417if (rewrittenStatements.Length == 1 && rewrittenStatements[0].Kind == BoundKind.StateMachineScope) 590switch (expr.Kind) 625if (receiver.Kind != BoundKind.ThisReference && !isFieldOfStruct) 682throw ExceptionUtilities.UnexpectedValue(expr.Kind); 836if (node.Left.Kind != BoundKind.Local)
Lowering\SyntheticBoundNodeFactory.cs (3)
585if (body.Kind != BoundKind.Block) 1746var discardsPresent = arguments.Any(static a => a.Kind == BoundKind.DiscardExpression); 1751(arg, t) => arg.Kind == BoundKind.DiscardExpression ? t.factory.MakeTempForDiscard((BoundDiscardExpression)arg, t.builder) : arg,
Operations\CSharpOperationFactory.cs (32)
35switch (boundNode.Kind) 312switch (boundNode.Kind) 333throw ExceptionUtilities.UnexpectedValue(boundNode.Kind); 398switch (declaration.Kind) 416throw ExceptionUtilities.UnexpectedValue(declaration.Kind); 522switch (declaration.Kind) 548throw ExceptionUtilities.UnexpectedValue(declaration.Kind); 608throw ExceptionUtilities.UnexpectedValue(boundNode.Kind); 799throw ExceptionUtilities.UnexpectedValue(indexer.Kind); 815throw ExceptionUtilities.UnexpectedValue(indexer.Kind); 958if (receiver?.Kind == BoundKind.TypeExpression) 1070Debug.Assert(boundOperand.Kind == BoundKind.BadExpression || 1072ExpressionOpt?.Kind == BoundKind.BadExpression); 1082if (boundOperand.Kind == BoundKind.ConvertedTupleLiteral && TypeSymbol.Equals(boundOperand.Type, boundConversion.Type, TypeCompareKind.ConsiderEverything2)) 1096if (boundConversion.ExplicitCastInCode && conversion.IsIdentity && boundOperand.Kind == BoundKind.Conversion) 1102nestedOperand.Kind == BoundKind.ConvertedTupleLiteral && 1118if ((boundOperand.Kind == BoundKind.Lambda || 1119boundOperand.Kind == BoundKind.UnboundLambda || 1120boundOperand.Kind == BoundKind.MethodGroup) && 1327boundAssignmentOperator.Right?.Kind == BoundKind.ObjectInitializerExpression || 1328boundAssignmentOperator.Right?.Kind == BoundKind.CollectionInitializerExpression; 1475{ Kind: var kind } => throw ExceptionUtilities.UnexpectedValue(kind) 1643if (boundIndexerAccess.LengthOrCountAccess.Kind == BoundKind.ArrayLength) 2247{ Kind: var kind } => throw ExceptionUtilities.UnexpectedValue(kind) 2280if (part.Kind == BoundKind.StringInsert) 2340throw ExceptionUtilities.UnexpectedValue(part.Kind); 2356_ => throw ExceptionUtilities.UnexpectedValue(value.Kind), 2453_ => throw ExceptionUtilities.UnexpectedValue(part.Kind) 2476throw ExceptionUtilities.UnexpectedValue(current.Kind); 2539if (variable == null && boundDeclarationPattern.VariableAccess?.Kind == BoundKind.DiscardExpression) 2753Debug.Assert(boundSwitchLabel.Pattern.Kind == BoundKind.DiscardPattern); 2757boundSwitchLabel.Pattern.Kind == BoundKind.ConstantPattern &&
Operations\CSharpOperationFactory_Methods.cs (9)
25if (statement.Kind == BoundKind.StatementList) 100if (instance == null || instance.Kind == BoundKind.TypeExpression) 106if (symbol != null && symbol.IsStatic && instance.WasCompilerGenerated && instance.Kind == BoundKind.ThisReference) 163if (boundDelegateCreationExpression.Argument.Kind == BoundKind.MethodGroup && 196switch (containingExpression.Kind) 260throw ExceptionUtilities.UnexpectedValue(containingExpression.Kind); 393|| (receiverOpt.Kind != BoundKind.ThisReference 394&& receiverOpt.Kind != BoundKind.BaseReference 395&& receiverOpt.Kind != BoundKind.ObjectOrCollectionValuePlaceholder)))
Symbols\ConstantValueUtils.cs (1)
97while (unconvertedBoundValue.Kind == BoundKind.Conversion)
Symbols\FunctionTypeSymbol.cs (1)
68Debug.Assert(expression.Kind is BoundKind.MethodGroup or BoundKind.UnboundLambda);
Symbols\Source\ParameterHelpers.cs (1)
1079switch (expression.Kind)
Symbols\Source\SourceComplexParameterSymbol.cs (1)
407if (convertedExpression.ConstantValueOpt == null && convertedExpression.Kind == BoundKind.Conversion &&
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (21)
Semantics\ConstantTests.cs (4)
592var actual = ParseAndGetConstantFoldingSteps(source, node => node.Kind == BoundKind.BinaryOperator); 641var actual = ParseAndGetConstantFoldingSteps(source, node => node.Kind == BoundKind.UnaryOperator); 1448return ParseAndGetConstantFoldingSteps(source, node => node.Kind != BoundKind.Literal && node.Kind != BoundKind.Local);
Semantics\FieldInitializerBindingTests.cs (1)
274Assert.Equal(BoundKind.FieldEqualsValue, boundInit.Kind);
Semantics\SemanticAnalyzerTests.cs (14)
1332Assert.Equal(BoundKind.LocalDeclaration, block.Statements[0].Kind); 1335Assert.Equal(BoundKind.ObjectCreationExpression, decl.InitializerOpt.Kind); 1360Assert.Equal(BoundKind.LocalDeclaration, block.Statements[0].Kind); 1363Assert.Equal(BoundKind.ObjectCreationExpression, decl.InitializerOpt.Kind); 1388Assert.Equal(BoundKind.LocalDeclaration, block.Statements[0].Kind); 1391Assert.Equal(BoundKind.ObjectCreationExpression, decl.InitializerOpt.Kind); 1425Assert.Equal(BoundKind.LocalDeclaration, block.Statements[0].Kind); 1428Assert.Equal(BoundKind.ObjectCreationExpression, decl.InitializerOpt.Kind); 1459Assert.Equal(BoundKind.LocalDeclaration, block.Statements[0].Kind); 1462Assert.Equal(BoundKind.ObjectCreationExpression, decl.InitializerOpt.Kind); 1494Assert.Equal(BoundKind.LocalDeclaration, block.Statements[0].Kind); 1497Assert.Equal(BoundKind.ObjectCreationExpression, decl.InitializerOpt.Kind); 1529Assert.Equal(BoundKind.LocalDeclaration, block.Statements[0].Kind); 1532Assert.Equal(BoundKind.ObjectCreationExpression, decl.InitializerOpt.Kind);
Semantics\UnsafeTests.cs (2)
5249_builder.Add($"Yes, {expr.Kind} '{text}' requires fixing."); 5253_builder.Add(string.Concat($"No, {expr.Kind} '{text}' does not require fixing.", accessedLocalOrParameterOpt is null