764 references to Kind
Microsoft.CodeAnalysis.CSharp (743)
Binder\Binder.cs (1)
886RoslynDebug.Assert(statement.Kind != BoundKind.StatementList);
Binder\Binder.ValueChecks.cs (28)
513switch (expr.Kind) 614if (expr.Kind == BoundKind.MethodGroup && valueKind != BindValueKind.RValueOrMethodGroup) 640if ((object)otherSymbol != null && receiver?.Kind == BoundKind.TypeOrValueExpression) 677switch (expression?.Kind) 680case BoundKind.QueryClause when ((BoundQueryClause)expression).Value.Kind == BoundKind.TypeOrValueExpression: 709switch (expr.Kind) 714case BoundKind.ImplicitIndexerAccess when ((BoundImplicitIndexerAccess)expr).IndexerOrSliceAccess.Kind == BoundKind.IndexerAccess: 735switch (expr.Kind) 899throw ExceptionUtilities.UnexpectedValue(implicitIndexer.IndexerOrSliceAccess.Kind); 972RoslynDebug.Assert(expr is not BoundValuePlaceholderBase, $"Placeholder kind {expr.Kind} should be explicitly handled"); 1017switch (expr.Kind) 1642return Flags.Includes(BinderFlags.ObjectInitializerMember) && receiver.Kind == BoundKind.ObjectOrCollectionValuePlaceholder || 1806ReportDiagnosticsIfObsolete(diagnostics, setMethod, node, receiver?.Kind == BoundKind.BaseReference); 1856ReportDiagnosticsIfObsolete(diagnostics, getMethod, node, receiver?.Kind == BoundKind.BaseReference); 1939if (receiverOpt?.Kind == BoundKind.BaseReference && member.IsAbstract) 2414if (argument.Kind == BoundKind.ArgListOperator) 3450switch (expr.Kind) 3630throw ExceptionUtilities.UnexpectedValue(implicitIndexerAccess.IndexerOrSliceAccess.Kind); 3772switch (expr.Kind) 3958throw ExceptionUtilities.UnexpectedValue(implicitIndexerAccess.IndexerOrSliceAccess.Kind); 4167switch (expr.Kind) 4339throw ExceptionUtilities.UnexpectedValue(implicitIndexerAccess.IndexerOrSliceAccess.Kind); 4663RoslynDebug.Assert(false, $"{expr.Kind} expression of {expr.Type} type"); 4750if (expr.Kind == BoundKind.AssignmentOperator) 4898switch (expr.Kind) 5112throw ExceptionUtilities.UnexpectedValue(implicitIndexerAccess.IndexerOrSliceAccess.Kind); 5499RoslynDebug.Assert(false, $"{expr.Kind} expression of {expr.Type} type"); 5829throw ExceptionUtilities.UnexpectedValue(expression.Kind);
Binder\Binder_Attributes.cs (2)
812switch (assignment.Left.Kind) 862switch (node.Kind)
Binder\Binder_Await.cs (3)
78if (expression.Kind != BoundKind.Call || 340if (getAwaiterCall.Kind != BoundKind.Call) 447if (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) 2184Debug.Assert(source.Kind is BoundKind.MethodGroup or BoundKind.UnboundLambda); 2191if (source.Kind == BoundKind.UnboundLambda && 2200source.Kind == BoundKind.MethodGroup && 2552if (node.Kind != BoundKind.MethodGroup) 2695if (receiverOpt.Kind == BoundKind.QueryClause) 2797while (receiverOpt.Kind == BoundKind.QueryClause) 2802return receiverOpt.Kind == BoundKind.TypeExpression; 2812switch (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 5432else if (argument.Kind == BoundKind.MethodGroup) 5869if (boundMember.Kind == BoundKind.PropertyGroup) 5911BoundKind boundMemberKind = boundMember.Kind; 6500if (addMethodInvocation.Kind == BoundKind.DynamicInvocation) 6511else if (addMethodInvocation.Kind == BoundKind.Call) 6540Debug.Assert(addMethodInvocation.Kind == BoundKind.BadExpression); 7017switch (classCreation.Kind) 7030throw ExceptionUtilities.UnexpectedValue(classCreation.Kind); 7502if (boundValue.Kind == BoundKind.Conversion) 7694if (boundLeft.Kind == BoundKind.UnboundLambda) 7739switch (boundLeft.Kind) 7771if (boundLeft.Kind == BoundKind.Literal && ((BoundLiteral)boundLeft).ConstantValueOpt == ConstantValue.Null) 7958switch (expr.Kind) 8085bool leftIsBaseReference = boundLeft.Kind == BoundKind.BaseReference; 8192if (boundLeft.HasAnyErrors && boundLeft.Kind != BoundKind.TypeOrValueExpression) 8213else if (boundLeft.Kind == BoundKind.TypeExpression || 8214boundLeft.Kind == BoundKind.BaseReference || 8451ReportDiagnosticsIfObsolete(diagnostics, symbol, node, hasBaseReceiver: left.Kind == BoundKind.BaseReference); 9067ReportDiagnosticsIfObsolete(diagnostics, propertySymbol, node, hasBaseReceiver: receiver?.Kind == BoundKind.BaseReference); 9170switch (receiver.Kind) 9368if (receiver.Kind == BoundKind.PropertyGroup) 9783if (index.Kind == BoundKind.OutVariablePendingInference) 9787else if (index.Kind == BoundKind.DiscardExpression && !index.HasExpressionType()) 9975LookupOptions lookupOptions = expr.Kind == BoundKind.BaseReference ? LookupOptions.UseBaseReferenceAccessibility : LookupOptions.Default; 10089BoundKind receiverKind = receiver.Kind; 10231ReportDiagnosticsIfObsolete(diagnostics, property, syntax, hasBaseReceiver: receiver != null && receiver.Kind == BoundKind.BaseReference); 10241if (!gotError && receiver != null && receiver.Kind == BoundKind.ThisReference && receiver.WasCompilerGenerated) 11353if (access.Kind == BoundKind.MethodGroup) 11517if (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; 274if (argument.Kind == BoundKind.OutVariablePendingInference) 351else if (boundExpression.Kind == BoundKind.MethodGroup) 404if (expression.Kind == BoundKind.MethodGroup) 412switch (receiver.Kind) 587if (arg.Kind == BoundKind.Lambda || arg.Kind == BoundKind.UnboundLambda) 593else if (arg.Kind == BoundKind.MethodGroup) 599else if (arg.Kind == BoundKind.ArgListOperator) 728Debug.Assert(extensionMemberAccess.Kind != BoundKind.MethodGroup); 1057switch (expression.Kind) 1073else if (call.ReceiverOpt.Kind == BoundKind.BaseReference && this.ContainingType.IsRestrictedType()) 1097throw ExceptionUtilities.UnexpectedValue(expression.Kind); 1308if (!gotError && method.RequiresInstanceReceiver && receiver != null && receiver.Kind == BoundKind.ThisReference && receiver.WasCompilerGenerated) 1324bool hasBaseReceiver = receiver != null && receiver.Kind == BoundKind.BaseReference; 1892switch (receiver.Kind) 1958if ((object)expr != null && expr.Kind != BoundKind.TypeExpression) 2096switch (argument.Kind) 2142if (argument.Kind == BoundKind.OutVariablePendingInference) 2153else if (argument.Kind == BoundKind.DiscardExpression) 2261var 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)
924while (ultimateReceiver.Kind == BoundKind.QueryClause) 931Debug.Assert(ultimateReceiver.Kind != BoundKind.MethodGroup || ultimateReceiver.HasAnyErrors); 949else if (ultimateReceiver.Kind == BoundKind.NamespaceExpression) 953else if (ultimateReceiver.Kind == BoundKind.Lambda || ultimateReceiver.Kind == BoundKind.UnboundLambda) 961else if (ultimateReceiver.Kind == BoundKind.TypeExpression) 969else 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. 1647switch (expr.Kind) 1680throw ExceptionUtilities.UnexpectedValue(implicitIndexerAccess.IndexerOrSliceAccess.Kind); 1731_ => throw ExceptionUtilities.UnexpectedValue(e.Kind) 1787(propertyIsStatic || receiver?.Kind == BoundKind.ThisReference); 1822else if (receiver.Kind == BoundKind.BaseReference) 1948if (expression.HasAnyErrors && expression.Kind != BoundKind.UnboundLambda) 2336switch (operand.Kind) 2456Debug.Assert(operand.HasAnyErrors && operand.Kind != BoundKind.UnboundLambda, "Missing a case in implicit conversion error reporting"); 2699if (expr.Kind == BoundKind.AssignmentOperator) 2702if (assignment.Right.Kind == BoundKind.Literal && assignment.Right.ConstantValueOpt.Discriminator == ConstantValueTypeDiscriminator.Boolean) 3174if (!argument.HasAnyErrors || argument.Kind == BoundKind.UnboundLambda) 3450if (expression.Kind == BoundKind.DelegateCreationExpression || expression.Kind == BoundKind.NameOfOperator) 3478if ((refKind != RefKind.None) != (returnRefKind != RefKind.None) && expression.Kind != BoundKind.ThrowExpression) 4132if (boundAccess.Kind != BoundKind.MethodGroup) 4160if (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)
541if (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)
2188var argumentKind = arguments[i].Kind; 2330var argumentKind = arguments[i].Kind; 2494if (arguments[i].Kind == BoundKind.ArgListOperator) 2647if (arguments[i].Kind != BoundKind.ArgListOperator) 2935var nodeKind = node.Kind; 3258if (node.Kind == BoundKind.TupleLiteral) 3274if (node.Kind == BoundKind.UnboundLambda && 3314if (lambda.Body.Statements[0].Kind == BoundKind.ReturnStatement) 3590if (node?.Kind == BoundKind.MethodGroup) 4540if (argument.Kind == BoundKind.ArgListOperator) 4715if (argument.Kind == BoundKind.OutVariablePendingInference || 4716argument.Kind == BoundKind.OutDeconstructVarPendingInference || 4717(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)) || 859Debug.Assert(sequence.Value.Kind != BoundKind.TypeExpression || !used); 860if (sequence.Value.Kind != BoundKind.TypeExpression) 1002Debug.Assert(arguments[i].Kind == BoundKind.ArgListOperator); 1231else if (receiver.Kind == BoundKind.Conversion) 1242else if (receiver.Kind == BoundKind.FieldAccess) 1273if (receiver.Kind == BoundKind.Conversion && ((BoundConversion)receiver).ConversionKind == ConversionKind.Unboxing) 1284switch (receiver.Kind) 1516Debug.Assert(receiver.Kind != BoundKind.BaseReference, "base should always use call"); 1525switch (receiver.Kind) 1598switch (receiver.Kind) 1646Debug.Assert(receiver.Kind == BoundKind.ThisReference); 2128switch (current.Kind) 2211switch (receiver.Kind) 2620if (objCreation.Arguments.Length > 0 && objCreation.Arguments[0].Kind == BoundKind.ConvertedStackAllocExpression) 2654if (left.Kind == BoundKind.ArrayAccess && left.Type.TypeKind == TypeKind.TypeParameter && !left.Type.IsValueType) 2659if (left.Kind == BoundKind.FieldAccess) 2754switch (left.Kind) 2773switch (assignmentTarget.Kind) 2954throw ExceptionUtilities.UnexpectedValue(assignmentTarget.Kind); 2975throw ExceptionUtilities.UnexpectedValue(assignmentTarget.Kind); 3004Debug.Assert(lhs.Kind != BoundKind.Parameter || exprTempsAfter <= exprTempsBefore); 3006if (lhs.Kind == BoundKind.Local && ((BoundLocal)lhs).LocalSymbol.SynthesizedKind.IsLongLived()) 3062switch (expression.Kind) 3162throw ExceptionUtilities.UnexpectedValue(expression.Kind); 3915switch (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 (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 && 1030(lhs.Kind is BoundKind.Local or BoundKind.Parameter or BoundKind.FieldAccess && lhs.GetRefKind() != RefKind.None), 1033switch (lhs.Kind) 1092throw ExceptionUtilities.UnexpectedValue(lhs.Kind); 1099if (lhs.Kind == BoundKind.FieldAccess) 1424if (boundExpression.Kind == BoundKind.Local) 1476if (child.Kind != BoundKind.BinaryOperator || child.ConstantValueOpt != null) 1492if (child.Kind != BoundKind.BinaryOperator || child.ConstantValueOpt != null) 1696if (exceptionSourceOpt.Kind == BoundKind.Local) 1935top.Item1.Kind == BoundKind.Local && 2070if (child.Kind != BoundKind.BinaryOperator || child.ConstantValueOpt != null) 2086if (child.Kind != BoundKind.BinaryOperator || child.ConstantValueOpt != null) 2298if (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)
1201Debug.Assert(highestBoundNode.Kind != BoundKind.UnboundLambda); 1743switch (boundInnerLambdaOrQuery.Kind) 1772switch (node.Kind) 1790while (receiver?.Kind == BoundKind.MethodGroup) 1857if (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)
615(init.Kind == BoundKind.FieldEqualsValue) && !((BoundFieldEqualsValue)init).Field.IsMetadataConstant)); 1325if (processedInitializers.LoweredInitializers.Kind == BoundKind.StatementList) 1958switch (methodBody.Kind) 2000throw 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); 1870if (pend.Branch.Kind != BoundKind.YieldReturnStatement) 2130if (expr.Kind != BoundKind.PropertyAccess) 2163var refKind = node.Left.Kind == BoundKind.BadExpression 2244receiverOpt.Kind != BoundKind.TypeExpression && 2425var childKind = child.Kind; 2465switch (binary.Kind) 2476throw ExceptionUtilities.UnexpectedValue(binary.Kind); 2485switch (binary.Kind) 2498throw ExceptionUtilities.UnexpectedValue(binary.Kind); 2504Debug.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) 2462if (pending.Branch.Kind == BoundKind.ReturnStatement) 2536if (initializer.Kind == BoundKind.AddressOfOperator) 2607switch (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 (32)
437private bool IsAnalyzingAttribute => methodMainNode.Kind == BoundKind.Attribute; 548Debug.Assert(expression != null || placeholder.Kind == BoundKind.InterpolatedStringArgumentPlaceholder); 567switch (placeholder.Kind) 583throw ExceptionUtilities.UnexpectedValue(placeholder.Kind); 2042switch (expr.Kind) 2091receiver.Kind != BoundKind.TypeExpression && 2117switch (node.Kind) 2586switch (expr.Kind) 3113if (!expr.IsSuppressed && RemoveConversion(expr, includeExplicitConversions: false).expression.Kind != BoundKind.ThrowExpression) 4175Debug.Assert(node.Kind is BoundKind.ObjectCreationExpression or BoundKind.DynamicObjectCreationExpression or BoundKind.NewT or BoundKind.NoPiaObjectCreationExpression); 4266switch (initializer.Kind) 4281switch (initializer.Kind) 4294ExceptionUtilities.UnexpectedValue(node.Kind); 4311switch (left.Kind) 4984if (child.Kind == BoundKind.ArrayInitialization) 5605switch (operand.Kind) 5801while (possiblyConversion.Kind == BoundKind.Conversion) 7744return (argument.Kind == BoundKind.Lambda); 8354switch (expr.Kind) 8406if (argument.Kind == BoundKind.Lambda) 8415if (argument.Kind == BoundKind.CollectionExpression) 8540if (expr.Kind != BoundKind.Conversion) 8623switch (value.Kind) 9463if (operandType.Type?.IsTupleType == true || conversionOperand.Kind == BoundKind.TupleLiteral) 10466if (left.Kind == BoundKind.EventAccess && ((BoundEventAccess)left).EventSymbol.IsWindowsRuntimeEvent) 10884switch (expr.Kind) 10902switch (expr.Kind) 11249if (initializer.Kind == BoundKind.AddressOfOperator) 11255if (node.Expression.Kind == BoundKind.AddressOfOperator) 11527if (node.Expression.Kind != BoundKind.Conversion) 12082throw ExceptionUtilities.UnexpectedValue(binary.Kind); 12097throw 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)
583throw ExceptionUtilities.UnexpectedValue(p.Evaluation.Kind); 660throw ExceptionUtilities.UnexpectedValue(test.Kind); 719throw ExceptionUtilities.UnexpectedValue(dagNode.Kind); 858_ => 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)
8858switch (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) 1114throw ExceptionUtilities.UnexpectedValue(expr.Kind); 1120RoslynDebug.Assert(expr is not BoundValuePlaceholderBase, $"Placeholder kind {expr.Kind} must be handled explicitly"); 1277RoslynDebug.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) 94switch (rewrittenLeft.Kind) 173switch (rewrittenLeft.Kind) 177throw ExceptionUtilities.UnexpectedValue(rewrittenLeft.Kind); 241if (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); 567switch (current.Kind) 889var u => throw ExceptionUtilities.UnexpectedValue(u.Kind) 1568if (argument.Kind == BoundKind.Local) 1657if (argument.Kind == BoundKind.Local)
Lowering\LocalRewriter\LocalRewriter_CompoundAssignmentOperator.cs (7)
99if (node.Left.Kind == BoundKind.DynamicMemberAccess && 261Debug.Assert(receiverOpt.Kind != BoundKind.TypeExpression); 560Debug.Assert(receiver.Kind != BoundKind.TypeExpression); 670switch (originalLHS.Kind) 822throw ExceptionUtilities.UnexpectedValue(originalLHS.Kind); 921switch (expression.Kind) 963switch (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)
497if (node.LengthOrCountAccess.Kind is not BoundKind.Local || receiver.Kind is not (BoundKind.Local or BoundKind.Parameter)) 539if (makeOffsetInput.ConstantValueOpt is null && lengthAccess.Kind is not BoundKind.ArrayLength) 799if (node.LengthOrCountAccess.Kind is not BoundKind.Local || receiver.Kind is not (BoundKind.Local or BoundKind.Parameter)) 950if ((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)
90Debug.Assert(!_inExpressionLambda && lhsRead.Kind != BoundKind.PropertyAccess); 94if (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) 633switch (expression.Kind) 1009switch (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. 611if (newList[i].Kind == SpillSequenceBuilderKind) 872switch (left.Kind)
Lowering\StateMachineRewriter\IteratorAndAsyncCaptureWalker.cs (1)
297if (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)
401if (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