Binder\Binder_Statements.cs (55)
40public virtual BoundStatement BindStatement(StatementSyntax node, BindingDiagnosticBag diagnostics)
60BoundStatement result;
165private BoundStatement BindCheckedStatement(CheckedStatementSyntax node, BindingDiagnosticBag diagnostics)
170private BoundStatement BindUnsafeStatement(UnsafeStatementSyntax node, BindingDiagnosticBag diagnostics)
186private BoundStatement BindFixedStatement(FixedStatementSyntax node, BindingDiagnosticBag diagnostics)
196private BoundStatement BindFixedStatementParts(FixedStatementSyntax node, BindingDiagnosticBag diagnostics)
207BoundStatement boundBody = BindPossibleEmbeddedStatement(node.Statement, diagnostics);
234private BoundStatement BindYieldReturnStatement(YieldStatementSyntax node, BindingDiagnosticBag diagnostics)
279private BoundStatement BindYieldBreakStatement(YieldStatementSyntax node, BindingDiagnosticBag diagnostics)
295private BoundStatement BindLockStatement(LockStatementSyntax node, BindingDiagnosticBag diagnostics)
302internal virtual BoundStatement BindLockStatementParts(BindingDiagnosticBag diagnostics, Binder originalBinder)
307private BoundStatement BindUsingStatement(UsingStatementSyntax node, BindingDiagnosticBag diagnostics)
314internal virtual BoundStatement BindUsingStatementParts(BindingDiagnosticBag diagnostics, Binder originalBinder)
319internal BoundStatement BindPossibleEmbeddedStatement(StatementSyntax node, BindingDiagnosticBag diagnostics)
434private BoundStatement BindThrow(ThrowStatementSyntax node, BindingDiagnosticBag diagnostics)
464private static BoundStatement BindEmpty(EmptyStatementSyntax node)
506var body = BindStatement(node.Statement, diagnostics);
510private BoundStatement BindGoto(GotoStatementSyntax node, BindingDiagnosticBag diagnostics)
554private BoundStatement BindLocalFunctionStatement(LocalFunctionStatementSyntax node, BindingDiagnosticBag diagnostics)
644public BoundStatement BindExpressionStatement(ExpressionStatementSyntax node, BindingDiagnosticBag diagnostics)
688internal BoundStatement BindLocalDeclarationStatement(LocalDeclarationStatementSyntax node, BindingDiagnosticBag diagnostics)
700private BoundStatement BindUsingDeclarationStatementParts(LocalDeclarationStatementSyntax node, BindingDiagnosticBag diagnostics)
702var usingDeclaration = UsingStatementBinder.BindUsingStatementOrDeclarationFromParts(node, node.UsingKeyword, node.AwaitKeyword, originalBinder: this, usingBinderOpt: null, diagnostics);
707private BoundStatement BindDeclarationStatementParts(LocalDeclarationStatementSyntax node, BindingDiagnosticBag diagnostics)
1926ArrayBuilder<BoundStatement> boundStatements = ArrayBuilder<BoundStatement>.GetInstance(nStatements);
1930var boundStatement = BindStatement(syntaxStatements[i], diagnostics);
1937private BoundBlock FinishBindBlockParts(CSharpSyntaxNode node, ImmutableArray<BoundStatement> boundStatements)
2579private BoundStatement BindIfStatement(IfStatementSyntax node, BindingDiagnosticBag diagnostics)
2583static BoundStatement bindIfStatement(Binder binder, IfStatementSyntax node, BindingDiagnosticBag diagnostics)
2585var stack = ArrayBuilder<(Binder, IfStatementSyntax IfStatementSyntax, BoundExpression Condition, BoundStatement Consequence)>.GetInstance();
2587BoundStatement? alternative;
2591var consequence = binder.BindPossibleEmbeddedStatement(node.Statement, diagnostics);
2621BoundStatement result;
2625BoundStatement consequence;
2642protected virtual bool TryGetBoundElseIfStatement(IfStatementSyntax node, out BoundStatement? alternative)
2787private BoundStatement BindSwitchStatement(SwitchStatementSyntax node, BindingDiagnosticBag diagnostics)
2794internal virtual BoundStatement BindSwitchStatementCore(SwitchStatementSyntax node, Binder originalBinder, BindingDiagnosticBag diagnostics)
2804private BoundStatement BindWhile(WhileStatementSyntax node, BindingDiagnosticBag diagnostics)
2818private BoundStatement BindDo(DoStatementSyntax node, BindingDiagnosticBag diagnostics)
2843internal BoundStatement BindForOrUsingOrFixedDeclarations(VariableDeclarationSyntax nodeOpt, LocalDeclarationKind localKind, BindingDiagnosticBag diagnostics, out ImmutableArray<BoundLocalDeclaration> declarations)
2900(BoundStatement)declarations[0] :
2904internal BoundStatement BindStatementExpressionList(SeparatedSyntaxList<ExpressionSyntax> statements, BindingDiagnosticBag diagnostics)
2918var statementBuilder = ArrayBuilder<BoundStatement>.GetInstance();
2929private BoundStatement BindForEach(CommonForEachStatementSyntax node, BindingDiagnosticBag diagnostics)
2935internal virtual BoundStatement BindForEachParts(BindingDiagnosticBag diagnostics, Binder originalBinder)
2943internal virtual BoundStatement BindForEachDeconstruction(BindingDiagnosticBag diagnostics, Binder originalBinder)
2948private BoundStatement BindBreak(BreakStatementSyntax node, BindingDiagnosticBag diagnostics)
2959private BoundStatement BindContinue(ContinueStatementSyntax node, BindingDiagnosticBag diagnostics)
3036private BoundStatement BindReturn(ReturnStatementSyntax syntax, BindingDiagnosticBag diagnostics)
3503BoundStatement statement;
3706ArrayBuilder<BoundStatement> boundStatements = ArrayBuilder<BoundStatement>.GetInstance();
3718var boundStatement = BindStatement(topLevelStatement.Statement, diagnostics);
3751blockBody: new BoundBlock(typeDecl, ImmutableArray<LocalSymbol>.Empty, ImmutableArray<BoundStatement>.Empty).MakeCompilerGenerated(),
Binder\UsingStatementBinder.cs (4)
76internal override BoundStatement BindUsingStatementParts(BindingDiagnosticBag diagnostics, Binder originalBinder)
84var boundUsingStatement = BindUsingStatementOrDeclarationFromParts((CSharpSyntaxNode)expressionSyntax ?? declarationSyntax, _syntax.UsingKeyword, _syntax.AwaitKeyword, originalBinder, this, diagnostics);
90internal static BoundStatement BindUsingStatementOrDeclarationFromParts(SyntaxNode syntax, SyntaxToken usingKeyword, SyntaxToken awaitKeyword, Binder originalBinder, UsingStatementBinder? usingBinderOpt, BindingDiagnosticBag diagnostics)
171BoundStatement boundBody = originalBinder.BindPossibleEmbeddedStatement(usingBinderOpt!._syntax.Statement, diagnostics);
BoundTree\Constructors.cs (8)
549public static BoundStatementList Synthesized(SyntaxNode syntax, params BoundStatement[] statements)
554public static BoundStatementList Synthesized(SyntaxNode syntax, bool hasErrors, params BoundStatement[] statements)
559public static BoundStatementList Synthesized(SyntaxNode syntax, ImmutableArray<BoundStatement> statements)
564public static BoundStatementList Synthesized(SyntaxNode syntax, bool hasErrors, ImmutableArray<BoundStatement> statements)
596public BoundBlock(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundStatement> statements, bool hasErrors = false)
601public static BoundBlock SynthesizedNoLocals(SyntaxNode syntax, BoundStatement statement)
607public static BoundBlock SynthesizedNoLocals(SyntaxNode syntax, ImmutableArray<BoundStatement> statements)
612public static BoundBlock SynthesizedNoLocals(SyntaxNode syntax, params BoundStatement[] statements)
Compiler\MethodBodySynthesizer.cs (22)
22internal static ImmutableArray<BoundStatement> ConstructScriptConstructorBody(
23BoundStatement loweredBody,
42BoundStatement baseConstructorCall =
61var statements = ArrayBuilder<BoundStatement>.GetInstance();
84ArrayBuilder<BoundStatement> statements,
191BoundStatement statement;
313BoundStatement returnStatement = BoundReturnStatement.Synthesized(syntax, RefKind.None, processHandlerCall);
322BoundStatement callStatement = new BoundExpressionStatement(syntax, processHandlerCall);
323BoundStatement returnStatement = new BoundReturnStatement(syntax, RefKind.None, expressionOpt: null, @checked: false);
359BoundStatement @return = new BoundReturnStatement(syntax,
409BoundStatement eventUpdate = new BoundExpressionStatement(syntax,
418statements: ImmutableArray.Create<BoundStatement>(
441BoundStatement tmp0Init = new BoundExpressionStatement(syntax,
450BoundStatement loopStart = new BoundLabelStatement(syntax,
455BoundStatement tmp1Update = new BoundExpressionStatement(syntax,
474BoundStatement tmp2Update = new BoundExpressionStatement(syntax,
490BoundStatement tmp0Update = new BoundExpressionStatement(syntax,
511BoundStatement loopEnd = new BoundConditionalGoto(syntax,
519statements: ImmutableArray.Create<BoundStatement>(
544BoundStatement baseFinalizeCall = new BoundExpressionStatement(
568ImmutableArray.Create<BoundStatement>(
576ImmutableArray.Create<BoundStatement>(
Compiler\MethodCompiler.cs (24)
263BoundStatement body = synthesizedEntryPoint.CreateBody(diagnostics);
277var loweredBody = LowerBodyOrInitializer(
774BoundStatement loweredBody = IteratorRewriter.Rewrite(methodWithBody.Body, method, methodOrdinal, stateMachineStateDebugInfoBuilder, variableSlotAllocatorOpt, compilationState, diagnosticsThisMethod, out iteratorStateMachine);
1009body = new BoundBlock(methodSymbol.GetNonNullSyntaxNode(), ImmutableArray<LocalSymbol>.Empty, ImmutableArray<BoundStatement>.Empty) { WasCompilerGenerated = true };
1218BoundStatement loweredBodyOpt = null;
1263ImmutableArray<BoundStatement> boundStatements;
1271boundStatements = ImmutableArray<BoundStatement>.Empty;
1281var initializers = ArrayBuilder<BoundStatement>.GetInstance(capturedParameters.Count);
1301BoundStatement lowered = LowerBodyOrInitializer(
1476internal static BoundStatement LowerBodyOrInitializer(
1480BoundStatement body,
1507var loweredBody = LocalRewriter.Rewrite(
1532loweredBody = (BoundStatement)extensionRewriter.Visit(loweredBody);
1567BoundStatement bodyWithoutLambdas = loweredBody;
1593BoundStatement bodyWithoutIterators = IteratorRewriter.Rewrite(bodyWithoutLambdas, method, methodOrdinal, stateMachineStateDebugInfoBuilder, lazyVariableSlotAllocator, compilationState, diagnostics,
1601BoundStatement bodyWithoutAsync;
1635BoundStatement block,
2010body = new BoundBlock(constructor.Syntax, constructor.Locals, ImmutableArray.Create<BoundStatement>(constructor.Initializer));
2014body = new BoundBlock(constructor.Syntax, constructor.Locals, ImmutableArray.Create<BoundStatement>(constructor.Initializer, body));
2059var stmts = ArrayBuilder<BoundStatement>.GetInstance();
2091var constructorInitializer = BindImplicitConstructorInitializerIfAny(method, compilationState, diagnostics);
2092ImmutableArray<BoundStatement> statements;
2101statements = ImmutableArray<BoundStatement>.Empty;
2483private static BoundStatement BindImplicitConstructorInitializerIfAny(MethodSymbol method, TypeCompilationState compilationState, BindingDiagnosticBag diagnostics)
FlowAnalysis\AbstractFlowPass.cs (21)
92private PooledHashSet<BoundStatement> _labelsSeen;
209_labelsSeen = PooledHashSet<BoundStatement>.GetInstance();
669protected virtual void VisitStatement(BoundStatement statement)
761protected virtual void NoteBranch(PendingBranch pending, BoundNode gotoStmt, BoundStatement target)
772private bool ResolveBranches(LabelSymbol label, BoundStatement? target)
791protected virtual void ResolveBranch(PendingBranch pending, LabelSymbol label, BoundStatement? target, ref bool labelStateChanged)
810public readonly PooledHashSet<BoundStatement> LabelsSeen;
812public SavedPending(PendingBranchesCollection pendingBranches, PooledHashSet<BoundStatement> labelsSeen)
830_labelsSeen = PooledHashSet<BoundStatement>.GetInstance();
844foreach (var node in _labelsSeen)
1310private void VisitStatements(ImmutableArray<BoundStatement> statements)
1312foreach (var statement in statements)
1596if (child is BoundStatement)
1598VisitStatement(child as BoundStatement);
1787var alternative = node.AlternativeOpt;
1913private void VisitTryBlockWithAnyTransferFunction(BoundStatement tryBlock, BoundTryStatement node, ref TLocalState tryState)
1937protected virtual void VisitTryBlock(BoundStatement tryBlock, BoundTryStatement node)
1988private void VisitFinallyBlockWithAnyTransferFunction(BoundStatement finallyBlock, ref TLocalState stateMovedUp)
2012protected virtual void VisitFinallyBlock(BoundStatement finallyBlock)
3236foreach (var statement in node.Statements)
3374protected void VisitLabel(LabelSymbol label, BoundStatement node)
Generated\BoundNodes.xml.Generated.cs (148)
382public BoundGlobalStatementInitializer(SyntaxNode syntax, BoundStatement statement, bool hasErrors = false)
391public BoundStatement Statement { get; }
396public BoundGlobalStatementInitializer Update(BoundStatement statement)
2306public BoundBlockInstrumentation(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, BoundStatement? prologue, BoundStatement? epilogue, bool hasErrors = false)
2318public BoundStatement? Prologue { get; }
2319public BoundStatement? Epilogue { get; }
2324public BoundBlockInstrumentation Update(ImmutableArray<LocalSymbol> locals, BoundStatement? prologue, BoundStatement? epilogue)
3200public BoundSequencePoint(SyntaxNode syntax, BoundStatement? statementOpt, bool hasErrors = false)
3206public BoundStatement? StatementOpt { get; }
3211public BoundSequencePoint Update(BoundStatement? statementOpt)
3225public BoundSequencePointWithSpan(SyntaxNode syntax, BoundStatement? statementOpt, TextSpan span, bool hasErrors = false)
3232public BoundStatement? StatementOpt { get; }
3238public BoundSequencePointWithSpan Update(BoundStatement? statementOpt, TextSpan span)
3357public BoundBlock(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, ImmutableArray<MethodSymbol> localFunctions, bool hasUnsafeModifier, BoundBlockInstrumentation? instrumentation, ImmutableArray<BoundStatement> statements, bool hasErrors = false)
3379public BoundBlock Update(ImmutableArray<LocalSymbol> locals, ImmutableArray<MethodSymbol> localFunctions, bool hasUnsafeModifier, BoundBlockInstrumentation? instrumentation, ImmutableArray<BoundStatement> statements)
3393public BoundScope(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundStatement> statements, bool hasErrors = false)
3408public BoundScope Update(ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundStatement> statements)
3422public BoundStateMachineScope(SyntaxNode syntax, ImmutableArray<StateMachineFieldSymbol> fields, BoundStatement statement, bool hasErrors = false)
3434public BoundStatement Statement { get; }
3439public BoundStateMachineScope Update(ImmutableArray<StateMachineFieldSymbol> fields, BoundStatement statement)
3908public BoundIfStatement(SyntaxNode syntax, BoundExpression condition, BoundStatement consequence, BoundStatement? alternativeOpt, bool hasErrors = false)
3921public BoundStatement Consequence { get; }
3922public BoundStatement? AlternativeOpt { get; }
3927public BoundIfStatement Update(BoundExpression condition, BoundStatement consequence, BoundStatement? alternativeOpt)
3969protected BoundConditionalLoopStatement(BoundKind kind, SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, BoundExpression condition, BoundStatement body, LabelSymbol breakLabel, LabelSymbol continueLabel, bool hasErrors = false)
3986public BoundStatement Body { get; }
3991public BoundDoStatement(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, BoundExpression condition, BoundStatement body, LabelSymbol breakLabel, LabelSymbol continueLabel, bool hasErrors = false)
4007public BoundDoStatement Update(ImmutableArray<LocalSymbol> locals, BoundExpression condition, BoundStatement body, LabelSymbol breakLabel, LabelSymbol continueLabel)
4021public BoundWhileStatement(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, BoundExpression condition, BoundStatement body, LabelSymbol breakLabel, LabelSymbol continueLabel, bool hasErrors = false)
4037public BoundWhileStatement Update(ImmutableArray<LocalSymbol> locals, BoundExpression condition, BoundStatement body, LabelSymbol breakLabel, LabelSymbol continueLabel)
4051public BoundForStatement(SyntaxNode syntax, ImmutableArray<LocalSymbol> outerLocals, BoundStatement? initializer, ImmutableArray<LocalSymbol> innerLocals, BoundExpression? condition, BoundStatement? increment, BoundStatement body, LabelSymbol breakLabel, LabelSymbol continueLabel, bool hasErrors = false)
4070public BoundStatement? Initializer { get; }
4073public BoundStatement? Increment { get; }
4074public BoundStatement Body { get; }
4079public BoundForStatement Update(ImmutableArray<LocalSymbol> outerLocals, BoundStatement? initializer, ImmutableArray<LocalSymbol> innerLocals, BoundExpression? condition, BoundStatement? increment, BoundStatement body, LabelSymbol breakLabel, LabelSymbol continueLabel)
4093public BoundForEachStatement(SyntaxNode syntax, ForEachEnumeratorInfo? enumeratorInfoOpt, BoundValuePlaceholder? elementPlaceholder, BoundExpression? elementConversion, BoundTypeExpression iterationVariableType, ImmutableArray<LocalSymbol> iterationVariables, BoundExpression? iterationErrorExpressionOpt, BoundExpression expression, BoundForEachDeconstructStep? deconstructionOpt, BoundStatement body, LabelSymbol breakLabel, LabelSymbol continueLabel, bool hasErrors = false)
4123public BoundStatement Body { get; }
4128public BoundForEachStatement Update(ForEachEnumeratorInfo? enumeratorInfoOpt, BoundValuePlaceholder? elementPlaceholder, BoundExpression? elementConversion, BoundTypeExpression iterationVariableType, ImmutableArray<LocalSymbol> iterationVariables, BoundExpression? iterationErrorExpressionOpt, BoundExpression expression, BoundForEachDeconstructStep? deconstructionOpt, BoundStatement body, LabelSymbol breakLabel, LabelSymbol continueLabel)
4173public BoundUsingStatement(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, BoundMultipleLocalDeclarations? declarationsOpt, BoundExpression? expressionOpt, BoundStatement body, BoundAwaitableInfo? awaitOpt, MethodArgumentInfo? patternDisposeInfoOpt, bool hasErrors = false)
4191public BoundStatement Body { get; }
4198public BoundUsingStatement Update(ImmutableArray<LocalSymbol> locals, BoundMultipleLocalDeclarations? declarationsOpt, BoundExpression? expressionOpt, BoundStatement body, BoundAwaitableInfo? awaitOpt, MethodArgumentInfo? patternDisposeInfoOpt)
4212public BoundFixedStatement(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, BoundMultipleLocalDeclarations declarations, BoundStatement body, bool hasErrors = false)
4227public BoundStatement Body { get; }
4232public BoundFixedStatement Update(ImmutableArray<LocalSymbol> locals, BoundMultipleLocalDeclarations declarations, BoundStatement body)
4246public BoundLockStatement(SyntaxNode syntax, BoundExpression argument, BoundStatement body, bool hasErrors = false)
4258public BoundStatement Body { get; }
4263public BoundLockStatement Update(BoundExpression argument, BoundStatement body)
4796public BoundLabeledStatement(SyntaxNode syntax, LabelSymbol label, BoundStatement body, bool hasErrors = false)
4808public BoundStatement Body { get; }
4813public BoundLabeledStatement Update(LabelSymbol label, BoundStatement body)
4864protected BoundStatementList(BoundKind kind, SyntaxNode syntax, ImmutableArray<BoundStatement> statements, bool hasErrors = false)
4873public BoundStatementList(SyntaxNode syntax, ImmutableArray<BoundStatement> statements, bool hasErrors = false)
4882public ImmutableArray<BoundStatement> Statements { get; }
4887public BoundStatementList Update(ImmutableArray<BoundStatement> statements)
5713public BoundSwitchSection(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundSwitchLabel> switchLabels, ImmutableArray<BoundStatement> statements, bool hasErrors = false)
5731public BoundSwitchSection Update(ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundSwitchLabel> switchLabels, ImmutableArray<BoundStatement> statements)
5856public BoundSpillSequence(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundStatement> sideEffects, BoundExpression value, TypeSymbol type, bool hasErrors = false)
5872public ImmutableArray<BoundStatement> SideEffects { get; }
5878public BoundSpillSequence Update(ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundStatement> sideEffects, BoundExpression value, TypeSymbol type)
6607public BoundCollectionExpressionSpreadElement(SyntaxNode syntax, BoundExpression expression, BoundCollectionExpressionSpreadExpressionPlaceholder? expressionPlaceholder, BoundExpression? conversion, ForEachEnumeratorInfo? enumeratorInfoOpt, BoundExpression? lengthOrCount, BoundValuePlaceholder? elementPlaceholder, BoundStatement? iteratorBody, bool hasErrors = false)
6628public BoundStatement? IteratorBody { get; }
6633public BoundCollectionExpressionSpreadElement Update(BoundExpression expression, BoundCollectionExpressionSpreadExpressionPlaceholder? expressionPlaceholder, BoundExpression? conversion, ForEachEnumeratorInfo? enumeratorInfoOpt, BoundExpression? lengthOrCount, BoundValuePlaceholder? elementPlaceholder, BoundStatement? iteratorBody)
7818public BoundTypeOrInstanceInitializers(SyntaxNode syntax, ImmutableArray<BoundStatement> statements, bool hasErrors = false)
7830public new BoundTypeOrInstanceInitializers Update(ImmutableArray<BoundStatement> statements)
8871public BoundConstructorMethodBody(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, BoundStatement? initializer, BoundBlock? blockBody, BoundBlock? expressionBody, bool hasErrors = false)
8882public BoundStatement? Initializer { get; }
8887public BoundConstructorMethodBody Update(ImmutableArray<LocalSymbol> locals, BoundStatement? initializer, BoundBlock? blockBody, BoundBlock? expressionBody)
10980BoundStatement statement = (BoundStatement)this.Visit(node.Statement);
11332BoundStatement? prologue = (BoundStatement?)this.Visit(node.Prologue);
11333BoundStatement? epilogue = (BoundStatement?)this.Visit(node.Epilogue);
11479BoundStatement? statementOpt = (BoundStatement?)this.Visit(node.StatementOpt);
11484BoundStatement? statementOpt = (BoundStatement?)this.Visit(node.StatementOpt);
11495ImmutableArray<BoundStatement> statements = this.VisitList(node.Statements);
11501ImmutableArray<BoundStatement> statements = this.VisitList(node.Statements);
11507BoundStatement statement = (BoundStatement)this.Visit(node.Statement);
11588BoundStatement consequence = (BoundStatement)this.Visit(node.Consequence);
11589BoundStatement? alternativeOpt = (BoundStatement?)this.Visit(node.AlternativeOpt);
11598BoundStatement body = (BoundStatement)this.Visit(node.Body);
11607BoundStatement body = (BoundStatement)this.Visit(node.Body);
11616BoundStatement? initializer = (BoundStatement?)this.Visit(node.Initializer);
11618BoundStatement? increment = (BoundStatement?)this.Visit(node.Increment);
11619BoundStatement body = (BoundStatement)this.Visit(node.Body);
11633BoundStatement body = (BoundStatement)this.Visit(node.Body);
11647BoundStatement body = (BoundStatement)this.Visit(node.Body);
11655BoundStatement body = (BoundStatement)this.Visit(node.Body);
11661BoundStatement body = (BoundStatement)this.Visit(node.Body);
11752BoundStatement body = (BoundStatement)this.Visit(node.Body);
11763ImmutableArray<BoundStatement> statements = this.VisitList(node.Statements);
11922ImmutableArray<BoundStatement> statements = this.VisitList(node.Statements);
11949ImmutableArray<BoundStatement> sideEffects = this.VisitList(node.SideEffects);
12087BoundStatement? iteratorBody = node.IteratorBody;
12310ImmutableArray<BoundStatement> statements = this.VisitList(node.Statements);
12513BoundStatement? initializer = (BoundStatement?)this.Visit(node.Initializer);
13314BoundStatement? prologue = (BoundStatement?)this.Visit(node.Prologue);
13315BoundStatement? epilogue = (BoundStatement?)this.Visit(node.Epilogue);
13678ImmutableArray<BoundStatement> statements = this.VisitList(node.Statements);
13685ImmutableArray<BoundStatement> statements = this.VisitList(node.Statements);
13692BoundStatement statement = (BoundStatement)this.Visit(node.Statement);
13728BoundStatement body = (BoundStatement)this.Visit(node.Body);
13736BoundStatement body = (BoundStatement)this.Visit(node.Body);
13744BoundStatement? initializer = (BoundStatement?)this.Visit(node.Initializer);
13746BoundStatement? increment = (BoundStatement?)this.Visit(node.Increment);
13747BoundStatement body = (BoundStatement)this.Visit(node.Body);
13760BoundStatement body = (BoundStatement)this.Visit(node.Body);
13769BoundStatement body = (BoundStatement)this.Visit(node.Body);
13778BoundStatement body = (BoundStatement)this.Visit(node.Body);
14048ImmutableArray<BoundStatement> statements = this.VisitList(node.Statements);
14091ImmutableArray<BoundStatement> sideEffects = this.VisitList(node.SideEffects);
15227BoundStatement? initializer = (BoundStatement?)this.Visit(node.Initializer);
Lowering\AsyncRewriter\AsyncRewriter.AsyncIteratorRewriter.cs (15)
35BoundStatement body,
163var bodyBuilder = ArrayBuilder<BoundStatement>.GetInstance();
200protected override void InitializeStateMachine(ArrayBuilder<BoundStatement> bodyBuilder, NamedTypeSymbol frameType, LocalSymbol stateMachineLocal)
210protected override BoundStatement InitializeParameterField(MethodSymbol getEnumeratorMethod, ParameterSymbol parameter, BoundExpression resultParameter, BoundExpression parameterProxy)
212BoundStatement result;
263protected override BoundStatement GenerateStateMachineCreation(LocalSymbol stateMachineVariable, NamedTypeSymbol frameType, IReadOnlyDictionary<Symbol, CapturedSymbolReplacement> proxies)
265var bodyBuilder = ArrayBuilder<BoundStatement>.GetInstance();
326out BoundStatement instAssignment,
330BoundStatement ifFinished = F.If(
341var ifPromiseReady = F.If(
368private void GetPartsForStartingMachine(out BoundExpressionStatement callReset, out LocalSymbol instSymbol, out BoundStatement instAssignment,
436out BoundStatement instAssignment,
440BoundStatement ifInvalidState = F.If(
446BoundStatement ifFinished = F.If(
663protected override void GenerateResetInstance(ArrayBuilder<BoundStatement> builder, StateMachineState initialState)
Lowering\Instrumentation\CodeCoverageInstrumenter.cs (60)
27private readonly BoundStatement _methodBody;
32private readonly BoundStatement? _methodEntryInstrumentation;
41BoundStatement methodBody,
103BoundStatement methodBody,
237public override void InstrumentBlock(BoundBlock original, LocalRewriter rewriter, ref TemporaryArray<LocalSymbol> additionalLocals, out BoundStatement? prologue, out BoundStatement? epilogue, out BoundBlockInstrumentation? instrumentation)
239base.InstrumentBlock(original, rewriter, ref additionalLocals, out var previousPrologue, out epilogue, out instrumentation);
261BoundStatement payloadInitialization =
276BoundStatement createPayloadCall =
296BoundStatement payloadIf = _methodBodyFactory.If(payloadNullTest, createPayloadCall);
300var prologueStatements = ArrayBuilder<BoundStatement>.GetInstance(2 + (_methodEntryInstrumentation != null ? 1 : 0) + (previousPrologue != null ? 1 : 0));
319public override BoundStatement InstrumentNoOpStatement(BoundNoOpStatement original, BoundStatement rewritten)
324public override BoundStatement InstrumentBreakStatement(BoundBreakStatement original, BoundStatement rewritten)
329public override BoundStatement InstrumentContinueStatement(BoundContinueStatement original, BoundStatement rewritten)
334public override BoundStatement InstrumentExpressionStatement(BoundExpressionStatement original, BoundStatement rewritten)
339public override BoundStatement InstrumentFieldOrPropertyInitializer(BoundStatement original, BoundStatement rewritten)
344public override BoundStatement InstrumentGotoStatement(BoundGotoStatement original, BoundStatement rewritten)
349public override BoundStatement InstrumentThrowStatement(BoundThrowStatement original, BoundStatement rewritten)
354public override BoundStatement InstrumentYieldBreakStatement(BoundYieldBreakStatement original, BoundStatement rewritten)
359public override BoundStatement InstrumentYieldReturnStatement(BoundYieldReturnStatement original, BoundStatement rewritten)
364public override BoundStatement InstrumentForEachStatementIterationVarDeclaration(BoundForEachStatement original, BoundStatement iterationVarDecl)
369public override BoundStatement InstrumentForEachStatementDeconstructionVariablesDeclaration(BoundForEachStatement original, BoundStatement iterationVarDecl)
374public override BoundStatement InstrumentIfStatementConditionalGoto(BoundIfStatement original, BoundStatement rewritten)
379public override BoundStatement InstrumentWhileStatementConditionalGotoStartOrBreak(BoundWhileStatement original, BoundStatement ifConditionGotoStart)
384public override BoundStatement InstrumentUserDefinedLocalInitialization(BoundLocalDeclaration original, BoundStatement rewritten)
389public override BoundStatement InstrumentLockTargetCapture(BoundLockStatement original, BoundStatement lockTargetCapture)
394public override BoundStatement InstrumentReturnStatement(BoundReturnStatement original, BoundStatement rewritten)
432public override BoundStatement InstrumentSwitchStatement(BoundSwitchStatement original, BoundStatement rewritten)
437public override BoundStatement InstrumentSwitchWhenClauseConditionalGotoBody(BoundExpression original, BoundStatement ifConditionGotoBody)
450public override BoundStatement InstrumentUsingTargetCapture(BoundUsingStatement original, BoundStatement usingTargetCapture)
455private BoundStatement AddDynamicAnalysis(BoundStatement original, BoundStatement rewritten)
469private BoundStatement CollectDynamicAnalysis(BoundStatement original, BoundStatement rewritten)
493private BoundStatement AddAnalysisPoint(SyntaxNode syntaxForSpan, Text.TextSpan alternateSpan, SyntheticBoundNodeFactory statementFactory)
498private BoundStatement AddAnalysisPoint(SyntaxNode syntaxForSpan, SyntheticBoundNodeFactory statementFactory)
503private BoundStatement AddAnalysisPoint(SyntaxNode syntaxForSpan, FileLinePositionSpan span, SyntheticBoundNodeFactory statementFactory)
523private static SyntaxNode SyntaxForSpan(BoundStatement statement)
Lowering\Instrumentation\CompoundInstrumenter.cs (56)
39public override BoundStatement InstrumentNoOpStatement(BoundNoOpStatement original, BoundStatement rewritten)
44public override BoundStatement InstrumentYieldBreakStatement(BoundYieldBreakStatement original, BoundStatement rewritten)
49public override BoundStatement InstrumentYieldReturnStatement(BoundYieldReturnStatement original, BoundStatement rewritten)
54public override BoundStatement InstrumentThrowStatement(BoundThrowStatement original, BoundStatement rewritten)
59public override BoundStatement InstrumentContinueStatement(BoundContinueStatement original, BoundStatement rewritten)
64public override BoundStatement InstrumentGotoStatement(BoundGotoStatement original, BoundStatement rewritten)
69public override BoundStatement InstrumentExpressionStatement(BoundExpressionStatement original, BoundStatement rewritten)
74public override BoundStatement InstrumentFieldOrPropertyInitializer(BoundStatement original, BoundStatement rewritten)
79public override BoundStatement InstrumentBreakStatement(BoundBreakStatement original, BoundStatement rewritten)
89public override void InstrumentBlock(BoundBlock original, LocalRewriter rewriter, ref TemporaryArray<LocalSymbol> additionalLocals, out BoundStatement? prologue, out BoundStatement? epilogue, out BoundBlockInstrumentation? instrumentation)
99public override BoundStatement InstrumentDoStatementConditionalGotoStart(BoundDoStatement original, BoundStatement ifConditionGotoStart)
104public override BoundStatement? InstrumentForEachStatementCollectionVarDeclaration(BoundForEachStatement original, BoundStatement? collectionVarDecl)
109public override BoundStatement InstrumentForEachStatement(BoundForEachStatement original, BoundStatement rewritten)
114public override BoundStatement InstrumentForEachStatementIterationVarDeclaration(BoundForEachStatement original, BoundStatement iterationVarDecl)
119public override BoundStatement InstrumentForStatementConditionalGotoStartOrBreak(BoundForStatement original, BoundStatement branchBack)
124public override BoundStatement InstrumentForEachStatementConditionalGotoStart(BoundForEachStatement original, BoundStatement branchBack)
134public override BoundStatement InstrumentIfStatementConditionalGoto(BoundIfStatement original, BoundStatement rewritten)
144public override BoundStatement InstrumentLabelStatement(BoundLabeledStatement original, BoundStatement rewritten)
149public override BoundStatement InstrumentUserDefinedLocalInitialization(BoundLocalDeclaration original, BoundStatement rewritten)
183public override BoundStatement InstrumentLockTargetCapture(BoundLockStatement original, BoundStatement lockTargetCapture)
188public override BoundStatement InstrumentReturnStatement(BoundReturnStatement original, BoundStatement rewritten)
193public override BoundStatement InstrumentSwitchStatement(BoundSwitchStatement original, BoundStatement rewritten)
198public override BoundStatement InstrumentSwitchWhenClauseConditionalGotoBody(BoundExpression original, BoundStatement ifConditionGotoBody)
203public override BoundStatement InstrumentUsingTargetCapture(BoundUsingStatement original, BoundStatement usingTargetCapture)
213public override BoundStatement InstrumentWhileStatementConditionalGotoStartOrBreak(BoundWhileStatement original, BoundStatement ifConditionGotoStart)
237public override BoundExpression InstrumentSwitchStatementExpression(BoundStatement original, BoundExpression rewrittenExpression, SyntheticBoundNodeFactory factory)
247public override BoundStatement InstrumentSwitchBindCasePatternVariables(BoundStatement bindings)
252public override BoundStatement InstrumentForEachStatementDeconstructionVariablesDeclaration(BoundForEachStatement original, BoundStatement iterationVarDecl)
Lowering\Instrumentation\DebugInfoInjector.cs (61)
40public override BoundStatement InstrumentNoOpStatement(BoundNoOpStatement original, BoundStatement rewritten)
45public override BoundStatement InstrumentBreakStatement(BoundBreakStatement original, BoundStatement rewritten)
50public override BoundStatement InstrumentContinueStatement(BoundContinueStatement original, BoundStatement rewritten)
55public override BoundStatement InstrumentExpressionStatement(BoundExpressionStatement original, BoundStatement rewritten)
118public override BoundStatement InstrumentFieldOrPropertyInitializer(BoundStatement original, BoundStatement rewritten)
132private static BoundStatement InstrumentFieldOrPropertyInitializer(BoundStatement rewritten, SyntaxNode syntax)
158public override BoundStatement InstrumentGotoStatement(BoundGotoStatement original, BoundStatement rewritten)
163public override BoundStatement InstrumentThrowStatement(BoundThrowStatement original, BoundStatement rewritten)
168public override BoundStatement InstrumentYieldBreakStatement(BoundYieldBreakStatement original, BoundStatement rewritten)
181public override BoundStatement InstrumentYieldReturnStatement(BoundYieldReturnStatement original, BoundStatement rewritten)
186public override void InstrumentBlock(BoundBlock original, LocalRewriter rewriter, ref TemporaryArray<LocalSymbol> additionalLocals, out BoundStatement? prologue, out BoundStatement? epilogue, out BoundBlockInstrumentation? instrumentation)
188base.InstrumentBlock(original, rewriter, ref additionalLocals, out var previousPrologue, out var previousEpilogue, out instrumentation);
241public override BoundStatement InstrumentDoStatementConditionalGotoStart(BoundDoStatement original, BoundStatement ifConditionGotoStart)
251public override BoundStatement InstrumentWhileStatementConditionalGotoStartOrBreak(BoundWhileStatement original, BoundStatement ifConditionGotoStart)
269public override BoundStatement InstrumentForEachStatementCollectionVarDeclaration(BoundForEachStatement original, BoundStatement? collectionVarDecl)
276public override BoundStatement InstrumentForEachStatementDeconstructionVariablesDeclaration(BoundForEachStatement original, BoundStatement iterationVarDecl)
290public override BoundStatement InstrumentForEachStatement(BoundForEachStatement original, BoundStatement rewritten)
299ImmutableArray.Create<BoundStatement>(foreachKeywordSequencePoint,
311public override BoundStatement InstrumentForEachStatementIterationVarDeclaration(BoundForEachStatement original, BoundStatement iterationVarDecl)
336public override BoundStatement InstrumentForStatementConditionalGotoStartOrBreak(BoundForStatement original, BoundStatement branchBack)
343public override BoundStatement InstrumentForEachStatementConditionalGotoStart(BoundForEachStatement original, BoundStatement branchBack)
358public override BoundStatement InstrumentIfStatementConditionalGoto(BoundIfStatement original, BoundStatement rewritten)
377public override BoundStatement InstrumentLabelStatement(BoundLabeledStatement original, BoundStatement rewritten)
386public override BoundStatement InstrumentUserDefinedLocalInitialization(BoundLocalDeclaration original, BoundStatement rewritten)
394public override BoundStatement InstrumentLockTargetCapture(BoundLockStatement original, BoundStatement lockTargetCapture)
402public override BoundStatement InstrumentReturnStatement(BoundReturnStatement original, BoundStatement rewritten)
423public override BoundStatement InstrumentSwitchStatement(BoundSwitchStatement original, BoundStatement rewritten)
437public override BoundStatement InstrumentSwitchWhenClauseConditionalGotoBody(BoundExpression original, BoundStatement ifConditionGotoBody)
448public override BoundStatement InstrumentUsingTargetCapture(BoundUsingStatement original, BoundStatement usingTargetCapture)
486public override BoundExpression InstrumentSwitchStatementExpression(BoundStatement original, BoundExpression rewrittenExpression, SyntheticBoundNodeFactory factory)
498public override BoundStatement InstrumentSwitchBindCasePatternVariables(BoundStatement bindings)
Lowering\Instrumentation\Instrumenter.cs (59)
37private static BoundStatement InstrumentStatement(BoundStatement original, BoundStatement rewritten)
43public virtual BoundStatement InstrumentNoOpStatement(BoundNoOpStatement original, BoundStatement rewritten)
48public virtual BoundStatement InstrumentYieldBreakStatement(BoundYieldBreakStatement original, BoundStatement rewritten)
54public virtual BoundStatement InstrumentYieldReturnStatement(BoundYieldReturnStatement original, BoundStatement rewritten)
74public virtual void InstrumentBlock(BoundBlock original, LocalRewriter rewriter, ref TemporaryArray<LocalSymbol> additionalLocals, out BoundStatement? prologue, out BoundStatement? epilogue, out BoundBlockInstrumentation? instrumentation)
81public virtual BoundStatement InstrumentThrowStatement(BoundThrowStatement original, BoundStatement rewritten)
86public virtual BoundStatement InstrumentContinueStatement(BoundContinueStatement original, BoundStatement rewritten)
91public virtual BoundStatement InstrumentGotoStatement(BoundGotoStatement original, BoundStatement rewritten)
96public virtual BoundStatement InstrumentExpressionStatement(BoundExpressionStatement original, BoundStatement rewritten)
101public virtual BoundStatement InstrumentFieldOrPropertyInitializer(BoundStatement original, BoundStatement rewritten)
107public virtual BoundStatement InstrumentBreakStatement(BoundBreakStatement original, BoundStatement rewritten)
128public virtual BoundStatement InstrumentDoStatementConditionalGotoStart(BoundDoStatement original, BoundStatement ifConditionGotoStart)
135public virtual BoundStatement InstrumentWhileStatementConditionalGotoStartOrBreak(BoundWhileStatement original, BoundStatement ifConditionGotoStart)
143public virtual BoundStatement? InstrumentForEachStatementCollectionVarDeclaration(BoundForEachStatement original, BoundStatement? collectionVarDecl)
150public virtual BoundStatement InstrumentForEachStatement(BoundForEachStatement original, BoundStatement rewritten)
156public virtual BoundStatement InstrumentForEachStatementIterationVarDeclaration(BoundForEachStatement original, BoundStatement iterationVarDecl)
163public virtual BoundStatement InstrumentForEachStatementDeconstructionVariablesDeclaration(BoundForEachStatement original, BoundStatement iterationVarDecl)
170public virtual BoundStatement InstrumentForEachStatementConditionalGotoStart(BoundForEachStatement original, BoundStatement branchBack)
177public virtual BoundStatement InstrumentForStatementConditionalGotoStartOrBreak(BoundForStatement original, BoundStatement branchBack)
192public virtual BoundStatement InstrumentIfStatementConditionalGoto(BoundIfStatement original, BoundStatement rewritten)
206public virtual BoundStatement InstrumentLabelStatement(BoundLabeledStatement original, BoundStatement rewritten)
212public virtual BoundStatement InstrumentUserDefinedLocalInitialization(BoundLocalDeclaration original, BoundStatement rewritten)
256public virtual BoundStatement InstrumentLockTargetCapture(BoundLockStatement original, BoundStatement lockTargetCapture)
263public virtual BoundStatement InstrumentReturnStatement(BoundReturnStatement original, BoundStatement rewritten)
268public virtual BoundStatement InstrumentSwitchStatement(BoundSwitchStatement original, BoundStatement rewritten)
279public virtual BoundStatement InstrumentSwitchWhenClauseConditionalGotoBody(BoundExpression original, BoundStatement ifConditionGotoBody)
286public virtual BoundStatement InstrumentUsingTargetCapture(BoundUsingStatement original, BoundStatement usingTargetCapture)
305public virtual BoundExpression InstrumentSwitchStatementExpression(BoundStatement original, BoundExpression rewrittenExpression, SyntheticBoundNodeFactory factory)
323public virtual BoundStatement InstrumentSwitchBindCasePatternVariables(BoundStatement bindings)
Lowering\Instrumentation\LocalStateTracingInstrumenter.cs (9)
154BoundStatement methodBody,
284public override void InstrumentBlock(BoundBlock original, LocalRewriter rewriter, ref TemporaryArray<LocalSymbol> additionalLocals, out BoundStatement? prologue, out BoundStatement? epilogue, out BoundBlockInstrumentation? instrumentation)
286base.InstrumentBlock(original, rewriter, ref additionalLocals, out var previousPrologue, out epilogue, out instrumentation);
303var prologueBuilder = ArrayBuilder<BoundStatement>.GetInstance(_factory.CurrentFunction.ParameterCount);
348var instrumentationPrologue = (entryLogger != null) ?
352var instrumentationEpilogue = (returnLogger != null) ?
546ImmutableArray.Create<BoundStatement>(logCallStatement, rewrittenFilterPrologue) :
547ImmutableArray.Create<BoundStatement>(logCallStatement));
Lowering\LocalRewriter\LocalRewriter_Block.cs (14)
21var builder = ArrayBuilder<BoundStatement>.GetInstance();
40Instrumenter.InstrumentBlock(node, this, ref additionalLocals, out var prologue, out var epilogue, out instrumentation);
76/// <returns>An <see cref="ImmutableArray{T}"/> of <see cref="BoundStatement"/></returns>
77public void VisitStatementSubList(ArrayBuilder<BoundStatement> builder, ImmutableArray<BoundStatement> statements, int startIndex = 0)
81BoundStatement? statement = VisitPossibleUsingDeclaration(statements[i], statements, i, out var replacedUsingDeclarations);
101/// <returns>A <see cref="BoundStatement"/></returns>
107public BoundStatement? VisitPossibleUsingDeclaration(BoundStatement node, ImmutableArray<BoundStatement> statements, int statementIndex, out bool replacedLocalDeclarations)
116ArrayBuilder<BoundStatement> builder = ArrayBuilder<BoundStatement>.GetInstance();
130? new BoundBlock(node.Syntax, ImmutableArray<LocalSymbol>.Empty, ImmutableArray<BoundStatement>.Empty)
Lowering\LocalRewriter\LocalRewriter_FixedStatement.cs (15)
25var statementBuilder = ArrayBuilder<BoundStatement>.GetInstance(numFixedLocals + 1 + 1); //+1 for body, +1 for hidden seq point
26var cleanup = new BoundStatement[numFixedLocals];
48BoundStatement? rewrittenBody = VisitStatement(node.Body);
194private BoundStatement InitializeFixedStatementLocal(
232private BoundStatement InitializeFixedStatementRegularLocal(
272BoundStatement pinnedTempInit = factory.Assignment(factory.Local(pinnedTemp), initializerExpr, isRef: true);
284BoundStatement localInit = InstrumentLocalDeclarationIfNecessary(localDecl, localSymbol,
299private BoundStatement InitializeFixedStatementGetPinnable(
422BoundStatement localInit = InstrumentLocalDeclarationIfNecessary(localDecl, localSymbol, factory.Assignment(factory.Local(localSymbol), pinAndGetPtr));
435private BoundStatement InitializeFixedStatementStringLocal(
461BoundStatement stringTempInit = factory.Assignment(factory.Local(pinnedTemp), initializerExpr);
471BoundStatement localInit = InstrumentLocalDeclarationIfNecessary(localDecl, localSymbol,
488BoundStatement conditionalAdd = factory.If(notNullCheck, factory.Assignment(factory.Local(localSymbol), addition));
504private BoundStatement InitializeFixedStatementArrayLocal(
571BoundStatement localInit = factory.ExpressionStatement(
Lowering\LocalRewriter\LocalRewriter_ForEachStatement.cs (70)
119private BoundStatement RewriteEnumeratorForEachStatement(BoundForEachStatement node)
124BoundStatement? rewrittenBody = VisitStatement(node.Body);
140private BoundStatement RewriteForEachEnumerator(
150BoundStatement rewrittenBody)
191BoundStatement enumeratorVarDecl = MakeLocalDeclaration(forEachSyntax, enumeratorVar, enumeratorVarInitValue);
210BoundStatement iterationVarDecl = LocalOrDeconstructionDeclaration(forEachSyntax, deconstruction, iterationVariables, iterationVarAssignValue);
241BoundStatement whileLoop = RewriteWhileStatement(
249BoundStatement result;
262BoundStatement tryFinally = new BoundTryStatement(
274statements: ImmutableArray.Create<BoundStatement>(enumeratorVarDecl, tryFinally));
286statements: ImmutableArray.Create<BoundStatement>(enumeratorVarDecl, whileLoop));
378BoundStatement disposeCallStatement;
393BoundStatement alwaysOrMaybeDisposeStmt;
446BoundStatement disposableVarDecl = MakeLocalDeclaration(forEachSyntax, disposableVar, disposableVarInitValue);
450BoundStatement disposeCallStatement = new BoundExpressionStatement(forEachSyntax, expression: disposeCall);
453BoundStatement ifStmt = RewriteIfStatement(
479private BoundStatement WrapWithAwait(SyntaxNode forEachSyntax, BoundExpression disposeCall, BoundAwaitableInfo disposeAwaitableInfoOpt)
559private BoundStatement RewriteForEachStatementAsFor<TArg>(BoundForEachStatement node, GetForEachStatementAsForPreamble? getPreamble, GetForEachStatementAsForItem<TArg> getItem, GetForEachStatementAsForLength<TArg> getLength, TArg arg)
563BoundStatement? rewrittenBody = VisitStatement(node.Body);
584private BoundStatement RewriteForEachStatementAsFor<TArg>(
598BoundStatement rewrittenBody)
611BoundStatement? collectionVarInitializationPreamble = getPreamble?.Invoke(this, forEachSyntax, enumeratorInfo, ref rewrittenExpression, out preambleLocal, out collectionTempRefKind);
617BoundStatement arrayVarDecl = MakeLocalDeclaration(forEachSyntax, collectionTemp, rewrittenExpression);
636BoundStatement positionVarDecl = MakeLocalDeclaration(forEachSyntax, positionVar,
646BoundStatement iterationVariableDecl = LocalOrDeconstructionDeclaration(forEachSyntax, deconstructionOpt, iterationVariables, iterationVarInitValue);
650BoundStatement initializer = new BoundStatementList(forEachSyntax,
651statements: ImmutableArray.Create<BoundStatement>(arrayVarDecl, positionVarDecl));
669BoundStatement positionIncrement = MakePositionIncrement(forEachSyntax, boundPositionVar, intType);
676BoundStatement loopBody = CreateBlockDeclaringIterationVariables(iterationVariables, iterationVariableDecl, rewrittenBody, forEachSyntax);
682BoundStatement result = RewriteForStatementWithoutInnerLocals(
698private delegate BoundStatement? GetForEachStatementAsForPreamble(LocalRewriter rewriter, SyntaxNode syntax, ForEachEnumeratorInfo enumeratorInfo, ref BoundExpression rewrittenExpression, out LocalSymbol? preambleLocal, out RefKind collectionTempRefKind);
702private BoundStatement RewriteForEachStatementAsFor(BoundForEachStatement node, MethodSymbol indexerGet, MethodSymbol lengthGet)
726private BoundStatement RewriteInlineArrayForEachStatementAsFor(BoundForEachStatement node)
741BoundStatement? collectionVarInitializationPreamble = null;
800private BoundStatement LocalOrDeconstructionDeclaration(
806BoundStatement iterationVarDecl;
830BoundStatement iteratorVariableInitialization,
831BoundStatement rewrittenBody,
865private BoundStatement RewriteSingleDimensionalArrayForEachStatement(BoundForEachStatement node)
870BoundStatement? rewrittenBody = VisitStatement(node.Body);
885private BoundStatement RewriteSingleDimensionalArrayForEachEnumerator(
894BoundStatement rewrittenBody)
911BoundStatement arrayVarDecl = MakeLocalDeclaration(forEachSyntax, arrayVar, rewrittenExpression);
925BoundStatement positionVarDecl = MakeLocalDeclaration(forEachSyntax, positionVar,
939BoundStatement iterationVariableDecl = LocalOrDeconstructionDeclaration(forEachSyntax, deconstruction, iterationVariables, iterationVarInitValue);
943BoundStatement initializer = new BoundStatementList(forEachSyntax,
944statements: ImmutableArray.Create<BoundStatement>(arrayVarDecl, positionVarDecl));
965BoundStatement positionIncrement = MakePositionIncrement(forEachSyntax, boundPositionVar, intType);
972BoundStatement loopBody = CreateBlockDeclaringIterationVariables(iterationVariables, iterationVariableDecl, rewrittenBody, forEachSyntax);
978BoundStatement result = RewriteForStatementWithoutInnerLocals(
1014private BoundStatement RewriteMultiDimensionalArrayForEachStatement(BoundForEachStatement node)
1019BoundStatement? rewrittenBody = VisitStatement(node.Body);
1034private BoundStatement RewriteMultiDimensionalArrayForEachEnumerator(
1043BoundStatement rewrittenBody)
1068BoundStatement arrayVarDecl = MakeLocalDeclaration(forEachSyntax, arrayVar, rewrittenExpression);
1080BoundStatement[] upperVarDecl = new BoundStatement[rank];
1119BoundStatement iterationVarDecl = LocalOrDeconstructionDeclaration(forEachSyntax, deconstruction, iterationVariables, iterationVarInitValue);
1128BoundStatement innermostLoopBody = CreateBlockDeclaringIterationVariables(iterationVariables, iterationVarDecl, rewrittenBody, forEachSyntax);
1138BoundStatement? forLoop = null;
1150BoundStatement positionVarDecl = MakeLocalDeclaration(forEachSyntax, positionVar[dimension], currentDimensionLowerBound);
1169BoundStatement positionIncrement = MakePositionIncrement(forEachSyntax, boundPositionVar[dimension], intType);
1171BoundStatement body;
1200BoundStatement result = new BoundBlock(
1231private BoundStatement MakeLocalDeclaration(CSharpSyntaxNode syntax, LocalSymbol local, BoundExpression rewrittenInitialValue)
1233var result = RewriteLocalDeclaration(
1243private BoundStatement MakePositionIncrement(CSharpSyntaxNode syntax, BoundLocal boundPositionVar, TypeSymbol intType)
1266private void InstrumentForEachStatementCollectionVarDeclaration(BoundNode node, [NotNullIfNotNull(nameof(collectionVarDecl))] ref BoundStatement? collectionVarDecl)
1274private void InstrumentForEachStatementIterationVarDeclaration(BoundNode node, ref BoundStatement iterationVarDecl)
1290private void InstrumentForEachStatement(BoundNode node, ref BoundStatement result)
Lowering\LocalRewriter\LocalRewriter_ForStatement.cs (18)
19var rewrittenInitializer = VisitStatement(node.Initializer);
21var rewrittenIncrement = VisitStatement(node.Increment);
22var rewrittenBody = VisitStatement(node.Body);
40private BoundStatement RewriteForStatementWithoutInnerLocals(
43BoundStatement? rewrittenInitializer,
45BoundStatement? rewrittenIncrement,
46BoundStatement rewrittenBody,
74var statementBuilder = ArrayBuilder<BoundStatement>.GetInstance();
104BoundStatement gotoEnd = new BoundGotoStatement(syntax, endLabel);
134BoundStatement? branchBack = null;
172private BoundStatement RewriteForStatement(
174BoundStatement? rewrittenInitializer,
176BoundStatement? rewrittenIncrement,
177BoundStatement rewrittenBody)
216var statementBuilder = ArrayBuilder<BoundStatement>.GetInstance();
227BoundStatement startLabelStatement = new BoundLabelStatement(syntax, startLabel);
236var blockBuilder = ArrayBuilder<BoundStatement>.GetInstance();
241BoundStatement ifNotConditionGotoBreak = new BoundConditionalGoto(rewrittenCondition.Syntax, rewrittenCondition, false, node.BreakLabel);
Lowering\LocalRewriter\LocalRewriter_UsingStatement.cs (17)
37BoundStatement? rewrittenBody = VisitStatement(node.Body);
62private BoundStatement MakeDeclarationUsingStatement(SyntaxNode syntax,
83ImmutableArray.Create<BoundStatement>(result));
89private BoundStatement MakeLocalUsingDeclarationStatement(BoundUsingLocalDeclarations usingDeclarations, ImmutableArray<BoundStatement> statements)
94var usingStatement = MakeDeclarationUsingStatement(syntax,
184BoundStatement expressionStatement = new BoundExpressionStatement(expressionSyntax, tempAssignment);
190BoundStatement tryFinally = RewriteUsingStatementTryFinally(usingSyntax, usingSyntax, tryBlock, boundTemp, usingSyntax.AwaitKeyword, node.AwaitOpt, node.PatternDisposeInfoOpt);
196statements: ImmutableArray.Create<BoundStatement>(expressionStatement, tryFinally));
223BoundStatement? rewrittenDeclaration = VisitStatement(localDeclaration);
254BoundStatement tryFinally = RewriteUsingStatementTryFinally(usingSyntax, declarationSyntax, tryBlock, boundTemp, awaitKeywordOpt, awaitOpt, patternDisposeInfo);
259statements: ImmutableArray.Create<BoundStatement>(
266BoundStatement tryFinally = RewriteUsingStatementTryFinally(usingSyntax, declarationSyntax, tryBlock, boundLocal, awaitKeywordOpt, awaitOpt, patternDisposeInfo);
279private BoundStatement RewriteUsingStatementTryFinally(
376BoundStatement disposeStatement = new BoundExpressionStatement(resourceSyntax, disposeCall);
395BoundStatement finallyStatement;
419BoundStatement tryFinally = new BoundTryStatement(
Lowering\LocalRewriter\LocalRewriter_WhileStatement.cs (9)
21var rewrittenBody = VisitStatement(node.Body);
41private BoundStatement RewriteWhileStatement(
44BoundStatement rewrittenBody,
67BoundStatement ifConditionGotoStart = new BoundConditionalGoto(rewrittenCondition.Syntax, rewrittenCondition, true, startLabel);
68BoundStatement gotoContinue = new BoundGotoStatement(syntax, continueLabel);
106private BoundStatement RewriteWhileStatement(
110BoundStatement rewrittenBody,
137BoundStatement continueLabelStatement = new BoundLabelStatement(syntax, continueLabel);
138BoundStatement ifNotConditionGotoBreak = new BoundConditionalGoto(rewrittenCondition.Syntax, rewrittenCondition, false, breakLabel);
Lowering\SpillSequenceSpiller.cs (18)
42private ArrayBuilder<BoundStatement> _statements;
72public ImmutableArray<BoundStatement> GetStatements()
76return ImmutableArray<BoundStatement>.Empty;
140public void AddStatement(BoundStatement statement)
144_statements = ArrayBuilder<BoundStatement>.GetInstance();
150public void AddStatements(ImmutableArray<BoundStatement> statements)
152foreach (var statement in statements)
232internal static BoundStatement Rewrite(BoundStatement body, MethodSymbol method, TypeCompilationState compilationState, BindingDiagnosticBag diagnostics)
241return (BoundStatement)result;
282private BoundStatement UpdateStatement(BoundSpillSequenceBuilder builder, BoundStatement statement)
742Debug.Assert(!(node is BoundStatement));
1338var whenNotNullStatement = UpdateStatement(whenNotNullBuilder, _F.ExpressionStatement(whenNotNull));
1350var whenNotNullStatement = UpdateStatement(whenNotNullBuilder, _F.Assignment(_F.Local(tmp), whenNotNull));
1382public static BoundStatement Replace(BoundNode node, BoundExpression receiver, int receiverID, int recursionDepth)
1385var result = (BoundStatement)replacer.Visit(node);
Lowering\StateMachineRewriter\MethodToStateMachineRewriter.cs (16)
177protected abstract BoundStatement GenerateReturn(bool finished);
250protected BoundStatement Dispatch(bool isOutermost)
256var result = F.Switch(F.Local(cachedState), sections.ToImmutableArray());
266var missingStateDispatch = GenerateMissingStateDispatch();
276protected virtual BoundStatement? GenerateMissingStateDispatch()
301private BoundStatement PossibleIteratorScope(ImmutableArray<LocalSymbol> locals, Func<BoundStatement> wrapped)
347var translatedStatement = wrapped();
388F.Block(variableCleanup.SelectAsArray((e, f) => (BoundStatement)f.ExpressionStatement(e), F)));
407internal BoundBlock MakeStateMachineScope(ImmutableArray<StateMachineFieldSymbol> hoistedLocals, BoundStatement statement)
415internal static bool TryUnwrapBoundStateMachineScope(ref BoundStatement statement, out ImmutableArray<StateMachineFieldSymbol> hoistedLocals)
459var result = F.Block(variableCleanup.SelectAsArray((e, f) => (BoundStatement)f.ExpressionStatement(e), F));
567BoundStatement translated;
735BoundBlock tryBlock = F.Block((BoundStatement)this.Visit(node.TryBlock));
762BoundStatement result = node.Update(tryBlock, catchBlocks, finallyBlockOpt, node.FinallyLabelOpt, node.PreferFaultHandler);
794protected BoundStatement CacheThisIfNeeded()
Lowering\StateMachineRewriter\StateMachineRewriter.cs (15)
19protected readonly BoundStatement body;
38BoundStatement body,
81protected abstract void InitializeStateMachine(ArrayBuilder<BoundStatement> bodyBuilder, NamedTypeSymbol frameType, LocalSymbol stateMachineLocal);
86protected abstract BoundStatement GenerateStateMachineCreation(LocalSymbol stateMachineVariable, NamedTypeSymbol frameType, IReadOnlyDictionary<Symbol, CapturedSymbolReplacement> proxies);
93protected BoundStatement Rewrite()
287private BoundStatement GenerateKickoffMethodBody()
290var bodyBuilder = ArrayBuilder<BoundStatement>.GetInstance();
306protected BoundStatement GenerateParameterStorage(LocalSymbol stateMachineVariable, IReadOnlyDictionary<Symbol, CapturedSymbolReplacement> proxies)
308var bodyBuilder = ArrayBuilder<BoundStatement>.GetInstance();
425var bodyBuilder = ArrayBuilder<BoundStatement>.GetInstance();
429BoundStatement makeIterator = F.Assignment(F.Local(resultVariable), F.New(stateMachineType.Constructor, F.Literal(initialState)));
437var thenBuilder = ArrayBuilder<BoundStatement>.GetInstance(4);
498BoundStatement copy = InitializeParameterField(getEnumeratorMethod, parameter, resultParameter, parameterProxy);
512protected virtual void GenerateResetInstance(ArrayBuilder<BoundStatement> builder, StateMachineState initialState)
519protected virtual BoundStatement InitializeParameterField(MethodSymbol getEnumeratorMethod, ParameterSymbol parameter, BoundExpression resultParameter, BoundExpression parameterProxy)
Lowering\SyntheticBoundNodeFactory.cs (46)
453return Block(ImmutableArray<BoundStatement>.Empty);
456public BoundBlock Block(ImmutableArray<BoundStatement> statements)
461public BoundBlock Block(params BoundStatement[] statements)
466public BoundBlock Block(ImmutableArray<LocalSymbol> locals, params BoundStatement[] statements)
471public BoundBlock Block(ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundStatement> statements)
476public BoundBlock Block(ImmutableArray<LocalSymbol> locals, ImmutableArray<LocalFunctionSymbol> localFunctions, params BoundStatement[] statements)
481public BoundBlock Block(ImmutableArray<LocalSymbol> locals, ImmutableArray<LocalFunctionSymbol> localFunctions, ImmutableArray<BoundStatement> statements)
486public BoundBlock Block(ImmutableArray<LocalSymbol> locals, ImmutableArray<MethodSymbol> localFunctions, ImmutableArray<BoundStatement> statements)
498return StatementList(ImmutableArray<BoundStatement>.Empty);
501public BoundStatementList StatementList(ImmutableArray<BoundStatement> statements)
506public BoundStatementList StatementList(BoundStatement first, BoundStatement second)
512public BoundStatement? Concat(BoundStatement? first, BoundStatement? second)
515public BoundBlockInstrumentation CombineInstrumentation(BoundBlockInstrumentation? innerInstrumentation = null, LocalSymbol? local = null, BoundStatement? prologue = null, BoundStatement? epilogue = null)
530public BoundStatement Instrument(BoundStatement statement, BoundBlockInstrumentation? instrumentation)
537var statements = new TemporaryArray<BoundStatement>();
583public void CloseMethod(BoundStatement body)
948public BoundStatement If(BoundExpression condition, BoundStatement thenClause, BoundStatement? elseClauseOpt = null)
953public BoundStatement ConditionalGoto(BoundExpression condition, LabelSymbol label, bool jumpIfTrue)
958public BoundStatement If(BoundExpression condition, ImmutableArray<LocalSymbol> locals, BoundStatement thenClause, BoundStatement? elseClauseOpt = null)
973var statements = ArrayBuilder<BoundStatement>.GetInstance();
1067public BoundSpillSequence SpillSequence(ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundStatement> sideEffects, BoundExpression result)
1079public readonly ImmutableArray<BoundStatement> Statements;
1081public SyntheticSwitchSection(ImmutableArray<int> values, ImmutableArray<BoundStatement> statements)
1088public SyntheticSwitchSection SwitchSection(int value, params BoundStatement[] statements)
1091public SyntheticSwitchSection SwitchSection(ImmutableArray<int> values, params BoundStatement[] statements)
1097public BoundStatement Switch(BoundExpression ex, ImmutableArray<SyntheticSwitchSection> sections)
1111var statements = ArrayBuilder<BoundStatement>.GetInstance();
1217public BoundStatement BaseInitialization()
1226public BoundStatement SequencePoint(SyntaxNode syntax, BoundStatement statement)
1231public BoundStatement SequencePointWithSpan(CSharpSyntaxNode syntax, TextSpan span, BoundStatement statement)
1236public BoundStatement HiddenSequencePoint(BoundStatement? statementOpt = null)
1241public BoundStatement ThrowNull()
1589internal BoundStatement Try(
1719internal BoundStatement NoOp(NoOpStatementFlavor noOpStatementFlavor)
Symbols\Synthesized\ReadOnlyListType\SynthesizedReadOnlyListTypeSymbol.cs (12)
472static BoundStatement generateGetEnumerator(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
504static BoundStatement generateCount(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
532static BoundStatement generateIsSynchronized(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
539static BoundStatement generateSyncRoot(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
557static BoundStatement generateIsFixedSize(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
564static BoundStatement generateIsReadOnly(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
571static BoundStatement generateContains(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
614static BoundStatement generateCopyTo(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
621BoundStatement statement;
683static BoundStatement generateIndexer(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
717static BoundStatement generateIndexOf(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
763static BoundStatement generateNotSupportedException(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
Symbols\Synthesized\SynthesizedEmbeddedNullableAttributeSymbol.cs (5)
76private void GenerateByteArrayConstructorBody(SyntheticBoundNodeFactory factory, ArrayBuilder<BoundStatement> statements, ImmutableArray<ParameterSymbol> parameters)
90private void GenerateSingleByteConstructorBody(SyntheticBoundNodeFactory factory, ArrayBuilder<BoundStatement> statements, ImmutableArray<ParameterSymbol> parameters)
114private readonly Action<SyntheticBoundNodeFactory, ArrayBuilder<BoundStatement>, ImmutableArray<ParameterSymbol>> _getConstructorBody;
119Action<SyntheticBoundNodeFactory, ArrayBuilder<BoundStatement>, ImmutableArray<ParameterSymbol>> getConstructorBody) :
133internal override void GenerateMethodBodyStatements(SyntheticBoundNodeFactory factory, ArrayBuilder<BoundStatement> statements, BindingDiagnosticBag diagnostics) => _getConstructorBody(factory, statements, _parameters);