747 references to Kind
Microsoft.CodeAnalysis.CSharp (747)
Binder\Binder.cs (1)
919RoslynDebug.Assert(statement.Kind != BoundKind.StatementList);
Binder\Binder.ValueChecks.cs (29)
737switch (expr.Kind) 856if (expr.Kind == BoundKind.MethodGroup && valueKind != BindValueKind.RValueOrMethodGroup) 882if ((object)otherSymbol != null && receiver?.Kind == BoundKind.TypeOrValueExpression) 920switch (expression?.Kind) 923case BoundKind.QueryClause when ((BoundQueryClause)expression).Value.Kind == BoundKind.TypeOrValueExpression: 952switch (expr.Kind) 957case BoundKind.ImplicitIndexerAccess when ((BoundImplicitIndexerAccess)expr).IndexerOrSliceAccess.Kind == BoundKind.IndexerAccess: 978switch (expr.Kind) 1142throw ExceptionUtilities.UnexpectedValue(implicitIndexer.IndexerOrSliceAccess.Kind); 1216RoslynDebug.Assert(expr is not BoundValuePlaceholderBase, $"Placeholder kind {expr.Kind} should be explicitly handled"); 1261switch (expr.Kind) 1921return (receiver.Kind == BoundKind.ObjectOrCollectionValuePlaceholder && IsObjectInitializerMemberTarget(node)) || 2085ReportDiagnosticsIfObsolete(diagnostics, setMethod, node, receiver?.Kind == BoundKind.BaseReference); 2136ReportDiagnosticsIfObsolete(diagnostics, getMethod, node, receiver?.Kind == BoundKind.BaseReference); 2220if (receiverOpt?.Kind == BoundKind.BaseReference && member.IsAbstract) 2702if (argument.Kind == BoundKind.ArgListOperator) 3741switch (expr.Kind) 3896throw ExceptionUtilities.UnexpectedValue(implicitIndexerAccess.IndexerOrSliceAccess.Kind); 4025switch (expr.Kind) 4193throw ExceptionUtilities.UnexpectedValue(implicitIndexerAccess.IndexerOrSliceAccess.Kind); 4381switch (expr.Kind) 4531throw ExceptionUtilities.UnexpectedValue(implicitIndexerAccess.IndexerOrSliceAccess.Kind); 4779RoslynDebug.Assert(false, $"{expr.Kind} expression of {expr.Type} type"); 4926if (expr.Kind == BoundKind.AssignmentOperator) 5078switch (expr.Kind) 5270throw ExceptionUtilities.UnexpectedValue(implicitIndexerAccess.IndexerOrSliceAccess.Kind); 5580RoslynDebug.Assert(false, $"{expr.Kind} expression of {expr.Type} type"); 5912throw ExceptionUtilities.UnexpectedValue(expression.Kind); 5955throw ExceptionUtilities.UnexpectedValue(expression.Kind);
Binder\Binder_Attributes.cs (2)
820switch (assignment.Left.Kind) 870switch (node.Kind)
Binder\Binder_Await.cs (3)
81if (expression.Kind != BoundKind.Call || 600if (getAwaiterCall.Kind != BoundKind.Call) 716if (getAwaiterGetResultCall.Kind != BoundKind.Call)
Binder\Binder_Conversions.cs (15)
179if (conversion.IsAnonymousFunction && source.Kind == BoundKind.UnboundLambda) 253if (source.Kind == BoundKind.UnconvertedSwitchExpression) 275if (source.Kind == BoundKind.UnconvertedCollectionExpression) 298if (source.Kind == BoundKind.UnconvertedConditionalOperator) 1905if (boundExpression.Kind == BoundKind.FieldAccess || boundExpression.Kind == BoundKind.PropertyAccess) 1912if (boundExpression.Kind != BoundKind.MethodGroup) 2842Debug.Assert(source.Kind is BoundKind.MethodGroup or BoundKind.UnboundLambda); 2849if (source.Kind == BoundKind.UnboundLambda && 2858source.Kind == BoundKind.MethodGroup && 3250if (node.Kind != BoundKind.MethodGroup) 3393if (receiverOpt.Kind == BoundKind.QueryClause) 3495while (receiverOpt.Kind == BoundKind.QueryClause) 3500return receiverOpt.Kind == BoundKind.TypeExpression; 3510switch (receiverOpt.Kind)
Binder\Binder_Deconstruct.cs (8)
213if (boundRHS.Kind == BoundKind.TupleLiteral) 371switch (expression.Kind) 385throw ExceptionUtilities.UnexpectedValue(expression.Kind); 406switch (variable.Single.Kind) 490if (element.Kind == BoundKind.TupleLiteral) 599if (expression.Kind == BoundKind.DiscardExpression) 663if (memberAccess.Kind != BoundKind.MethodGroup) 795if (expression == null && checkedVariable.Kind != BoundKind.DiscardExpression)
Binder\Binder_Expressions.cs (41)
224BoundKind exprKind = expr.Kind; 278if (valueOrType.Kind == BoundKind.TypeExpression) 448Debug.Assert(expr.Kind is BoundKind.UnboundLambda or BoundKind.MethodGroup); 578if (expr.Kind == BoundKind.ArgListOperator) 620if (IsEarlyAttributeBinder && result.Kind == BoundKind.MethodGroup && (!IsInsideNameof || EnclosingNameofArgument != node)) 2848if (operand.Kind == BoundKind.UnboundLambda) 2895switch (operand.Kind) 3192switch (arg.Kind) 3585else if (argument.Kind == BoundKind.OutVariablePendingInference) 3589else if (argument.Kind == BoundKind.OutDeconstructVarPendingInference) 3593else if (argument.Kind == BoundKind.DiscardExpression && !argument.HasExpressionType()) 3628Debug.Assert(arguments[arg].Kind is not 5602else if (argument.Kind == BoundKind.MethodGroup) 6017if (boundMember.Kind == BoundKind.PropertyGroup) 6059BoundKind boundMemberKind = boundMember.Kind; 6646if (addMethodInvocation.Kind == BoundKind.DynamicInvocation) 6657else if (addMethodInvocation.Kind == BoundKind.Call) 6686Debug.Assert(addMethodInvocation.Kind == BoundKind.BadExpression); 7171switch (classCreation.Kind) 7184throw ExceptionUtilities.UnexpectedValue(classCreation.Kind); 7916if (boundLeft.Kind == BoundKind.UnboundLambda) 7961switch (boundLeft.Kind) 7993if (boundLeft.Kind == BoundKind.Literal && ((BoundLiteral)boundLeft).ConstantValueOpt == ConstantValue.Null) 8181switch (expr.Kind) 8308bool leftIsBaseReference = boundLeft.Kind == BoundKind.BaseReference; 8415if (boundLeft.HasAnyErrors && boundLeft.Kind != BoundKind.TypeOrValueExpression) 8436else if (boundLeft.Kind == BoundKind.TypeExpression || 8437boundLeft.Kind == BoundKind.BaseReference || 8447else if (boundLeft.Kind == BoundKind.AwaitableValuePlaceholder && boundLeft.Type.IsIAsyncEnumerableType(Compilation)) 8678ReportDiagnosticsIfObsolete(diagnostics, symbol, node, hasBaseReceiver: left.Kind == BoundKind.BaseReference); 9305ReportDiagnosticsIfObsolete(diagnostics, propertySymbol, node, hasBaseReceiver: receiver?.Kind == BoundKind.BaseReference); 9419switch (receiver.Kind) 9630if (receiver.Kind == BoundKind.PropertyGroup) 10045if (index.Kind == BoundKind.OutVariablePendingInference) 10049else if (index.Kind == BoundKind.DiscardExpression && !index.HasExpressionType()) 10237LookupOptions lookupOptions = expr.Kind == BoundKind.BaseReference ? LookupOptions.UseBaseReferenceAccessibility : LookupOptions.Default; 10351BoundKind receiverKind = receiver.Kind; 10494ReportDiagnosticsIfObsolete(diagnostics, property, syntax, hasBaseReceiver: receiver != null && receiver.Kind == BoundKind.BaseReference); 10505if (!gotError && receiver != null && receiver.Kind == BoundKind.ThisReference && receiver.WasCompilerGenerated) 11657if (access.Kind == BoundKind.MethodGroup) 11824if (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)
108if (!allowFieldsAndProperties && (boundExpression.Kind == BoundKind.FieldAccess || boundExpression.Kind == BoundKind.PropertyAccess)) 113if (boundExpression.Kind == BoundKind.FieldAccess) 125Debug.Assert(allowFieldsAndProperties || boundExpression.Kind is (BoundKind.MethodGroup or BoundKind.BadExpression)); 130Debug.Assert(!args.Any(static e => e.Kind == BoundKind.OutVariablePendingInference || 131e.Kind == BoundKind.OutDeconstructVarPendingInference || 132e.Kind == BoundKind.DiscardExpression && !e.HasExpressionType())); 146if (queryClause != null && result.Kind == BoundKind.DynamicInvocation) 162if (boundExpression.Kind == BoundKind.FieldAccess) 247string name = boundExpression.Kind == BoundKind.MethodGroup ? GetName(node.Expression) : null; 281if (argument.Kind == BoundKind.OutVariablePendingInference) 358else if (boundExpression.Kind == BoundKind.MethodGroup) 411if (expression.Kind == BoundKind.MethodGroup) 419switch (receiver.Kind) 594if (arg.Kind == BoundKind.Lambda || arg.Kind == BoundKind.UnboundLambda) 600else if (arg.Kind == BoundKind.MethodGroup) 606else if (arg.Kind == BoundKind.ArgListOperator) 735Debug.Assert(extensionMemberAccess.Kind != BoundKind.MethodGroup); 1080switch (expression.Kind) 1096else if (call.ReceiverOpt.Kind == BoundKind.BaseReference && this.ContainingType.IsRestrictedType()) 1120throw ExceptionUtilities.UnexpectedValue(expression.Kind); 1314if (!gotError && method.RequiresInstanceReceiver && receiver != null && receiver.Kind == BoundKind.ThisReference && receiver.WasCompilerGenerated) 1330bool hasBaseReceiver = receiver != null && receiver.Kind == BoundKind.BaseReference; 1962switch (receiver.Kind) 2028if ((object)expr != null && expr.Kind != BoundKind.TypeExpression) 2167switch (argument.Kind) 2215if (argument.Kind == BoundKind.OutVariablePendingInference) 2226else if (argument.Kind == BoundKind.DiscardExpression) 2334var originalMethods = (expr.Kind == BoundKind.MethodGroup) ? ((BoundMethodGroup)expr).Methods : ImmutableArray<MethodSymbol>.Empty;
Binder\Binder_Operators.cs (17)
43if (left.Kind == BoundKind.EventAccess) 111if (left.Kind == BoundKind.EventAccess && !CheckEventValueKind((BoundEventAccess)left, BindValueKind.Assignable, diagnostics)) 312Debug.Assert(left.Kind != BoundKind.EventAccess || hasError); 907if (result.Kind == BoundKind.TypeExpression 912else if (result.Kind == BoundKind.BadExpression) 1269_ => throw ExceptionUtilities.UnexpectedValue(current.Right.Kind) 1333switch (left.Kind, right.Kind) 2917if (left.Kind == BoundKind.Conversion && right.Kind == BoundKind.Conversion) 4060switch (expr.Kind) 4191BoundKind exprKind = expr.Kind; 4785switch (operand.Kind) 4969operand.Kind == BoundKind.MethodGroup || 5385switch (operand.Kind) 5698if (leftOperand.Kind == BoundKind.UnboundLambda || leftOperand.Kind == BoundKind.MethodGroup)
Binder\Binder_Patterns.cs (6)
1003wasExpression = originalExpression.Kind != BoundKind.TypeExpression; 1010Debug.Assert(originalExpression is { Kind: BoundKind.TypeExpression, Type: { } }); 1034wasExpression = originalExpression.Kind switch { BoundKind.BadExpression => false, BoundKind.TypeExpression => false, _ => true }; 1185if (convertedExpression.Kind == BoundKind.Conversion) 2253if (boundMember.Kind == BoundKind.PropertyGroup) 2261switch (boundMember.Kind)
Binder\Binder_Query.cs (7)
929while (ultimateReceiver.Kind == BoundKind.QueryClause) 936Debug.Assert(ultimateReceiver.Kind != BoundKind.MethodGroup || ultimateReceiver.HasAnyErrors); 954else if (ultimateReceiver.Kind == BoundKind.NamespaceExpression) 958else if (ultimateReceiver.Kind == BoundKind.Lambda || ultimateReceiver.Kind == BoundKind.UnboundLambda) 966else if (ultimateReceiver.Kind == BoundKind.TypeExpression) 974else 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 && 899BoundExpression expression = value.Kind is BoundKind.UnboundLambda or BoundKind.MethodGroup ? 1250switch (initializerOpt.Kind) 1434bool discardAssignment = op1.Kind == BoundKind.DiscardExpression; 1513if (op1.Kind != BoundKind.DynamicIndexerAccess && 1514op1.Kind != BoundKind.DynamicMemberAccess && 1515op1.Kind != BoundKind.DynamicObjectInitializerMember) 1531if ((op1.Kind == BoundKind.EventAccess) && 1588else if (op1.Kind is BoundKind.Local or BoundKind.Parameter) 1601Debug.Assert(op1.Kind != BoundKind.Parameter); // If the assert fails, add a corresponding test. 1676switch (expr.Kind) 1709throw ExceptionUtilities.UnexpectedValue(implicitIndexerAccess.IndexerOrSliceAccess.Kind); 1761_ => throw ExceptionUtilities.UnexpectedValue(e.Kind) 1817(propertyIsStatic || receiver?.Kind == BoundKind.ThisReference); 1852else if (receiver.Kind == BoundKind.BaseReference) 1978if (expression.HasAnyErrors && expression.Kind != BoundKind.UnboundLambda) 2366switch (operand.Kind) 2486Debug.Assert(operand.HasAnyErrors && operand.Kind != BoundKind.UnboundLambda, "Missing a case in implicit conversion error reporting"); 2729if (expr.Kind == BoundKind.AssignmentOperator) 2732if (assignment.Right.Kind == BoundKind.Literal && assignment.Right.ConstantValueOpt.Discriminator == ConstantValueTypeDiscriminator.Boolean) 3210if (!argument.HasAnyErrors || argument.Kind == BoundKind.UnboundLambda) 3501if (expression.Kind == BoundKind.DelegateCreationExpression || expression.Kind == BoundKind.NameOfOperator) 3529if ((refKind != RefKind.None) != (returnRefKind != RefKind.None) && expression.Kind != BoundKind.ThrowExpression) 4199if (boundAccess.Kind != BoundKind.MethodGroup) 4227if (patternMethodCall.Kind != BoundKind.Call)
Binder\Binder_TupleOperators.cs (2)
224Debug.Assert((object)left.Type != null || left.Kind == BoundKind.TupleLiteral); 225Debug.Assert((object)right.Type != null || right.Kind == BoundKind.TupleLiteral);
Binder\DecisionDagBuilder.cs (16)
408throw ExceptionUtilities.UnexpectedValue(pattern.Kind); 1419throw ExceptionUtilities.UnexpectedValue(n.Kind); 1687throw ExceptionUtilities.UnexpectedValue(n?.Kind); 2907return $"t{tempIdentifier(a)}={a.Kind}({tempName(a.Input)} as {a.Type})"; 2909return $"t{tempIdentifier(e)}={e.Kind}({tempName(e.Input)}.{e.Field.Name})"; 2911return $"t{tempIdentifier(e)}={e.Kind}({tempName(e.Input)}.{e.Property.Name})"; 2913return $"t{tempIdentifier(e)}={e.Kind}({tempName(e.Input)}[{e.Index}])"; 2915return $"{e.Kind}({tempName(e.Target)}<--{tempName(e.Input)})"; 2917return $"t{tempIdentifier(e)}={e.Kind}({tempName(e.Input)})"; 2919return $"?{d.Kind}({tempName(d.Input)} is {b.Type})"; 2921return $"?{d.Kind}({tempName(d.Input)} == {v.Value})"; 2931return $"?{d.Kind}({tempName(d.Input)} {operatorName} {r.Value})"; 2933return $"?{d.Kind}({tempName(d.Input)})"; 4639if (RemainingTests[0] is One { Test: { Kind: BoundKind.DagNonNullTest } planA }) 4670case One { Test: { Kind: BoundKind.DagTypeTest } planB1 }: 4677case One { Test: { Kind: BoundKind.DagValueTest } planB2 }:
Binder\DecisionDagBuilder_ListPatterns.cs (1)
21list.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)
200throw ExceptionUtilities.UnexpectedValue(currentNode.Kind);
Binder\RefSafetyAnalysis.cs (1)
603if (node.Left.Kind != BoundKind.DiscardExpression)
Binder\Semantics\Conversions\ConversionsBase.cs (4)
1074switch (sourceExpression.Kind) 1425if (sourceExpression.Kind == BoundKind.TupleLiteral) 1661if (source.Kind != BoundKind.UnboundLambda) 1965if (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)
637if (argument.Kind == BoundKind.UnboundLambda && target.Type.GetDelegateType() is { }) 642else if (argument.Kind == BoundKind.UnconvertedCollectionExpression) 646else if (argument.Kind != BoundKind.TupleLiteral || 879if (argument.Kind == BoundKind.TupleLiteral && (object)argument.Type == null) 883else if (argument.Kind == BoundKind.UnconvertedCollectionExpression) 1023if ((isFunctionPointer && argument.Kind != BoundKind.UnconvertedAddressOfOperator) || 1024(!isFunctionPointer && argument.Kind is not (BoundKind.UnboundLambda or BoundKind.MethodGroup))) 1079if ((isFunctionPointer && argument.Kind != BoundKind.UnconvertedAddressOfOperator) || 1080(!isFunctionPointer && argument.Kind is not (BoundKind.UnboundLambda or BoundKind.MethodGroup))) 1448if (source.Kind is not (BoundKind.MethodGroup or BoundKind.UnconvertedAddressOfOperator)) 1459if (delegateOrFunctionPointerType.IsFunctionPointer() != (source.Kind == BoundKind.UnconvertedAddressOfOperator)) 1559if (source.Kind != BoundKind.UnboundLambda) 1613if (source.Kind != BoundKind.UnboundLambda) 3087if (source.Kind != BoundKind.UnboundLambda)
Binder\Semantics\OverloadResolution\OverloadResolution.cs (13)
2175var argumentKind = arguments[i].Kind; 2317var argumentKind = arguments[i].Kind; 2481if (arguments[i].Kind == BoundKind.ArgListOperator) 2627if (arguments[i].Kind != BoundKind.ArgListOperator) 2954var nodeKind = node.Kind; 3277if (node.Kind == BoundKind.TupleLiteral) 3293if (node.Kind == BoundKind.UnboundLambda && 3333if (lambda.Body.Statements[0].Kind == BoundKind.ReturnStatement) 3609if (node?.Kind == BoundKind.MethodGroup) 4559if (argument.Kind == BoundKind.ArgListOperator) 4734if (argument.Kind == BoundKind.OutVariablePendingInference || 4735argument.Kind == BoundKind.OutDeconstructVarPendingInference || 4736(argument.Kind == BoundKind.DiscardExpression && (object)argType == null))
Binder\Semantics\OverloadResolution\OverloadResolutionResult.cs (13)
682if (receiverOpt?.Kind == BoundKind.QueryClause) 1109if (argument.Kind == BoundKind.UnboundLambda) 1249argument.Kind != BoundKind.OutDeconstructVarPendingInference && 1250argument.Kind != BoundKind.OutVariablePendingInference && 1251argument.Kind != BoundKind.DiscardExpression) 1257if (argument.Kind == BoundKind.UnboundLambda && refArg == refParameter) 1261else if (argument.Kind == BoundKind.MethodGroup && parameterType.TypeKind == TypeKind.Delegate && 1266else if (argument.Kind == BoundKind.MethodGroup && parameterType.TypeKind == TypeKind.FunctionPointer) 1270else if (argument.Kind == BoundKind.UnconvertedAddressOfOperator && 1275else if (argument.Kind == BoundKind.UnconvertedCollectionExpression) 1340Debug.Assert(argument.Kind != BoundKind.OutDeconstructVarPendingInference); 1341Debug.Assert(argument.Kind != BoundKind.OutVariablePendingInference); 1342Debug.Assert(argument.Kind != BoundKind.DiscardExpression || argument.HasExpressionType());
BoundTree\BoundDagEvaluation.cs (5)
34return Hash.Combine((int)Kind, this.Symbol?.GetHashCode() ?? 0); 43this.Kind == other.Kind && 61_ => throw ExceptionUtilities.UnexpectedValue(this.Kind) 214return Hash.Combine(DecisionDagBuilder.OriginalInput(input), Hash.Combine((int)Kind, index));
BoundTree\BoundDagTest.cs (5)
22if (other is null || this.Kind != other.Kind) 48return Hash.Combine(((int)Kind).GetHashCode(), Input.GetHashCode()); 111return $"{e.GetOutputTempDebuggerDisplay()} = {e.Kind}({e.Input.GetDebuggerDisplay()})"; 132return $"{this.Kind}({this.Input.GetDebuggerDisplay()})";
BoundTree\BoundDecisionDag.cs (1)
42throw ExceptionUtilities.UnexpectedValue(node.Kind);
BoundTree\BoundExpression.cs (5)
61if ((Kind != BoundKind.Local && Kind != BoundKind.Parameter) || this.WasConverted) 79switch (Kind) 623return this.Condition.Kind == BoundKind.UnaryOperator && ((BoundUnaryOperator)this.Condition).OperatorKind.IsDynamic(); 689if (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); 180switch (node.Kind) 252switch (boundNode.Kind)
BoundTree\BoundMethodGroup.cs (1)
61if (this.ReceiverOpt == null || this.ReceiverOpt.Kind == BoundKind.TypeExpression)
BoundTree\BoundNode_Source.cs (1)
477appendLine(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); 132throw ExceptionUtilities.UnexpectedValue(current.Left.Kind); 148throw ExceptionUtilities.UnexpectedValue(current.Right.Kind); 216_ => throw ExceptionUtilities.UnexpectedValue(currentBinary.Left.Kind) 227_ => throw ExceptionUtilities.UnexpectedValue(currentBinary.Right.Kind) 258_ => 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) 213Debug.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); 2159switch (current.Kind) 2243switch (receiver.Kind) 2657if (objCreation.Arguments.Length > 0 && objCreation.Arguments[0].Kind == BoundKind.ConvertedStackAllocExpression) 2691if (left.Kind == BoundKind.ArrayAccess && left.Type.TypeKind == TypeKind.TypeParameter && !left.Type.IsValueType) 2696if (left.Kind == BoundKind.FieldAccess) 2798switch (left.Kind) 2817switch (assignmentTarget.Kind) 2998throw ExceptionUtilities.UnexpectedValue(assignmentTarget.Kind); 3019throw ExceptionUtilities.UnexpectedValue(assignmentTarget.Kind); 3048Debug.Assert(lhs.Kind != BoundKind.Parameter || exprTempsAfter <= exprTempsBefore); 3050if (lhs.Kind == BoundKind.Local && ((BoundLocal)lhs).LocalSymbol.SynthesizedKind.IsLongLived()) 3106switch (expression.Kind) 3206throw ExceptionUtilities.UnexpectedValue(expression.Kind); 3959switch (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)) || 1158while (exceptionSource.Kind == BoundKind.Sequence) 1166switch (exceptionSource.Kind) 1205throw ExceptionUtilities.UnexpectedValue(exceptionSource.Kind); 1291if (expression.Kind == BoundKind.Sequence) 1299if (expression.Kind == BoundKind.SequencePointExpression) 1306switch (expression.Kind)
CodeGen\Optimizer.cs (18)
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 && 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) 1708if (exceptionSourceOpt.Kind == BoundKind.Local) 1947top.Item1.Kind == BoundKind.Local && 2129if (child.Kind != BoundKind.BinaryOperator || child.ConstantValueOpt != null) 2145if (child.Kind != BoundKind.BinaryOperator || child.ConstantValueOpt != null) 2358if (exceptionSource.Kind == BoundKind.Local)
Compilation\CSharpSemanticModel.cs (12)
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 && 4005switch (boundNodeForSyntacticParent.Kind) 4031throw ExceptionUtilities.UnexpectedValue(boundNodeForSyntacticParent.Kind); 4284switch (boundNodeForSyntacticParent.Kind) 4433switch (boundNodeForSyntacticParent.Kind)
Compilation\MemberSemanticModel.cs (5)
1239Debug.Assert(highestBoundNode.Kind != BoundKind.UnboundLambda); 1781switch (boundInnerLambdaOrQuery.Kind) 1810switch (node.Kind) 1828while (receiver?.Kind == BoundKind.MethodGroup) 1895if (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)); 1342if (processedInitializers.LoweredInitializers.Kind == BoundKind.StatementList) 1999switch (methodBody.Kind) 2041throw ExceptionUtilities.UnexpectedValue(methodBody.Kind);
FlowAnalysis\AbstractFlowPass.cs (16)
554switch (node?.Kind) 847switch (node.Kind) 872throw ExceptionUtilities.UnexpectedValue(node.Kind); 897RoslynDebug.Assert(false, $"Should Visit{node.Kind} be overridden in {this.GetType().Name}?"); 1071throw ExceptionUtilities.UnexpectedValue(pattern.Kind); 1124throw ExceptionUtilities.UnexpectedValue(pattern.Kind); 1918if (pend.Branch.Kind != BoundKind.YieldReturnStatement) 2180if (expr.Kind != BoundKind.PropertyAccess) 2213var refKind = node.Left.Kind == BoundKind.BadExpression 2294receiverOpt.Kind != BoundKind.TypeExpression && 2475var childKind = child.Kind; 2515switch (binary.Kind) 2526throw ExceptionUtilities.UnexpectedValue(binary.Kind); 2535switch (binary.Kind) 2548throw ExceptionUtilities.UnexpectedValue(binary.Kind); 2554Debug.Assert(!isBool || binary.Kind != BoundKind.UserDefinedConditionalLogicalOperator);
FlowAnalysis\ControlFlowPass.cs (3)
213switch (pending.Branch.Kind) 241switch (statement.Kind) 304switch (branch.Branch.Kind)
FlowAnalysis\DataFlowsOutWalker.cs (2)
118switch (node.Kind) 239switch (node.Kind)
FlowAnalysis\DefiniteAssignment.cs (20)
242if (node.Kind == BoundKind.Attribute) 737Debug.Assert(fieldOrEventAccess.Kind == BoundKind.FieldAccess || fieldOrEventAccess.Kind == BoundKind.EventAccess); 741switch (n.Kind) 873if (value is { ConstantValueOpt: not null, Kind: not BoundKind.InterpolatedString }) return false; 875switch (value.Kind) 914switch (n.Kind) 931if (n.Kind == BoundKind.Local) 1023switch (expr.Kind) 1077receiver.Kind != BoundKind.TypeExpression && 1094receiverOpt.Kind != BoundKind.TypeExpression && 1335switch (node.Kind) 1438switch (expression.Kind) 1490switch (node.Kind) 1956switch (pattern.Kind) 2083throw ExceptionUtilities.UnexpectedValue(pattern.Kind); 2158if (stmt.Kind != BoundKind.LocalFunctionStatement) 2406if (pending.Branch.Kind == BoundKind.ReturnStatement) 2480if (initializer.Kind == BoundKind.AddressOfOperator) 2551switch (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)
392|| expr.Kind == BoundKind.ExpressionWithNullability 462private bool IsAnalyzingAttribute => methodMainNode.Kind == BoundKind.Attribute; 592Debug.Assert(expression != null || placeholder.Kind == BoundKind.InterpolatedStringArgumentPlaceholder); 611switch (placeholder.Kind) 626throw ExceptionUtilities.UnexpectedValue(placeholder.Kind); 2103switch (expr.Kind) 2152receiver.Kind != BoundKind.TypeExpression && 2178switch (node.Kind) 2647switch (expr.Kind) 3175if (!expr.IsSuppressed && RemoveConversion(expr, includeExplicitConversions: false).expression.Kind != BoundKind.ThrowExpression) 4396Debug.Assert(node.Kind is BoundKind.ObjectCreationExpression or BoundKind.DynamicObjectCreationExpression or BoundKind.NewT or BoundKind.NoPiaObjectCreationExpression); 4532switch (initializer.Kind) 4547switch (initializer.Kind) 4560ExceptionUtilities.UnexpectedValue(node.Kind); 4577switch (left.Kind) 5312if (child.Kind == BoundKind.ArrayInitialization) 5933switch (operand.Kind) 6129while (possiblyConversion.Kind == BoundKind.Conversion) 8137return (argument.Kind == BoundKind.Lambda); 8813switch (expr.Kind) 8865if (argument.Kind == BoundKind.Lambda) 8874if (argument.Kind == BoundKind.CollectionExpression) 9010if (expr.Kind != BoundKind.Conversion) 9093switch (value.Kind) 10029if (operandType.Type?.IsTupleType == true || conversionOperand.Kind == BoundKind.TupleLiteral) 11232if (left.Kind == BoundKind.EventAccess && ((BoundEventAccess)left).EventSymbol.IsWindowsRuntimeEvent) 11649switch (expr.Kind) 11667switch (expr.Kind) 12032if (initializer.Kind == BoundKind.AddressOfOperator) 12038if (node.Expression.Kind == BoundKind.AddressOfOperator) 12343if (node.Expression.Kind != BoundKind.Conversion) 12899throw ExceptionUtilities.UnexpectedValue(binary.Kind); 12914throw ExceptionUtilities.UnexpectedValue(binary.Kind);
FlowAnalysis\NullableWalker.DebugVerifier.cs (2)
73else if (overrideSkippedExpression || !s_skippedExpressions.Contains(expression.Kind)) 176if (!s_skippedExpressions.Contains(child.Kind))
FlowAnalysis\NullableWalker.SnapshotManager.cs (1)
106if (node.Kind == BoundKind.TypeExpression || node.WasCompilerGenerated)
FlowAnalysis\NullableWalker_Patterns.cs (5)
532throw ExceptionUtilities.UnexpectedValue(p.Evaluation.Kind); 609throw ExceptionUtilities.UnexpectedValue(test.Kind); 668throw ExceptionUtilities.UnexpectedValue(dagNode.Kind); 821throw ExceptionUtilities.UnexpectedValue(evaluation.Kind); 960_ => 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)
FlowAnalysis\VariablesDeclaredWalker.cs (1)
159throw ExceptionUtilities.UnexpectedValue(pattern.Kind);
Generated\BoundNodes.xml.Generated.cs (1)
9095switch (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)
1119if (visited.Kind != BoundKind.Call) 1346if (node.Argument.Kind == BoundKind.Lambda) 1393receiver.Kind == BoundKind.TypeExpression &&
Lowering\ClosureConversion\ExpressionLambdaRewriter.cs (7)
139switch (stmt.Kind) 158throw ExceptionUtilities.UnexpectedValue(stmt.Kind); 185switch (node.Kind) 256throw ExceptionUtilities.UnexpectedValue(node.Kind); 540if (operand.Kind == BoundKind.Conversion) 807if (node.Argument.Kind == BoundKind.MethodGroup) 989switch (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; 292bool hasBaseReceiver = node.ReceiverOpt != null && node.ReceiverOpt.Kind == BoundKind.BaseReference; 711if (current.Left.Kind == BoundKind.BinaryOperator) 815if (operand.Kind == BoundKind.FieldAccess) 922if (node.Argument.Kind != BoundKind.MethodGroup) 1006if (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) 316if (node.Left.ConstantValueOpt != null && node.Right.ConstantValueOpt == null && node.Right.Kind == BoundKind.Conversion) 321if (node.Right.ConstantValueOpt != null && node.Left.ConstantValueOpt == null && node.Left.Kind == BoundKind.Conversion) 346return node.Kind == BoundKind.Conversion && ((BoundConversion)node).ExplicitCastInCode; 352if (node.Kind != BoundKind.Conversion) return false; 576if (operand.Kind == BoundKind.Conversion) 605if (expr.Kind != BoundKind.Conversion) 864if (node.Kind == BoundKind.Conversion) 888while (right.Kind == BoundKind.Conversion) 903if (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 (11)
290node.Kind is not (BoundKind.ImplicitReceiver or BoundKind.ObjectOrCollectionValuePlaceholder or BoundKind.ValuePlaceholder or BoundKind.CollectionBuilderElementsPlaceholder)) 313return node.Kind == BoundKind.DeconstructionAssignmentOperator && !((BoundDeconstructionAssignmentOperator)node).IsUsed; 718if (initializer.Kind == BoundKind.Block) 888switch (initializer.Kind) 895if (initializer.Kind == BoundKind.ExpressionStatement) 903return ((BoundExpressionStatement)initializer).Expression.Kind == BoundKind.AssignmentOperator; 920if (statement.Kind != BoundKind.ExpressionStatement) 931Debug.Assert(assignment.Left.Kind == BoundKind.FieldAccess); 1027switch (expr.Kind) 1128throw ExceptionUtilities.UnexpectedValue(expr.Kind); 1134RoslynDebug.Assert(expr is not BoundValuePlaceholderBase, $"Placeholder kind {expr.Kind} must be handled explicitly");
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); 980if (!sortedNodes.Any(static n => n.Kind == BoundKind.WhenDecisionDagNode)) return; 1192Debug.Assert(left.Kind == BoundKind.Local && left == binding.VariableAccess); 1241throw ExceptionUtilities.UnexpectedValue(node.Kind);
Lowering\LocalRewriter\LocalRewriter.PatternLocalRewriter.cs (4)
554if ((loweredInput.Kind == BoundKind.Local || loweredInput.Kind == BoundKind.Parameter) 679if (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()) 660if (constantLeft == null && loweredLeft.Kind != BoundKind.Local && loweredLeft.Kind != BoundKind.Parameter) 721if (expression.Kind == BoundKind.Conversion) 1627if (nonNullRight != null && nonNullRight.ConstantValueOpt != null && left.Kind == BoundKind.Sequence) 1630if (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) 895var u => throw ExceptionUtilities.UnexpectedValue(u.Kind) 1625if (argument.Kind == BoundKind.Local) 1714if (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) 1376if (operand.Kind == BoundKind.Sequence) 1379if (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)
560if (node.LengthOrCountAccess.Kind is not BoundKind.Local || receiver.Kind is not (BoundKind.Local or BoundKind.Parameter)) 602if (makeOffsetInput.ConstantValueOpt is null && lengthAccess.Kind is not BoundKind.ArrayLength) 863if (node.LengthOrCountAccess.Kind is not BoundKind.Local || receiver.Kind is not (BoundKind.Local or BoundKind.Parameter)) 1029if ((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)
112Debug.Assert(!_inExpressionLambda && lhsRead.Kind != BoundKind.PropertyAccess); 116if (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)
627if (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\LocalRewriter\PipelinePhaseValidator.cs (3)
100if (_completedPhase >= DoesNotSurvive(node.Kind)) 101Debug.Assert(false, $"Bound nodes of kind {node.Kind} should not survive past {DoesNotSurvive(node.Kind)}");
Lowering\MethodToClassRewriter.cs (6)
259if (originalLeft.Kind != BoundKind.Local) 273Debug.Assert(originalRight.Kind != BoundKind.ConvertedStackAllocExpression); 295if (rewrittenLeft.Kind != BoundKind.Local && originalRight.Kind == BoundKind.ConvertedStackAllocExpression) 377return originalReceiver is { Kind: BoundKind.BaseReference } && 378rewrittenReceiver 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) 884switch (left.Kind)
Lowering\StateMachineRewriter\IteratorAndAsyncCaptureWalker.cs (1)
316if (node.ReceiverOpt != null && node.ReceiverOpt.Kind == BoundKind.ThisReference)
Lowering\StateMachineRewriter\MethodToStateMachineRewriter.cs (3)
417if (statement.Kind == BoundKind.Block) 421if (rewrittenStatements.Length == 1 && rewrittenStatements[0].Kind == BoundKind.StateMachineScope) 620if (node.Left.Kind != BoundKind.Local)
Lowering\StateMachineRewriter\RefInitializationHoister.cs (3)
147switch (expr.Kind) 216if (receiver.Kind != BoundKind.ThisReference && !isFieldOfStruct) 299throw ExceptionUtilities.UnexpectedValue(expr.Kind);
Lowering\SyntheticBoundNodeFactory.cs (3)
591if (body.Kind != BoundKind.Block) 1747var discardsPresent = arguments.Any(static a => a.Kind == BoundKind.DiscardExpression); 1752(arg, t) => arg.Kind == BoundKind.DiscardExpression ? t.factory.MakeTempForDiscard((BoundDiscardExpression)arg, t.builder) : arg,
Operations\CSharpOperationFactory.cs (32)
34switch (boundNode.Kind) 311switch (boundNode.Kind) 340throw ExceptionUtilities.UnexpectedValue(boundNode.Kind); 405switch (declaration.Kind) 423throw ExceptionUtilities.UnexpectedValue(declaration.Kind); 529switch (declaration.Kind) 555throw ExceptionUtilities.UnexpectedValue(declaration.Kind); 615throw ExceptionUtilities.UnexpectedValue(boundNode.Kind); 814throw ExceptionUtilities.UnexpectedValue(indexer.Kind); 830throw ExceptionUtilities.UnexpectedValue(indexer.Kind); 973if (receiver?.Kind == BoundKind.TypeExpression) 1110Debug.Assert(boundOperand.Kind == BoundKind.BadExpression || 1112ExpressionOpt?.Kind == BoundKind.BadExpression); 1122if (boundOperand.Kind == BoundKind.ConvertedTupleLiteral && TypeSymbol.Equals(boundOperand.Type, boundConversion.Type, TypeCompareKind.ConsiderEverything2)) 1136if (boundConversion.ExplicitCastInCode && conversion.IsIdentity && boundOperand.Kind == BoundKind.Conversion) 1142nestedOperand.Kind == BoundKind.ConvertedTupleLiteral && 1158if ((boundOperand.Kind == BoundKind.Lambda || 1159boundOperand.Kind == BoundKind.UnboundLambda || 1160boundOperand.Kind == BoundKind.MethodGroup) && 1402boundAssignmentOperator.Right?.Kind == BoundKind.ObjectInitializerExpression || 1403boundAssignmentOperator.Right?.Kind == BoundKind.CollectionInitializerExpression; 1550{ Kind: var kind } => throw ExceptionUtilities.UnexpectedValue(kind) 1709if (boundIndexerAccess.LengthOrCountAccess.Kind == BoundKind.ArrayLength) 2313{ Kind: var kind } => throw ExceptionUtilities.UnexpectedValue(kind) 2346if (part.Kind == BoundKind.StringInsert) 2406throw ExceptionUtilities.UnexpectedValue(part.Kind); 2422_ => throw ExceptionUtilities.UnexpectedValue(value.Kind), 2519_ => throw ExceptionUtilities.UnexpectedValue(part.Kind) 2542throw ExceptionUtilities.UnexpectedValue(current.Kind); 2605if (variable == null && boundDeclarationPattern.VariableAccess?.Kind == BoundKind.DiscardExpression) 2819Debug.Assert(boundSwitchLabel.Pattern.Kind == BoundKind.DiscardPattern); 2823boundSwitchLabel.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)
1096switch (expression.Kind)
Symbols\Source\SourceComplexParameterSymbol.cs (1)
407if (convertedExpression.ConstantValueOpt == null && convertedExpression.Kind == BoundKind.Conversion &&