760 references to Kind
Microsoft.CodeAnalysis.CSharp (733)
Binder\Binder.cs (1)
862RoslynDebug.Assert(statement.Kind != BoundKind.StatementList);
Binder\Binder.ValueChecks.cs (31)
385switch (expr.Kind) 442if (expr.Kind == BoundKind.MethodGroup && valueKind != BindValueKind.RValueOrMethodGroup) 467if ((object)otherSymbol != null && receiver?.Kind == BoundKind.TypeOrValueExpression) 504switch (expression?.Kind) 507case BoundKind.QueryClause when ((BoundQueryClause)expression).Value.Kind == BoundKind.TypeOrValueExpression: 536switch (expr.Kind) 541case BoundKind.ImplicitIndexerAccess when ((BoundImplicitIndexerAccess)expr).IndexerOrSliceAccess.Kind == BoundKind.IndexerAccess: 562switch (expr.Kind) 726throw ExceptionUtilities.UnexpectedValue(implicitIndexer.IndexerOrSliceAccess.Kind); 760Debug.Assert(expr is not BoundValuePlaceholderBase, $"Placeholder kind {expr.Kind} should be explicitly handled"); 805switch (expr.Kind) 1398return Flags.Includes(BinderFlags.ObjectInitializerMember) && receiver.Kind == BoundKind.ObjectOrCollectionValuePlaceholder || 1562ReportDiagnosticsIfObsolete(diagnostics, setMethod, node, receiver?.Kind == BoundKind.BaseReference); 1612ReportDiagnosticsIfObsolete(diagnostics, getMethod, node, receiver?.Kind == BoundKind.BaseReference); 1695if (receiverOpt?.Kind == BoundKind.BaseReference && member.IsAbstract) 2107if (argument.Kind == BoundKind.ArgListOperator) 2934switch (expr.Kind) 3109throw ExceptionUtilities.UnexpectedValue(implicitIndexerAccess.IndexerOrSliceAccess.Kind); 3177switch (expr.Kind) 3359throw ExceptionUtilities.UnexpectedValue(implicitIndexerAccess.IndexerOrSliceAccess.Kind); 3492switch (expr.Kind) 3660throw ExceptionUtilities.UnexpectedValue(implicitIndexerAccess.IndexerOrSliceAccess.Kind); 3811Debug.Assert(false, $"{expr.Kind} expression of {expr.Type} type"); 3832if (expression.Kind == BoundKind.AssignmentOperator) 3899switch (expr.Kind) 4108throw ExceptionUtilities.UnexpectedValue(implicitIndexerAccess.IndexerOrSliceAccess.Kind); 4289Debug.Assert(false, $"{expr.Kind} expression of {expr.Type} type"); 4438if (expression.Kind == BoundKind.AssignmentOperator) 4525throw ExceptionUtilities.UnexpectedValue(expression.Kind); 4593switch (expression.Kind) 4799fieldAccess.ReceiverOpt.Kind == BoundKind.ThisReference;
Binder\Binder_Attributes.cs (2)
907switch (assignment.Left.Kind) 957switch (node.Kind)
Binder\Binder_Await.cs (4)
78if (expression.Kind != BoundKind.Call || 340if (getAwaiterCall.Kind != BoundKind.Call) 378if (qualified.Kind != BoundKind.PropertyAccess) 446if (getAwaiterGetResultCall.Kind != BoundKind.Call)
Binder\Binder_Conversions.cs (11)
135if (conversion.IsAnonymousFunction && source.Kind == BoundKind.UnboundLambda) 211if (source.Kind == BoundKind.UnconvertedSwitchExpression) 233if (source.Kind == BoundKind.UnconvertedConditionalOperator) 648Debug.Assert(source.Kind is BoundKind.MethodGroup or BoundKind.UnboundLambda); 655if (source.Kind == BoundKind.UnboundLambda && 664source.Kind == BoundKind.MethodGroup && 1003if (node.Kind != BoundKind.MethodGroup) 1144if (receiverOpt.Kind == BoundKind.QueryClause) 1245while (receiverOpt.Kind == BoundKind.QueryClause) 1250return receiverOpt.Kind == BoundKind.TypeExpression; 1260switch (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) 792if (expression == null && checkedVariable.Kind != BoundKind.DiscardExpression)
Binder\Binder_Expressions.cs (39)
197BoundKind exprKind = expr.Kind; 251if (valueOrType.Kind == BoundKind.TypeExpression) 399Debug.Assert(expr.Kind is BoundKind.UnboundLambda or BoundKind.MethodGroup); 520if (expr.Kind == BoundKind.ArgListOperator) 2514if (operand.Kind == BoundKind.UnboundLambda) 2561switch (operand.Kind) 2852switch (arg.Kind) 3188else if (argument.Kind == BoundKind.OutVariablePendingInference) 3193else if (argument.Kind == BoundKind.OutDeconstructVarPendingInference) 3198else if (argument.Kind == BoundKind.DiscardExpression && !argument.HasExpressionType()) 4579else if (argument.Kind == BoundKind.MethodGroup) 4958if (boundMember.Kind == BoundKind.PropertyGroup) 5001BoundKind boundMemberKind = boundMember.Kind; 5526if (addMethodInvocation.Kind == BoundKind.DynamicInvocation) 5537else if (addMethodInvocation.Kind == BoundKind.Call) 5566Debug.Assert(addMethodInvocation.Kind == BoundKind.BadExpression); 5899switch (classCreation.Kind) 5912throw ExceptionUtilities.UnexpectedValue(classCreation.Kind); 6384if (boundValue.Kind == BoundKind.Conversion) 6574if (boundLeft.Kind == BoundKind.UnboundLambda) 6619switch (boundLeft.Kind) 6651if (boundLeft.Kind == BoundKind.Literal && ((BoundLiteral)boundLeft).ConstantValueOpt == ConstantValue.Null) 6822switch (expr.Kind) 6879bool leftIsBaseReference = boundLeft.Kind == BoundKind.BaseReference; 6970if (boundLeft.HasAnyErrors && boundLeft.Kind != BoundKind.TypeOrValueExpression) 6992else if (boundLeft.Kind == BoundKind.TypeExpression || 6993boundLeft.Kind == BoundKind.BaseReference || 7208ReportDiagnosticsIfObsolete(diagnostics, symbol, node, hasBaseReceiver: left.Kind == BoundKind.BaseReference); 7596ReportDiagnosticsIfObsolete(diagnostics, propertySymbol, node, hasBaseReceiver: receiver?.Kind == BoundKind.BaseReference); 7689switch (receiver.Kind) 7880if (receiver.Kind == BoundKind.PropertyGroup) 8056if (index.Kind == BoundKind.OutVariablePendingInference) 8060else if (index.Kind == BoundKind.DiscardExpression && !index.HasExpressionType()) 8248LookupOptions lookupOptions = expr.Kind == BoundKind.BaseReference ? LookupOptions.UseBaseReferenceAccessibility : LookupOptions.Default; 8362BoundKind receiverKind = receiver.Kind; 8484ReportDiagnosticsIfObsolete(diagnostics, property, syntax, hasBaseReceiver: receiver != null && receiver.Kind == BoundKind.BaseReference); 8493if (!gotError && receiver != null && receiver.Kind == BoundKind.ThisReference && receiver.WasCompilerGenerated) 9352if (access.Kind == BoundKind.MethodGroup) 9511if (receiver.Kind == BoundKind.UnboundLambda)
Binder\Binder_Initializers.cs (2)
268if (statement.Kind == BoundKind.LabeledStatement) 271while (labeledStatementBody.Kind == BoundKind.LabeledStatement)
Binder\Binder_InterpolatedString.cs (1)
425_ => throw ExceptionUtilities.UnexpectedValue(unconvertedExpression.Kind)
Binder\Binder_Invocation.cs (28)
98if (!allowFieldsAndProperties && (boundExpression.Kind == BoundKind.FieldAccess || boundExpression.Kind == BoundKind.PropertyAccess)) 102if (boundExpression.Kind == BoundKind.FieldAccess) 127Debug.Assert(!args.Any(static e => e.Kind == BoundKind.OutVariablePendingInference || 128e.Kind == BoundKind.OutDeconstructVarPendingInference || 129e.Kind == BoundKind.DiscardExpression && !e.HasExpressionType())); 142if (queryClause != null && result.Kind == BoundKind.DynamicInvocation) 182string name = boundExpression.Kind == BoundKind.MethodGroup ? GetName(node.Expression) : null; 201if (argument.Kind == BoundKind.OutVariablePendingInference) 268else if (boundExpression.Kind == BoundKind.MethodGroup) 315if (expression.Kind == BoundKind.MethodGroup) 323switch (receiver.Kind) 477if (arg.Kind == BoundKind.Lambda || arg.Kind == BoundKind.UnboundLambda) 483else if (arg.Kind == BoundKind.MethodGroup) 489else if (arg.Kind == BoundKind.ArgListOperator) 876switch (expression.Kind) 892else if (call.ReceiverOpt.Kind == BoundKind.BaseReference && this.ContainingType.IsRestrictedType()) 916throw ExceptionUtilities.UnexpectedValue(expression.Kind); 1093if (!gotError && method.RequiresInstanceReceiver && receiver != null && receiver.Kind == BoundKind.ThisReference && receiver.WasCompilerGenerated) 1109bool hasBaseReceiver = receiver != null && receiver.Kind == BoundKind.BaseReference; 1526switch (receiver.Kind) 1579if ((object)expr != null && expr.Kind != BoundKind.TypeExpression) 1693switch (argument.Kind) 1723if (argument.Kind == BoundKind.OutVariablePendingInference) 1734else if (argument.Kind == BoundKind.DiscardExpression) 1843var originalMethods = (expr.Kind == BoundKind.MethodGroup) ? ((BoundMethodGroup)expr).Methods : ImmutableArray<MethodSymbol>.Empty; 1891if (!boundArgument.HasAnyErrors && syntaxIsOk && boundArgument.Kind == BoundKind.MethodGroup)
Binder\Binder_Operators.cs (17)
33if (left.Kind == BoundKind.EventAccess) 99if (left.Kind == BoundKind.EventAccess && !CheckEventValueKind((BoundEventAccess)left, BindValueKind.Assignable, diagnostics)) 241Debug.Assert(left.Kind != BoundKind.EventAccess || hasError); 474if (result.Kind == BoundKind.TypeExpression 479else if (result.Kind == BoundKind.BadExpression) 754_ => throw ExceptionUtilities.UnexpectedValue(current.Right.Kind) 803switch (left.Kind, right.Kind) 1915if (left.Kind == BoundKind.Conversion && right.Kind == BoundKind.Conversion) 2413switch (expr.Kind) 2537BoundKind exprKind = expr.Kind; 3114switch (operand.Kind) 3246operand.Kind == BoundKind.MethodGroup || 3633switch (operand.Kind) 3941if (leftOperand.Kind == BoundKind.UnboundLambda || leftOperand.Kind == BoundKind.MethodGroup)
Binder\Binder_Patterns.cs (6)
508wasExpression = expression.Kind != BoundKind.TypeExpression; 515Debug.Assert(expression is { Kind: BoundKind.TypeExpression, Type: { } }); 537wasExpression = expression.Kind switch { BoundKind.BadExpression => false, BoundKind.TypeExpression => false, _ => true }; 677if (convertedExpression.Kind == BoundKind.Conversion) 1552if (boundMember.Kind == BoundKind.PropertyGroup) 1560switch (boundMember.Kind)
Binder\Binder_Query.cs (7)
923while (ultimateReceiver.Kind == BoundKind.QueryClause) 946else if (ultimateReceiver.Kind == BoundKind.NamespaceExpression) 950else if (ultimateReceiver.Kind == BoundKind.Lambda || ultimateReceiver.Kind == BoundKind.UnboundLambda) 955else if (ultimateReceiver.Kind == BoundKind.MethodGroup) 976else if (ultimateReceiver.Kind == BoundKind.TypeExpression) 984else if (ultimateReceiver.Kind == BoundKind.TypeOrValueExpression)
Binder\Binder_QueryErrors.cs (1)
220if (arg.Kind == BoundKind.UnboundLambda)
Binder\Binder_Statements.cs (25)
151(result.Kind == BoundKind.Block && 895BoundExpression expression = value.Kind is BoundKind.UnboundLambda or BoundKind.MethodGroup ? 1254switch (initializerOpt.Kind) 1437bool discardAssignment = op1.Kind == BoundKind.DiscardExpression; 1503if (op1.Kind != BoundKind.DynamicIndexerAccess && 1504op1.Kind != BoundKind.DynamicMemberAccess && 1505op1.Kind != BoundKind.DynamicObjectInitializerMember) 1520if ((op1.Kind == BoundKind.EventAccess) && 1577else if (op1.Kind is BoundKind.Local or BoundKind.Parameter) 1589Debug.Assert(op1.Kind != BoundKind.Parameter); // If the assert fails, add a corresponding test. 1641switch (expr.Kind) 1674throw ExceptionUtilities.UnexpectedValue(implicitIndexerAccess.IndexerOrSliceAccess.Kind); 1725_ => throw ExceptionUtilities.UnexpectedValue(e.Kind) 1781(propertyIsStatic || receiver.Kind == BoundKind.ThisReference); 1798else if (receiver.Kind == BoundKind.BaseReference) 1923if (expression.HasAnyErrors && expression.Kind != BoundKind.UnboundLambda) 2284switch (operand.Kind) 2400Debug.Assert(operand.HasAnyErrors && operand.Kind != BoundKind.UnboundLambda, "Missing a case in implicit conversion error reporting"); 2582if (expr.Kind == BoundKind.AssignmentOperator) 2585if (assignment.Right.Kind == BoundKind.Literal && assignment.Right.ConstantValueOpt.Discriminator == ConstantValueTypeDiscriminator.Boolean) 3333if (expression.Kind == BoundKind.DelegateCreationExpression || expression.Kind == BoundKind.NameOfOperator) 3361if ((refKind != RefKind.None) != (returnRefKind != RefKind.None) && expression.Kind != BoundKind.ThrowExpression) 4020if (boundAccess.Kind != BoundKind.MethodGroup) 4046if (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)
311throw ExceptionUtilities.UnexpectedValue(pattern.Kind); 912throw ExceptionUtilities.UnexpectedValue(n.Kind); 1012throw ExceptionUtilities.UnexpectedValue(n?.Kind); 1702return $"t{tempIdentifier(a)}={a.Kind}({tempName(a.Input)} as {a.Type})"; 1704return $"t{tempIdentifier(e)}={e.Kind}({tempName(e.Input)}.{e.Field.Name})"; 1706return $"t{tempIdentifier(e)}={e.Kind}({tempName(e.Input)}.{e.Property.Name})"; 1708return $"t{tempIdentifier(e)}={e.Kind}({tempName(e.Input)}[{e.Index}])"; 1710return $"{e.Kind}({tempName(e.Target)}<--{tempName(e.Input)})"; 1712return $"t{tempIdentifier(e)}={e.Kind}({tempName(e.Input)})"; 1714return $"?{d.Kind}({tempName(d.Input)} is {b.Type})"; 1716return $"?{d.Kind}({tempName(d.Input)} == {v.Value})"; 1726return $"?{d.Kind}({tempName(d.Input)} {operatorName} {r.Value})"; 1728return $"?{d.Kind}({tempName(d.Input)})"; 2277if (RemainingTests[0] is One { Test: { Kind: BoundKind.DagNonNullTest } planA }) 2284case One { Test: { Kind: BoundKind.DagTypeTest } planB1 }: 2291case One { Test: { Kind: BoundKind.DagValueTest } planB2 }:
Binder\DecisionDagBuilder_ListPatterns.cs (1)
18list.Subpatterns.Count(p => p.Kind == BoundKind.SlicePattern) == (list.HasSlice ? 1 : 0) &&
Binder\ForEachLoopBinder.cs (1)
378if (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)
485if (node.Left.Kind != BoundKind.DiscardExpression)
Binder\Semantics\Conversions\ConversionsBase.cs (4)
1022switch (sourceExpression.Kind) 1335if (sourceExpression.Kind == BoundKind.TupleLiteral) 1570if (source.Kind != BoundKind.UnboundLambda) 1803if (sourceExpressionOpt?.Kind == BoundKind.TupleLiteral)
Binder\Semantics\Operators\BinaryOperatorOverloadResolution.cs (1)
456&& nonDelegate.Kind == BoundKind.UnboundLambda)
Binder\Semantics\OverloadResolution\MethodGroup.cs (1)
112if (this.Receiver.Kind == BoundKind.TypeExpression)
Binder\Semantics\OverloadResolution\MethodTypeInference.cs (12)
607if (argument.Kind == BoundKind.UnboundLambda && target.Type.GetDelegateType() is { }) 612else if (argument.Kind != BoundKind.TupleLiteral || 787if (argument.Kind == BoundKind.TupleLiteral && (object)argument.Type == null) 904if ((isFunctionPointer && argument.Kind != BoundKind.UnconvertedAddressOfOperator) || 905(!isFunctionPointer && argument.Kind is not (BoundKind.UnboundLambda or BoundKind.MethodGroup))) 960if ((isFunctionPointer && argument.Kind != BoundKind.UnconvertedAddressOfOperator) || 961(!isFunctionPointer && argument.Kind is not (BoundKind.UnboundLambda or BoundKind.MethodGroup))) 1329if (source.Kind is not (BoundKind.MethodGroup or BoundKind.UnconvertedAddressOfOperator)) 1340if (delegateOrFunctionPointerType.IsFunctionPointer() != (source.Kind == BoundKind.UnconvertedAddressOfOperator)) 1436if (source.Kind != BoundKind.UnboundLambda) 1490if (source.Kind != BoundKind.UnboundLambda) 2881if (source.Kind != BoundKind.UnboundLambda)
Binder\Semantics\OverloadResolution\OverloadResolution.cs (13)
1747var argumentKind = arguments[i].Kind; 1891var argumentKind = arguments[i].Kind; 2057if (arguments[i].Kind == BoundKind.ArgListOperator) 2149if (arguments[i].Kind != BoundKind.ArgListOperator) 2436var nodeKind = node.Kind; 2524if (node.Kind == BoundKind.TupleLiteral) 2540if (node.Kind == BoundKind.UnboundLambda && 2580if (lambda.Body.Statements[0].Kind == BoundKind.ReturnStatement) 2846if (node?.Kind == BoundKind.MethodGroup) 3648if (argument.Kind == BoundKind.ArgListOperator) 3791if (argument.Kind == BoundKind.OutVariablePendingInference || 3792argument.Kind == BoundKind.OutDeconstructVarPendingInference || 3793(argument.Kind == BoundKind.DiscardExpression && (object)argType == null))
Binder\Semantics\OverloadResolution\OverloadResolutionResult.cs (12)
638if (receiverOpt?.Kind == BoundKind.QueryClause) 1046if (argument.Kind == BoundKind.UnboundLambda) 1173argument.Kind != BoundKind.OutDeconstructVarPendingInference && 1174argument.Kind != BoundKind.OutVariablePendingInference && 1175argument.Kind != BoundKind.DiscardExpression) 1181if (argument.Kind == BoundKind.UnboundLambda && refArg == refParameter) 1185else if (argument.Kind == BoundKind.MethodGroup && parameterType.TypeKind == TypeKind.Delegate && 1190else if (argument.Kind == BoundKind.MethodGroup && parameterType.TypeKind == TypeKind.FunctionPointer) 1194else if (argument.Kind == BoundKind.UnconvertedAddressOfOperator && 1238Debug.Assert(argument.Kind != BoundKind.OutDeconstructVarPendingInference); 1239Debug.Assert(argument.Kind != BoundKind.OutVariablePendingInference); 1240Debug.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)
36throw ExceptionUtilities.UnexpectedValue(node.Kind); 199return this.TopologicallySortedNodes.Any(static node => node is BoundEvaluationDecisionDagNode e && e.Evaluation.Kind == BoundKind.DagAssignmentEvaluation);
BoundTree\BoundExpression.cs (5)
37if ((Kind != BoundKind.Local && Kind != BoundKind.Parameter) || this.WasConverted) 55switch (Kind) 543return this.Condition.Kind == BoundKind.UnaryOperator && ((BoundUnaryOperator)this.Condition).OperatorKind.IsDynamic(); 671if (argument.Kind == BoundKind.TupleLiteral)
BoundTree\BoundExpressionExtensions.cs (9)
22switch (node.Kind) 65return node is { Kind: BoundKind.Literal, ConstantValueOpt: { Discriminator: ConstantValueTypeDiscriminator.Null } }; 70return node.Kind == BoundKind.DefaultLiteral; 75return node.Kind == BoundKind.UnconvertedObjectCreationExpression; 91if (node.Kind == BoundKind.DefaultExpression || node.Kind == BoundKind.DefaultLiteral) 119Debug.Assert(expr.Kind is BoundKind.MethodGroup or BoundKind.UnboundLambda); 152switch (node.Kind) 224switch (boundNode.Kind)
BoundTree\BoundMethodGroup.cs (1)
61if (this.ReceiverOpt == null || this.ReceiverOpt.Kind == BoundKind.TypeExpression)
BoundTree\BoundNode_Source.cs (1)
341appendLine(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 (2)
114if (child.Kind != BoundKind.BinaryOperator) 129if (child.Kind != BoundKind.BinaryOperator)
BoundTree\BoundTreeVisitors.cs (1)
31switch (node.Kind)
BoundTree\BoundTreeWalker.cs (2)
106if (node.Left.Kind != BoundKind.BinaryOperator) 121while (current.Kind == BoundKind.BinaryOperator)
BoundTree\Constructors.cs (1)
67switch (receiver.Kind)
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)
66_ => throw ExceptionUtilities.UnexpectedValue(currentBinary.Kind),
CodeGen\EmitAddress.cs (4)
28switch (expression.Kind) 89throw ExceptionUtilities.UnexpectedValue(expression.Kind); 350switch (value.Kind) 525if (receiver.Kind != BoundKind.ConditionalReceiver)
CodeGen\EmitArrayInitializer.cs (4)
345if (inits[0].Kind == BoundKind.ArrayInitialization) 367Debug.Assert(inits.All((init) => init.Kind != BoundKind.ArrayInitialization) || 368inits.All((init) => init.Kind == BoundKind.ArrayInitialization), 371return inits.Length != 0 && inits[0].Kind == BoundKind.ArrayInitialization;
CodeGen\EmitExpression.cs (30)
95switch (expression.Kind) 169throw ExceptionUtilities.UnexpectedValue(expression.Kind); 347Debug.Assert(expression.Kind != BoundKind.BadExpression); 350throw ExceptionUtilities.UnexpectedValue(expression.Kind); 429(receiver.Kind == BoundKind.Local && IsStackLocal(((BoundLocal)receiver).LocalSymbol)) || 845Debug.Assert(sequence.Value.Kind != BoundKind.TypeExpression || !used); 846if (sequence.Value.Kind != BoundKind.TypeExpression) 973Debug.Assert(arguments[i].Kind == BoundKind.ArgListOperator); 1191else if (receiver.Kind == BoundKind.Conversion) 1202else if (receiver.Kind == BoundKind.FieldAccess) 1233if (receiver.Kind == BoundKind.Conversion && ((BoundConversion)receiver).ConversionKind == ConversionKind.Unboxing) 1244switch (receiver.Kind) 1476Debug.Assert(receiver.Kind != BoundKind.BaseReference, "base should always use call"); 1485switch (receiver.Kind) 1558switch (receiver.Kind) 1606Debug.Assert(receiver.Kind == BoundKind.ThisReference); 1908switch (current.Kind) 1991switch (receiver.Kind) 2403if (objCreation.Arguments.Length > 0 && objCreation.Arguments[0].Kind == BoundKind.ConvertedStackAllocExpression) 2437if (left.Kind == BoundKind.ArrayAccess && left.Type.TypeKind == TypeKind.TypeParameter && !left.Type.IsValueType) 2442if (left.Kind == BoundKind.FieldAccess) 2537switch (left.Kind) 2556switch (assignmentTarget.Kind) 2736throw ExceptionUtilities.UnexpectedValue(assignmentTarget.Kind); 2757throw ExceptionUtilities.UnexpectedValue(assignmentTarget.Kind); 2786Debug.Assert(lhs.Kind != BoundKind.Parameter || exprTempsAfter <= exprTempsBefore); 2788if (lhs.Kind == BoundKind.Local && ((BoundLocal)lhs).LocalSymbol.SynthesizedKind.IsLongLived()) 2844switch (expression.Kind) 2944throw ExceptionUtilities.UnexpectedValue(expression.Kind); 3642switch (expr.Kind)
CodeGen\EmitOperators.cs (4)
94if (child.Kind != BoundKind.BinaryOperator || child.ConstantValueOpt != null) 118if (child.Kind != BoundKind.BinaryOperator || child.ConstantValueOpt != null) 474while (condition.Kind == BoundKind.UnaryOperator) 493if (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)) || 1110while (exceptionSource.Kind == BoundKind.Sequence) 1118switch (exceptionSource.Kind) 1157throw ExceptionUtilities.UnexpectedValue(exceptionSource.Kind); 1239if (expression.Kind == BoundKind.Sequence) 1247if (expression.Kind == BoundKind.SequencePointExpression) 1254switch (expression.Kind)
CodeGen\Optimizer.cs (18)
451Debug.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) 1358if (boundExpression.Kind == BoundKind.Local) 1410if (child.Kind != BoundKind.BinaryOperator || child.ConstantValueOpt != null) 1426if (child.Kind != BoundKind.BinaryOperator || child.ConstantValueOpt != null) 1630if (exceptionSourceOpt.Kind == BoundKind.Local) 1869top.Item1.Kind == BoundKind.Local && 2004if (child.Kind != BoundKind.BinaryOperator || child.ConstantValueOpt != null) 2020if (child.Kind != BoundKind.BinaryOperator || child.ConstantValueOpt != null) 2176if (exceptionSource.Kind == BoundKind.Local)
Compilation\CSharpSemanticModel.cs (14)
1945else if (highestBoundExpr.Kind == BoundKind.TypeOrValueExpression) 1951else if (highestBoundExpr.Kind == BoundKind.UnaryOperator) 2106var highestBoundExprKind = highestBoundExpr?.Kind ?? BoundKind.NoOpStatement; 2127if (tupleLiteralConversion.Operand.Kind == BoundKind.ConvertedTupleLiteral) 2193else if (((BoundConversion)highestBoundExpr).Operand.Kind != BoundKind.Conversion) 2211else if (boundNodeForSyntacticParent?.Kind == BoundKind.DelegateCreationExpression) 2216switch (boundExpr.Kind) 2298if (boundExpr != null && boundExpr.Kind != BoundKind.TypeExpression) 3348switch (boundNode.Kind) 3392boundNodeForSyntacticParent.Kind == BoundKind.BadExpression && 3968switch (boundNodeForSyntacticParent.Kind) 3994throw ExceptionUtilities.UnexpectedValue(boundNodeForSyntacticParent.Kind); 4244switch (boundNodeForSyntacticParent.Kind) 4386switch (boundNodeForSyntacticParent.Kind)
Compilation\MemberSemanticModel.cs (5)
1191Debug.Assert(highestBoundNode.Kind != BoundKind.UnboundLambda); 1733switch (boundInnerLambdaOrQuery.Kind) 1762switch (node.Kind) 1780while (receiver?.Kind == BoundKind.MethodGroup) 1847if (expr.Kind == BoundKind.QueryClause)
Compilation\MemberSemanticModel.NodeMapBuilder.cs (7)
85if (existing[i].Kind != added[i].Kind) 90if (existing[i].Kind == BoundKind.TypeExpression && added[i].Kind == BoundKind.TypeOrValueExpression) 98else if (existing[i].Kind == BoundKind.TypeOrValueExpression && added[i].Kind == BoundKind.TypeExpression) 170if (node.Kind == BoundKind.UnboundLambda)
Compiler\MethodBodySynthesizer.Lowered.cs (1)
333if (body.Kind != BoundKind.Block) body = F.Block(body);
Compiler\MethodCompiler.cs (4)
597(init.Kind == BoundKind.FieldEqualsValue) && !((BoundFieldEqualsValue)init).Field.IsMetadataConstant)); 1335if (processedInitializers.LoweredInitializers.Kind == BoundKind.StatementList) 1883switch (methodBody.Kind) 1925throw ExceptionUtilities.UnexpectedValue(methodBody.Kind);
FlowAnalysis\AbstractFlowPass.cs (13)
555switch (node?.Kind) 840switch (node.Kind) 865throw ExceptionUtilities.UnexpectedValue(node.Kind); 890Debug.Assert(false, $"Should Visit{node.Kind} be overridden in {this.GetType().Name}?"); 1006throw ExceptionUtilities.UnexpectedValue(pattern.Kind); 1048throw ExceptionUtilities.UnexpectedValue(pattern.Kind); 1723if (pend.Branch.Kind != BoundKind.YieldReturnStatement) 1951if (expr.Kind != BoundKind.PropertyAccess) 1984var refKind = node.Left.Kind == BoundKind.BadExpression 2065receiverOpt.Kind != BoundKind.TypeExpression && 2227var childKind = child.Kind; 2265switch (binary.Kind) 2278throw ExceptionUtilities.UnexpectedValue(binary.Kind);
FlowAnalysis\ControlFlowPass.cs (3)
214switch (pending.Branch.Kind) 242switch (statement.Kind) 304switch (branch.Branch.Kind)
FlowAnalysis\DataFlowsOutWalker.cs (2)
118switch (node.Kind) 239switch (node.Kind)
FlowAnalysis\DefiniteAssignment.cs (21)
242if (node.Kind == BoundKind.Attribute) 428BoundKind kind = pendingBranch.Kind; 764Debug.Assert(fieldOrEventAccess.Kind == BoundKind.FieldAccess || fieldOrEventAccess.Kind == BoundKind.EventAccess); 768switch (n.Kind) 891if (value is { ConstantValueOpt: not null, Kind: not BoundKind.InterpolatedString }) return false; 893switch (value.Kind) 928switch (n.Kind) 942if (n.Kind == BoundKind.Local) 1026switch (expr.Kind) 1080receiver.Kind != BoundKind.TypeExpression && 1097receiverOpt.Kind != BoundKind.TypeExpression && 1321switch (node.Kind) 1418switch (expression.Kind) 1466switch (node.Kind) 1865switch (pattern.Kind) 1967throw ExceptionUtilities.UnexpectedValue(pattern.Kind); 2037if (stmt.Kind != BoundKind.LocalFunctionStatement) 2285if (pending.Branch.Kind == BoundKind.ReturnStatement) 2359if (initializer.Kind == BoundKind.AddressOfOperator) 2430switch (expr.Kind)
FlowAnalysis\ExitPointsWalker.cs (2)
125switch (pending.Branch.Kind) 148throw ExceptionUtilities.UnexpectedValue(pending.Branch.Kind);
FlowAnalysis\LocalDataFlowPass.cs (1)
208switch (node.Kind)
FlowAnalysis\NullableWalker.cs (35)
398private bool IsAnalyzingAttribute => methodMainNode.Kind == BoundKind.Attribute; 506Debug.Assert(expression != null || placeholder.Kind == BoundKind.InterpolatedStringArgumentPlaceholder); 525switch (placeholder.Kind) 541throw ExceptionUtilities.UnexpectedValue(placeholder.Kind); 1896switch (expr.Kind) 1945receiver.Kind != BoundKind.TypeExpression && 1971switch (node.Kind) 2245(value.WasCompilerGenerated && assignmentKind == AssignmentKind.Argument && value.Kind != BoundKind.InterpolatedStringArgumentPlaceholder) || 2421switch (expr.Kind) 2877if (!expr.IsSuppressed && RemoveConversion(expr, includeExplicitConversions: false).expression.Kind != BoundKind.ThrowExpression) 2992if (stmt.Kind != BoundKind.LocalFunctionStatement) 3561Debug.Assert(node.Kind is BoundKind.ObjectCreationExpression or BoundKind.DynamicObjectCreationExpression or BoundKind.NewT or BoundKind.NoPiaObjectCreationExpression); 3651switch (initializer.Kind) 3666switch (initializer.Kind) 3679ExceptionUtilities.UnexpectedValue(node.Kind); 3696switch (left.Kind) 3952Debug.Assert(node.ImplicitReceiverOpt.Kind == BoundKind.ObjectOrCollectionValuePlaceholder); 4363if (child.Kind == BoundKind.ArrayInitialization) 4885switch (operand.Kind) 5081while (possiblyConversion.Kind == BoundKind.Conversion) 6497var savedState = (argument.Kind == BoundKind.Lambda) ? this.State.Clone() : default(Optional<LocalState>); 7092switch (expr.Kind) 7145if (argument.Kind == BoundKind.Lambda) 7214if (expr.Kind != BoundKind.Conversion) 7296switch (value.Kind) 8101if (operandType.Type?.IsTupleType == true || conversionOperand.Kind == BoundKind.TupleLiteral) 9060if (left.Kind == BoundKind.EventAccess && ((BoundEventAccess)left).EventSymbol.IsWindowsRuntimeEvent) 9200switch (expr.Kind) 9476switch (expr.Kind) 9494switch (expr.Kind) 9708if (initializer.Kind == BoundKind.AddressOfOperator) 9714if (node.Expression.Kind == BoundKind.AddressOfOperator) 9954if (node.Expression.Kind != BoundKind.Conversion) 10443switch (node.Kind) 10463throw ExceptionUtilities.UnexpectedValue(node.Kind);
FlowAnalysis\NullableWalker.DebugVerifier.cs (2)
67if (overrideSkippedExpression || !s_skippedExpressions.Contains(expression.Kind)) 108if (!s_skippedExpressions.Contains(child.Kind))
FlowAnalysis\NullableWalker.SnapshotManager.cs (1)
109if (node.Kind == BoundKind.TypeExpression || node.WasCompilerGenerated)
FlowAnalysis\NullableWalker_Patterns.cs (4)
543throw ExceptionUtilities.UnexpectedValue(p.Evaluation.Kind); 620throw ExceptionUtilities.UnexpectedValue(test.Kind); 679throw ExceptionUtilities.UnexpectedValue(dagNode.Kind); 818_ => throw ExceptionUtilities.UnexpectedValue(e.Kind)
FlowAnalysis\ReadWriteWalker.cs (4)
142if (!IsInside && node.Span.Contains(RegionSpan) && (expr.Kind == BoundKind.FieldAccess)) 173switch (receiver.Kind) 216switch (node.Kind) 271switch (underlying.Kind)
FlowAnalysis\RegionAnalysisContext.cs (1)
49switch (firstInRegion.Kind)
Generated\BoundNodes.xml.Generated.cs (1)
8512switch (node.Kind)
Lowering\AsyncRewriter\AsyncMethodToStateMachineRewriter.cs (3)
313if (node.Expression.Kind == BoundKind.AwaitExpression) 317else if (node.Expression.Kind == BoundKind.AssignmentOperator) 320if (expression.Right.Kind == BoundKind.AwaitExpression)
Lowering\ClosureConversion\ClosureConversion.Analysis.cs (2)
105switch (node.Kind) 125throw ExceptionUtilities.UnexpectedValue(node.Kind);
Lowering\ClosureConversion\ClosureConversion.cs (3)
1088if (visited.Kind != BoundKind.Call) 1317if (node.Argument.Kind == BoundKind.Lambda) 1364receiver.Kind == BoundKind.TypeExpression &&
Lowering\ClosureConversion\ExpressionLambdaRewriter.cs (7)
140switch (stmt.Kind) 159throw ExceptionUtilities.UnexpectedValue(stmt.Kind); 183switch (node.Kind) 251throw ExceptionUtilities.UnexpectedValue(node.Kind); 467if (operand.Kind == BoundKind.Conversion) 708if (node.Argument.Kind == BoundKind.MethodGroup) 864switch (node.Kind)
Lowering\DiagnosticsPass_ExpressionTrees.cs (8)
242if (_inExpressionLambda && node.Left.Kind != BoundKind.ObjectInitializerMember && node.Left.Kind != BoundKind.DynamicObjectInitializerMember) 266bool hasBaseReceiver = node.ReceiverOpt != null && node.ReceiverOpt.Kind == BoundKind.BaseReference; 280bool hasBaseReceiver = node.ReceiverOpt != null && node.ReceiverOpt.Kind == BoundKind.BaseReference; 622if (current.Left.Kind == BoundKind.BinaryOperator) 688if (operand.Kind == BoundKind.FieldAccess) 781if (node.Argument.Kind != BoundKind.MethodGroup) 865if (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)
83if (rewritten.Kind == BoundKind.Block)
Lowering\Instrumentation\Instrumenter.cs (1)
292Debug.Assert(original.Kind == BoundKind.SwitchStatement);
Lowering\LocalRewriter\LocalRewriter.cs (12)
248node.Kind is not (BoundKind.ImplicitReceiver or BoundKind.ObjectOrCollectionValuePlaceholder or BoundKind.ValuePlaceholder)) 271return node.Kind == BoundKind.DeconstructionAssignmentOperator && !((BoundDeconstructionAssignmentOperator)node).IsUsed; 619if (initializer.Kind == BoundKind.Block) 756switch (initializer.Kind) 763if (initializer.Kind == BoundKind.ExpressionStatement) 771return ((BoundExpressionStatement)initializer).Expression.Kind == BoundKind.AssignmentOperator; 788if (statement.Kind != BoundKind.ExpressionStatement) 799Debug.Assert(assignment.Left.Kind == BoundKind.FieldAccess); 895switch (expr.Kind) 984throw ExceptionUtilities.UnexpectedValue(expr.Kind); 990Debug.Assert(expr is not BoundValuePlaceholderBase, $"Placeholder kind {expr.Kind} must be handled explicitly"); 1123Debug.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); 389ImmutableArray<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)
519if ((loweredInput.Kind == BoundKind.Local || loweredInput.Kind == BoundKind.Parameter) 644if (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) 174switch (rewrittenLeft.Kind) 178throw ExceptionUtilities.UnexpectedValue(rewrittenLeft.Kind); 245if (sequence.Value.Kind == BoundKind.IndexerAccess)
Lowering\LocalRewriter\LocalRewriter_BinaryOperator.cs (13)
282if (loweredRight.Kind == BoundKind.Local || loweredRight.Kind == BoundKind.Parameter) 294if (loweredRight.Kind == BoundKind.Local || loweredRight.Kind == BoundKind.Parameter) 481if (loweredLeft.Kind == BoundKind.ArrayLength && loweredRight.IsDefaultValue()) 496if (loweredRight.Kind == BoundKind.ArrayLength && loweredLeft.IsDefaultValue()) 511if (loweredLeft.Kind == BoundKind.ArrayLength && loweredRight.IsDefaultValue()) 515else if (loweredRight.Kind == BoundKind.ArrayLength && loweredLeft.IsDefaultValue()) 650if (constantLeft == null && loweredLeft.Kind != BoundKind.Local && loweredLeft.Kind != BoundKind.Parameter) 711if (expression.Kind == BoundKind.Conversion) 1527if (nonNullRight != null && nonNullRight.ConstantValueOpt != null && left.Kind == BoundKind.Sequence) 1530if (seq.Value.Kind == BoundKind.ConditionalOperator)
Lowering\LocalRewriter\LocalRewriter_Block.cs (1)
84switch (node.Kind)
Lowering\LocalRewriter\LocalRewriter_Call.cs (6)
34switch (node.Expression.Kind) 44Debug.Assert(methodGroup.ReceiverOpt == null || methodGroup.ReceiverOpt.Kind != BoundKind.TypeOrValueExpression); 317switch (current.Kind) 630var u => throw ExceptionUtilities.UnexpectedValue(u.Kind) 1409if (argument?.Kind == BoundKind.Local) 1499if (argument.Kind == BoundKind.Local)
Lowering\LocalRewriter\LocalRewriter_CompoundAssignmentOperator.cs (7)
41if (node.Left.Kind == BoundKind.DynamicMemberAccess && 188Debug.Assert(receiverOpt.Kind != BoundKind.TypeExpression); 472Debug.Assert(receiver.Kind != BoundKind.TypeExpression); 582switch (originalLHS.Kind) 729throw ExceptionUtilities.UnexpectedValue(originalLHS.Kind); 825switch (expression.Kind) 866switch (expression.Kind)
Lowering\LocalRewriter\LocalRewriter_Conversion.cs (4)
31_ => throw ExceptionUtilities.UnexpectedValue(node.Operand.Kind) 226switch (rewrittenNode.Kind) 1158if (operand.Kind == BoundKind.Sequence) 1161if (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)
26if (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 (4)
52Debug.Assert(original.Kind == BoundKind.ForStatement || original.Kind == BoundKind.ForEachStatement); 147switch (original.Kind) 156throw ExceptionUtilities.UnexpectedValue(original.Kind);
Lowering\LocalRewriter\LocalRewriter_IndexerAccess.cs (6)
264if (node.LengthOrCountAccess.Kind is not BoundKind.Local || receiver.Kind is not (BoundKind.Local or BoundKind.Parameter)) 305if (makeOffsetInput.ConstantValueOpt is null && lengthAccess.Kind is not BoundKind.ArrayLength) 572if (node.LengthOrCountAccess.Kind is not BoundKind.Local || receiver.Kind is not (BoundKind.Local or BoundKind.Parameter)) 725if ((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)
183if (expression.Kind != BoundKind.Call) 212while (expression.Kind == BoundKind.Conversion)
Lowering\LocalRewriter\LocalRewriter_ObjectOrCollectionInitializerExpression.cs (10)
28throw ExceptionUtilities.UnexpectedValue(initializerExpression.Kind); 63throw ExceptionUtilities.UnexpectedValue(initializerExpression.Kind); 71switch (initializerExpression.Kind) 82throw ExceptionUtilities.UnexpectedValue(initializerExpression.Kind); 99if (initializer.Kind == BoundKind.CollectionElementInitializer) 106Debug.Assert(initializer.Kind == BoundKind.DynamicCollectionElementInitializer); 280if (assignment.Left.Kind != BoundKind.PointerElementAccess) 285BoundKind rhsKind = assignment.Right.Kind; 289switch ((rewrittenLeft ?? assignment.Left).Kind) 447throw ExceptionUtilities.UnexpectedValue((rewrittenLeft ?? assignment.Left).Kind);
Lowering\LocalRewriter\LocalRewriter_StringConcat.cs (2)
156switch (lowered.Kind) 373if (expr.Kind == BoundKind.Conversion)
Lowering\LocalRewriter\LocalRewriter_StringInterpolation.cs (2)
128throw ExceptionUtilities.UnexpectedValue(part.Kind); 325if (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)
45if (node.Operand.Kind == BoundKind.BinaryOperator) 316if (loweredOperand.Kind == BoundKind.Sequence) 319if (seq.Value.Kind == BoundKind.ConditionalOperator) 482switch (expression.Kind) 845switch (transformedExpression.Kind)
Lowering\LocalRewriter\LocalRewriter_UsingStatement.cs (1)
39BoundBlock tryBlock = rewrittenBody.Kind == BoundKind.Block
Lowering\LocalRewriter\LocalRewriter_WhileStatement.cs (4)
49Debug.Assert(loop.Kind == BoundKind.WhileStatement || loop.Kind == BoundKind.ForEachStatement); 72switch (loop.Kind) 83throw ExceptionUtilities.UnexpectedValue(loop.Kind);
Lowering\LocalRewriter\LoweredDynamicOperationFactory.cs (4)
225if (loweredReceiver.Kind == BoundKind.TypeExpression) 550switch (loweredReceiver.Kind) 567throw ExceptionUtilities.UnexpectedValue(loweredReceiver.Kind); 687int discardCount = loweredArguments.Count(a => a.Kind == BoundKind.DiscardExpression);
Lowering\MethodToClassRewriter.cs (7)
70Debug.Fail($"Override the visitor for {node.Kind}"); 475if (originalLeft.Kind != BoundKind.Local) 489Debug.Assert(originalRight.Kind != BoundKind.ConvertedStackAllocExpression); 511if (rewrittenLeft.Kind != BoundKind.Local && originalRight.Kind == BoundKind.ConvertedStackAllocExpression) 723return originalReceiver is { Kind: BoundKind.BaseReference } && 724rewrittenReceiver is { Kind: not BoundKind.BaseReference };
Lowering\SpillSequenceSpiller.cs (7)
48Debug.Assert(value?.Kind != SpillSequenceBuilderKind); 248if (e == null || e.Kind != SpillSequenceBuilderKind) 315switch (expression.Kind) 353assignment is not { Left.Kind: BoundKind.Local, Right.Kind: BoundKind.ArrayAccess }) // Optimize for some known to be safe scenarios. 540if (newList[i].Kind == SpillSequenceBuilderKind) 801switch (left.Kind)
Lowering\StateMachineRewriter\IteratorAndAsyncCaptureWalker.cs (1)
269if (node.ReceiverOpt != null && node.ReceiverOpt.Kind == BoundKind.ThisReference)
Lowering\StateMachineRewriter\MethodToStateMachineRewriter.cs (6)
407if (statement.Kind == BoundKind.Block) 411if (rewrittenStatements.Length == 1 && rewrittenStatements[0].Kind == BoundKind.StateMachineScope) 550switch (expr.Kind) 585if (receiver.Kind != BoundKind.ThisReference && !isFieldOfStruct) 640throw ExceptionUtilities.UnexpectedValue(expr.Kind); 793if (node.Left.Kind != BoundKind.Local)
Lowering\SyntheticBoundNodeFactory.cs (3)
540if (body.Kind != BoundKind.Block) 1604var discardsPresent = arguments.Any(static a => a.Kind == BoundKind.DiscardExpression); 1609(arg, t) => arg.Kind == BoundKind.DiscardExpression ? t.factory.MakeTempForDiscard((BoundDiscardExpression)arg, t.builder) : arg,
Operations\CSharpOperationFactory.cs (32)
35switch (boundNode.Kind) 309switch (boundNode.Kind) 330throw ExceptionUtilities.UnexpectedValue(boundNode.Kind); 395switch (declaration.Kind) 413throw ExceptionUtilities.UnexpectedValue(declaration.Kind); 519switch (declaration.Kind) 545throw ExceptionUtilities.UnexpectedValue(declaration.Kind); 605throw ExceptionUtilities.UnexpectedValue(boundNode.Kind); 796throw ExceptionUtilities.UnexpectedValue(indexer.Kind); 811throw ExceptionUtilities.UnexpectedValue(indexer.Kind); 952if (receiver?.Kind == BoundKind.TypeExpression) 1064Debug.Assert(boundOperand.Kind == BoundKind.BadExpression || 1066ExpressionOpt?.Kind == BoundKind.BadExpression); 1076if (boundOperand.Kind == BoundKind.ConvertedTupleLiteral && TypeSymbol.Equals(boundOperand.Type, boundConversion.Type, TypeCompareKind.ConsiderEverything2)) 1090if (boundConversion.ExplicitCastInCode && conversion.IsIdentity && boundOperand.Kind == BoundKind.Conversion) 1096nestedOperand.Kind == BoundKind.ConvertedTupleLiteral && 1112if ((boundOperand.Kind == BoundKind.Lambda || 1113boundOperand.Kind == BoundKind.UnboundLambda || 1114boundOperand.Kind == BoundKind.MethodGroup) && 1260boundAssignmentOperator.Right?.Kind == BoundKind.ObjectInitializerExpression || 1261boundAssignmentOperator.Right?.Kind == BoundKind.CollectionInitializerExpression; 1408{ Kind: var kind } => throw ExceptionUtilities.UnexpectedValue(kind) 1576if (boundIndexerAccess.LengthOrCountAccess.Kind == BoundKind.ArrayLength) 2136{ Kind: var kind } => throw ExceptionUtilities.UnexpectedValue(kind) 2163if (part.Kind == BoundKind.StringInsert) 2223throw ExceptionUtilities.UnexpectedValue(part.Kind); 2239_ => throw ExceptionUtilities.UnexpectedValue(value.Kind), 2336_ => throw ExceptionUtilities.UnexpectedValue(part.Kind) 2359throw ExceptionUtilities.UnexpectedValue(current.Kind); 2422if (variable == null && boundDeclarationPattern.VariableAccess?.Kind == BoundKind.DiscardExpression) 2608Debug.Assert(boundSwitchLabel.Pattern.Kind == BoundKind.DiscardPattern); 2612boundSwitchLabel.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) 274throw ExceptionUtilities.UnexpectedValue(containingExpression.Kind); 313|| (receiverOpt.Kind != BoundKind.ThisReference 314&& receiverOpt.Kind != BoundKind.BaseReference 315&& receiverOpt.Kind != BoundKind.ObjectOrCollectionValuePlaceholder)))
Symbols\ConstantValueUtils.cs (1)
98while (unconvertedBoundValue.Kind == BoundKind.Conversion)
Symbols\FunctionTypeSymbol.cs (1)
68Debug.Assert(expression.Kind is BoundKind.MethodGroup or BoundKind.UnboundLambda);
Symbols\Source\ParameterHelpers.cs (1)
851switch (expression.Kind)
Symbols\Source\SourceComplexParameterSymbol.cs (1)
393if (convertedExpression.ConstantValueOpt == null && convertedExpression.Kind == BoundKind.Conversion &&
Microsoft.CodeAnalysis.CSharp.ExpressionEvaluator.ExpressionCompiler (6)
Rewriters\CapturedVariableRewriter.cs (1)
120var boundKind = node.Kind;
Rewriters\LocalDeclarationRewriter.cs (1)
33switch (node.Kind)
Rewriters\MayHaveSideEffectsVisitor.cs (1)
73var expr = (initializer.Kind == BoundKind.AssignmentOperator)
Symbols\EEMethodSymbol.cs (3)
543if (body.Kind != BoundKind.ReturnStatement) 737switch (bodyOpt.Kind) 746throw ExceptionUtilities.UnexpectedValue(bodyOpt.Kind);
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)
2437_builder.Add($"Yes, {expr.Kind} '{text}' requires fixing."); 2441_builder.Add(string.Concat($"No, {expr.Kind} '{text}' does not require fixing.", accessedLocalOrParameterOpt is null