Binder\Binder_Statements.cs (51)
39public virtual BoundStatement BindStatement(StatementSyntax node, BindingDiagnosticBag diagnostics)
59BoundStatement result;
164private BoundStatement BindCheckedStatement(CheckedStatementSyntax node, BindingDiagnosticBag diagnostics)
169private BoundStatement BindUnsafeStatement(UnsafeStatementSyntax node, BindingDiagnosticBag diagnostics)
187private BoundStatement BindFixedStatement(FixedStatementSyntax node, BindingDiagnosticBag diagnostics)
197private BoundStatement BindFixedStatementParts(FixedStatementSyntax node, BindingDiagnosticBag diagnostics)
208BoundStatement boundBody = BindPossibleEmbeddedStatement(node.Statement, diagnostics);
235private BoundStatement BindYieldReturnStatement(YieldStatementSyntax node, BindingDiagnosticBag diagnostics)
276private BoundStatement BindYieldBreakStatement(YieldStatementSyntax node, BindingDiagnosticBag diagnostics)
292private BoundStatement BindLockStatement(LockStatementSyntax node, BindingDiagnosticBag diagnostics)
299internal virtual BoundStatement BindLockStatementParts(BindingDiagnosticBag diagnostics, Binder originalBinder)
304private BoundStatement BindUsingStatement(UsingStatementSyntax node, BindingDiagnosticBag diagnostics)
311internal virtual BoundStatement BindUsingStatementParts(BindingDiagnosticBag diagnostics, Binder originalBinder)
316internal BoundStatement BindPossibleEmbeddedStatement(StatementSyntax node, BindingDiagnosticBag diagnostics)
431private BoundStatement BindThrow(ThrowStatementSyntax node, BindingDiagnosticBag diagnostics)
461private static BoundStatement BindEmpty(EmptyStatementSyntax node)
503var body = BindStatement(node.Statement, diagnostics);
507private BoundStatement BindGoto(GotoStatementSyntax node, BindingDiagnosticBag diagnostics)
551private BoundStatement BindLocalFunctionStatement(LocalFunctionStatementSyntax node, BindingDiagnosticBag diagnostics)
639public BoundStatement BindExpressionStatement(ExpressionStatementSyntax node, BindingDiagnosticBag diagnostics)
683internal BoundStatement BindLocalDeclarationStatement(LocalDeclarationStatementSyntax node, BindingDiagnosticBag diagnostics)
695private BoundStatement BindUsingDeclarationStatementParts(LocalDeclarationStatementSyntax node, BindingDiagnosticBag diagnostics)
697var usingDeclaration = UsingStatementBinder.BindUsingStatementOrDeclarationFromParts(node, node.UsingKeyword, node.AwaitKeyword, originalBinder: this, usingBinderOpt: null, diagnostics);
702private BoundStatement BindDeclarationStatementParts(LocalDeclarationStatementSyntax node, BindingDiagnosticBag diagnostics)
1872ArrayBuilder<BoundStatement> boundStatements = ArrayBuilder<BoundStatement>.GetInstance(nStatements);
1876var boundStatement = BindStatement(syntaxStatements[i], diagnostics);
1883private BoundBlock FinishBindBlockParts(CSharpSyntaxNode node, ImmutableArray<BoundStatement> boundStatements)
2492private BoundStatement BindIfStatement(IfStatementSyntax node, BindingDiagnosticBag diagnostics)
2495var consequence = BindPossibleEmbeddedStatement(node.Statement, diagnostics);
2496BoundStatement alternative = (node.Else == null) ? null : BindPossibleEmbeddedStatement(node.Else.Statement, diagnostics);
2498BoundStatement result = new BoundIfStatement(node, condition, consequence, alternative);
2637private BoundStatement BindSwitchStatement(SwitchStatementSyntax node, BindingDiagnosticBag diagnostics)
2644internal virtual BoundStatement BindSwitchStatementCore(SwitchStatementSyntax node, Binder originalBinder, BindingDiagnosticBag diagnostics)
2654private BoundStatement BindWhile(WhileStatementSyntax node, BindingDiagnosticBag diagnostics)
2668private BoundStatement BindDo(DoStatementSyntax node, BindingDiagnosticBag diagnostics)
2693internal BoundStatement BindForOrUsingOrFixedDeclarations(VariableDeclarationSyntax nodeOpt, LocalDeclarationKind localKind, BindingDiagnosticBag diagnostics, out ImmutableArray<BoundLocalDeclaration> declarations)
2750(BoundStatement)declarations[0] :
2754internal BoundStatement BindStatementExpressionList(SeparatedSyntaxList<ExpressionSyntax> statements, BindingDiagnosticBag diagnostics)
2768var statementBuilder = ArrayBuilder<BoundStatement>.GetInstance();
2779private BoundStatement BindForEach(CommonForEachStatementSyntax node, BindingDiagnosticBag diagnostics)
2785internal virtual BoundStatement BindForEachParts(BindingDiagnosticBag diagnostics, Binder originalBinder)
2793internal virtual BoundStatement BindForEachDeconstruction(BindingDiagnosticBag diagnostics, Binder originalBinder)
2798private BoundStatement BindBreak(BreakStatementSyntax node, BindingDiagnosticBag diagnostics)
2809private BoundStatement BindContinue(ContinueStatementSyntax node, BindingDiagnosticBag diagnostics)
2886private BoundStatement BindReturn(ReturnStatementSyntax syntax, BindingDiagnosticBag diagnostics)
3351BoundStatement statement;
3554ArrayBuilder<BoundStatement> boundStatements = ArrayBuilder<BoundStatement>.GetInstance();
3566var boundStatement = BindStatement(topLevelStatement.Statement, diagnostics);
3599blockBody: 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)
551public static BoundStatementList Synthesized(SyntaxNode syntax, params BoundStatement[] statements)
556public static BoundStatementList Synthesized(SyntaxNode syntax, bool hasErrors, params BoundStatement[] statements)
561public static BoundStatementList Synthesized(SyntaxNode syntax, ImmutableArray<BoundStatement> statements)
566public static BoundStatementList Synthesized(SyntaxNode syntax, bool hasErrors, ImmutableArray<BoundStatement> statements)
598public BoundBlock(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundStatement> statements, bool hasErrors = false)
603public static BoundBlock SynthesizedNoLocals(SyntaxNode syntax, BoundStatement statement)
609public static BoundBlock SynthesizedNoLocals(SyntaxNode syntax, ImmutableArray<BoundStatement> statements)
614public static BoundBlock SynthesizedNoLocals(SyntaxNode syntax, params BoundStatement[] statements)
Compiler\MethodBodySynthesizer.cs (22)
22internal static ImmutableArray<BoundStatement> ConstructScriptConstructorBody(
23BoundStatement loweredBody,
42BoundStatement baseConstructorCall =
60var statements = ArrayBuilder<BoundStatement>.GetInstance();
83ArrayBuilder<BoundStatement> statements,
188BoundStatement statement;
308BoundStatement returnStatement = BoundReturnStatement.Synthesized(syntax, RefKind.None, processHandlerCall);
317BoundStatement callStatement = new BoundExpressionStatement(syntax, processHandlerCall);
318BoundStatement returnStatement = new BoundReturnStatement(syntax, RefKind.None, expressionOpt: null, @checked: false);
354BoundStatement @return = new BoundReturnStatement(syntax,
403BoundStatement eventUpdate = new BoundExpressionStatement(syntax,
412statements: ImmutableArray.Create<BoundStatement>(
435BoundStatement tmp0Init = new BoundExpressionStatement(syntax,
444BoundStatement loopStart = new BoundLabelStatement(syntax,
449BoundStatement tmp1Update = new BoundExpressionStatement(syntax,
467BoundStatement tmp2Update = new BoundExpressionStatement(syntax,
482BoundStatement tmp0Update = new BoundExpressionStatement(syntax,
503BoundStatement loopEnd = new BoundConditionalGoto(syntax,
511statements: ImmutableArray.Create<BoundStatement>(
536BoundStatement baseFinalizeCall = new BoundExpressionStatement(
559ImmutableArray.Create<BoundStatement>(
567ImmutableArray.Create<BoundStatement>(
Compiler\MethodCompiler.cs (23)
250BoundStatement body = synthesizedEntryPoint.CreateBody(diagnostics);
263var loweredBody = LowerBodyOrInitializer(
747BoundStatement loweredBody = IteratorRewriter.Rewrite(methodWithBody.Body, method, methodOrdinal, stateMachineStateDebugInfoBuilder, variableSlotAllocatorOpt, compilationState, diagnosticsThisMethod, out iteratorStateMachine);
1012body = new BoundBlock(methodSymbol.GetNonNullSyntaxNode(), ImmutableArray<LocalSymbol>.Empty, ImmutableArray<BoundStatement>.Empty) { WasCompilerGenerated = true };
1215BoundStatement loweredBodyOpt = null;
1258ImmutableArray<BoundStatement> boundStatements;
1266boundStatements = ImmutableArray<BoundStatement>.Empty;
1276var initializers = ArrayBuilder<BoundStatement>.GetInstance(capturedParameters.Count);
1296BoundStatement lowered = LowerBodyOrInitializer(
1401internal static BoundStatement LowerBodyOrInitializer(
1404BoundStatement body,
1428var loweredBody = LocalRewriter.Rewrite(
1472BoundStatement bodyWithoutLambdas = loweredBody;
1495BoundStatement bodyWithoutIterators = IteratorRewriter.Rewrite(bodyWithoutLambdas, method, methodOrdinal, stateMachineStateDebugInfoBuilder, lazyVariableSlotAllocator, compilationState, diagnostics,
1503BoundStatement bodyWithoutAsync = AsyncRewriter.Rewrite(bodyWithoutIterators, method, methodOrdinal, stateMachineStateDebugInfoBuilder, lazyVariableSlotAllocator, compilationState, diagnostics,
1526BoundStatement block,
1895body = new BoundBlock(constructor.Syntax, constructor.Locals, ImmutableArray.Create<BoundStatement>(constructor.Initializer));
1899body = new BoundBlock(constructor.Syntax, constructor.Locals, ImmutableArray.Create<BoundStatement>(constructor.Initializer, body));
1946var stmts = ArrayBuilder<BoundStatement>.GetInstance();
1978var constructorInitializer = BindImplicitConstructorInitializerIfAny(method, compilationState, diagnostics);
1979ImmutableArray<BoundStatement> statements;
1988statements = ImmutableArray<BoundStatement>.Empty;
2271private static BoundStatement BindImplicitConstructorInitializerIfAny(MethodSymbol method, TypeCompilationState compilationState, BindingDiagnosticBag diagnostics)
FlowAnalysis\AbstractFlowPass.cs (20)
93private PooledHashSet<BoundStatement> _labelsSeen;
210_labelsSeen = PooledHashSet<BoundStatement>.GetInstance();
663protected virtual void VisitStatement(BoundStatement statement)
755protected virtual void NoteBranch(PendingBranch pending, BoundNode gotoStmt, BoundStatement target)
766private bool ResolveBranches(LabelSymbol label, BoundStatement? target)
785protected virtual void ResolveBranch(PendingBranch pending, LabelSymbol label, BoundStatement? target, ref bool labelStateChanged)
804public readonly PooledHashSet<BoundStatement> LabelsSeen;
806public SavedPending(PendingBranchesCollection pendingBranches, PooledHashSet<BoundStatement> labelsSeen)
824_labelsSeen = PooledHashSet<BoundStatement>.GetInstance();
838foreach (var node in _labelsSeen)
1255private void VisitStatements(ImmutableArray<BoundStatement> statements)
1257foreach (var statement in statements)
1492if (child is BoundStatement)
1494VisitStatement(child as BoundStatement);
1767private void VisitTryBlockWithAnyTransferFunction(BoundStatement tryBlock, BoundTryStatement node, ref TLocalState tryState)
1791protected virtual void VisitTryBlock(BoundStatement tryBlock, BoundTryStatement node, ref TLocalState tryState)
1841private void VisitFinallyBlockWithAnyTransferFunction(BoundStatement finallyBlock, ref TLocalState stateMovedUp)
1865protected virtual void VisitFinallyBlock(BoundStatement finallyBlock, ref TLocalState stateMovedUp)
3007foreach (var statement in node.Statements)
3145protected void VisitLabel(LabelSymbol label, BoundStatement node)
Generated\BoundNodes.xml.Generated.cs (144)
386public BoundGlobalStatementInitializer(SyntaxNode syntax, BoundStatement statement, bool hasErrors = false)
395public BoundStatement Statement { get; }
400public BoundGlobalStatementInitializer Update(BoundStatement statement)
2218public BoundBlockInstrumentation(SyntaxNode syntax, LocalSymbol local, BoundStatement prologue, BoundStatement epilogue, bool hasErrors = false)
2232public BoundStatement Prologue { get; }
2233public BoundStatement Epilogue { get; }
2238public BoundBlockInstrumentation Update(LocalSymbol local, BoundStatement prologue, BoundStatement epilogue)
3036public BoundSequencePoint(SyntaxNode syntax, BoundStatement? statementOpt, bool hasErrors = false)
3042public BoundStatement? StatementOpt { get; }
3047public BoundSequencePoint Update(BoundStatement? statementOpt)
3061public BoundSequencePointWithSpan(SyntaxNode syntax, BoundStatement? statementOpt, TextSpan span, bool hasErrors = false)
3068public BoundStatement? StatementOpt { get; }
3074public BoundSequencePointWithSpan Update(BoundStatement? statementOpt, TextSpan span)
3193public BoundBlock(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, ImmutableArray<LocalFunctionSymbol> localFunctions, bool hasUnsafeModifier, BoundBlockInstrumentation? instrumentation, ImmutableArray<BoundStatement> statements, bool hasErrors = false)
3215public BoundBlock Update(ImmutableArray<LocalSymbol> locals, ImmutableArray<LocalFunctionSymbol> localFunctions, bool hasUnsafeModifier, BoundBlockInstrumentation? instrumentation, ImmutableArray<BoundStatement> statements)
3229public BoundScope(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundStatement> statements, bool hasErrors = false)
3244public BoundScope Update(ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundStatement> statements)
3258public BoundStateMachineScope(SyntaxNode syntax, ImmutableArray<StateMachineFieldSymbol> fields, BoundStatement statement, bool hasErrors = false)
3270public BoundStatement Statement { get; }
3275public BoundStateMachineScope Update(ImmutableArray<StateMachineFieldSymbol> fields, BoundStatement statement)
3740public BoundIfStatement(SyntaxNode syntax, BoundExpression condition, BoundStatement consequence, BoundStatement? alternativeOpt, bool hasErrors = false)
3753public BoundStatement Consequence { get; }
3754public BoundStatement? AlternativeOpt { get; }
3759public BoundIfStatement Update(BoundExpression condition, BoundStatement consequence, BoundStatement? alternativeOpt)
3801protected BoundConditionalLoopStatement(BoundKind kind, SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, BoundExpression condition, BoundStatement body, GeneratedLabelSymbol breakLabel, GeneratedLabelSymbol continueLabel, bool hasErrors = false)
3818public BoundStatement Body { get; }
3823public BoundDoStatement(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, BoundExpression condition, BoundStatement body, GeneratedLabelSymbol breakLabel, GeneratedLabelSymbol continueLabel, bool hasErrors = false)
3839public BoundDoStatement Update(ImmutableArray<LocalSymbol> locals, BoundExpression condition, BoundStatement body, GeneratedLabelSymbol breakLabel, GeneratedLabelSymbol continueLabel)
3853public BoundWhileStatement(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, BoundExpression condition, BoundStatement body, GeneratedLabelSymbol breakLabel, GeneratedLabelSymbol continueLabel, bool hasErrors = false)
3869public BoundWhileStatement Update(ImmutableArray<LocalSymbol> locals, BoundExpression condition, BoundStatement body, GeneratedLabelSymbol breakLabel, GeneratedLabelSymbol continueLabel)
3883public BoundForStatement(SyntaxNode syntax, ImmutableArray<LocalSymbol> outerLocals, BoundStatement? initializer, ImmutableArray<LocalSymbol> innerLocals, BoundExpression? condition, BoundStatement? increment, BoundStatement body, GeneratedLabelSymbol breakLabel, GeneratedLabelSymbol continueLabel, bool hasErrors = false)
3902public BoundStatement? Initializer { get; }
3905public BoundStatement? Increment { get; }
3906public BoundStatement Body { get; }
3911public BoundForStatement Update(ImmutableArray<LocalSymbol> outerLocals, BoundStatement? initializer, ImmutableArray<LocalSymbol> innerLocals, BoundExpression? condition, BoundStatement? increment, BoundStatement body, GeneratedLabelSymbol breakLabel, GeneratedLabelSymbol continueLabel)
3925public BoundForEachStatement(SyntaxNode syntax, ForEachEnumeratorInfo? enumeratorInfoOpt, BoundValuePlaceholder? elementPlaceholder, BoundExpression? elementConversion, BoundTypeExpression iterationVariableType, ImmutableArray<LocalSymbol> iterationVariables, BoundExpression? iterationErrorExpressionOpt, BoundExpression expression, BoundForEachDeconstructStep? deconstructionOpt, BoundAwaitableInfo? awaitOpt, BoundStatement body, GeneratedLabelSymbol breakLabel, GeneratedLabelSymbol continueLabel, bool hasErrors = false)
3957public BoundStatement Body { get; }
3962public BoundForEachStatement Update(ForEachEnumeratorInfo? enumeratorInfoOpt, BoundValuePlaceholder? elementPlaceholder, BoundExpression? elementConversion, BoundTypeExpression iterationVariableType, ImmutableArray<LocalSymbol> iterationVariables, BoundExpression? iterationErrorExpressionOpt, BoundExpression expression, BoundForEachDeconstructStep? deconstructionOpt, BoundAwaitableInfo? awaitOpt, BoundStatement body, GeneratedLabelSymbol breakLabel, GeneratedLabelSymbol continueLabel)
4007public BoundUsingStatement(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, BoundMultipleLocalDeclarations? declarationsOpt, BoundExpression? expressionOpt, BoundStatement body, BoundAwaitableInfo? awaitOpt, MethodArgumentInfo? patternDisposeInfoOpt, bool hasErrors = false)
4025public BoundStatement Body { get; }
4032public BoundUsingStatement Update(ImmutableArray<LocalSymbol> locals, BoundMultipleLocalDeclarations? declarationsOpt, BoundExpression? expressionOpt, BoundStatement body, BoundAwaitableInfo? awaitOpt, MethodArgumentInfo? patternDisposeInfoOpt)
4046public BoundFixedStatement(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, BoundMultipleLocalDeclarations declarations, BoundStatement body, bool hasErrors = false)
4061public BoundStatement Body { get; }
4066public BoundFixedStatement Update(ImmutableArray<LocalSymbol> locals, BoundMultipleLocalDeclarations declarations, BoundStatement body)
4080public BoundLockStatement(SyntaxNode syntax, BoundExpression argument, BoundStatement body, bool hasErrors = false)
4092public BoundStatement Body { get; }
4097public BoundLockStatement Update(BoundExpression argument, BoundStatement body)
4630public BoundLabeledStatement(SyntaxNode syntax, LabelSymbol label, BoundStatement body, bool hasErrors = false)
4642public BoundStatement Body { get; }
4647public BoundLabeledStatement Update(LabelSymbol label, BoundStatement body)
4698protected BoundStatementList(BoundKind kind, SyntaxNode syntax, ImmutableArray<BoundStatement> statements, bool hasErrors = false)
4707public BoundStatementList(SyntaxNode syntax, ImmutableArray<BoundStatement> statements, bool hasErrors = false)
4716public ImmutableArray<BoundStatement> Statements { get; }
4721public BoundStatementList Update(ImmutableArray<BoundStatement> statements)
5547public BoundSwitchSection(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundSwitchLabel> switchLabels, ImmutableArray<BoundStatement> statements, bool hasErrors = false)
5565public BoundSwitchSection Update(ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundSwitchLabel> switchLabels, ImmutableArray<BoundStatement> statements)
5690public BoundSpillSequence(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundStatement> sideEffects, BoundExpression value, TypeSymbol type, bool hasErrors = false)
5706public ImmutableArray<BoundStatement> SideEffects { get; }
5712public BoundSpillSequence Update(ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundStatement> sideEffects, BoundExpression value, TypeSymbol type)
7399public BoundTypeOrInstanceInitializers(SyntaxNode syntax, ImmutableArray<BoundStatement> statements, bool hasErrors = false)
7411public new BoundTypeOrInstanceInitializers Update(ImmutableArray<BoundStatement> statements)
8412public BoundConstructorMethodBody(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, BoundStatement? initializer, BoundBlock? blockBody, BoundBlock? expressionBody, bool hasErrors = false)
8423public BoundStatement? Initializer { get; }
8428public BoundConstructorMethodBody Update(ImmutableArray<LocalSymbol> locals, BoundStatement? initializer, BoundBlock? blockBody, BoundBlock? expressionBody)
10437BoundStatement statement = (BoundStatement)this.Visit(node.Statement);
10751BoundStatement prologue = (BoundStatement)this.Visit(node.Prologue);
10752BoundStatement epilogue = (BoundStatement)this.Visit(node.Epilogue);
10877BoundStatement? statementOpt = (BoundStatement?)this.Visit(node.StatementOpt);
10882BoundStatement? statementOpt = (BoundStatement?)this.Visit(node.StatementOpt);
10891ImmutableArray<BoundStatement> statements = this.VisitList(node.Statements);
10896ImmutableArray<BoundStatement> statements = this.VisitList(node.Statements);
10901BoundStatement statement = (BoundStatement)this.Visit(node.Statement);
10968BoundStatement consequence = (BoundStatement)this.Visit(node.Consequence);
10969BoundStatement? alternativeOpt = (BoundStatement?)this.Visit(node.AlternativeOpt);
10975BoundStatement body = (BoundStatement)this.Visit(node.Body);
10981BoundStatement body = (BoundStatement)this.Visit(node.Body);
10986BoundStatement? initializer = (BoundStatement?)this.Visit(node.Initializer);
10988BoundStatement? increment = (BoundStatement?)this.Visit(node.Increment);
10989BoundStatement body = (BoundStatement)this.Visit(node.Body);
11001BoundStatement body = (BoundStatement)this.Visit(node.Body);
11014BoundStatement body = (BoundStatement)this.Visit(node.Body);
11021BoundStatement body = (BoundStatement)this.Visit(node.Body);
11027BoundStatement body = (BoundStatement)this.Visit(node.Body);
11106BoundStatement body = (BoundStatement)this.Visit(node.Body);
11116ImmutableArray<BoundStatement> statements = this.VisitList(node.Statements);
11261ImmutableArray<BoundStatement> statements = this.VisitList(node.Statements);
11285ImmutableArray<BoundStatement> sideEffects = this.VisitList(node.SideEffects);
11572ImmutableArray<BoundStatement> statements = this.VisitList(node.Statements);
11761BoundStatement? initializer = (BoundStatement?)this.Visit(node.Initializer);
12548BoundStatement prologue = (BoundStatement)this.Visit(node.Prologue);
12549BoundStatement epilogue = (BoundStatement)this.Visit(node.Epilogue);
12889ImmutableArray<BoundStatement> statements = this.VisitList(node.Statements);
12896ImmutableArray<BoundStatement> statements = this.VisitList(node.Statements);
12903BoundStatement statement = (BoundStatement)this.Visit(node.Statement);
12939BoundStatement body = (BoundStatement)this.Visit(node.Body);
12947BoundStatement body = (BoundStatement)this.Visit(node.Body);
12955BoundStatement? initializer = (BoundStatement?)this.Visit(node.Initializer);
12957BoundStatement? increment = (BoundStatement?)this.Visit(node.Increment);
12958BoundStatement body = (BoundStatement)this.Visit(node.Body);
12972BoundStatement body = (BoundStatement)this.Visit(node.Body);
12981BoundStatement body = (BoundStatement)this.Visit(node.Body);
12990BoundStatement body = (BoundStatement)this.Visit(node.Body);
13260ImmutableArray<BoundStatement> statements = this.VisitList(node.Statements);
13303ImmutableArray<BoundStatement> sideEffects = this.VisitList(node.SideEffects);
14378BoundStatement? 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;
262protected override BoundStatement GenerateStateMachineCreation(LocalSymbol stateMachineVariable, NamedTypeSymbol frameType, IReadOnlyDictionary<Symbol, CapturedSymbolReplacement> proxies)
264var bodyBuilder = ArrayBuilder<BoundStatement>.GetInstance();
325out BoundStatement instAssignment,
329BoundStatement ifFinished = F.If(
340var ifPromiseReady = F.If(
367private void GetPartsForStartingMachine(out BoundExpressionStatement callReset, out LocalSymbol instSymbol, out BoundStatement instAssignment,
435out BoundStatement instAssignment,
439BoundStatement ifInvalidState = F.If(
445BoundStatement ifFinished = F.If(
662protected 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 InstrumentIfStatement(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)
37public override BoundStatement InstrumentNoOpStatement(BoundNoOpStatement original, BoundStatement rewritten)
42public override BoundStatement InstrumentYieldBreakStatement(BoundYieldBreakStatement original, BoundStatement rewritten)
47public override BoundStatement InstrumentYieldReturnStatement(BoundYieldReturnStatement original, BoundStatement rewritten)
52public override BoundStatement InstrumentThrowStatement(BoundThrowStatement original, BoundStatement rewritten)
57public override BoundStatement InstrumentContinueStatement(BoundContinueStatement original, BoundStatement rewritten)
62public override BoundStatement InstrumentGotoStatement(BoundGotoStatement original, BoundStatement rewritten)
67public override BoundStatement InstrumentExpressionStatement(BoundExpressionStatement original, BoundStatement rewritten)
72public override BoundStatement InstrumentFieldOrPropertyInitializer(BoundStatement original, BoundStatement rewritten)
77public override BoundStatement InstrumentBreakStatement(BoundBreakStatement original, BoundStatement rewritten)
87public override void InstrumentBlock(BoundBlock original, LocalRewriter rewriter, ref TemporaryArray<LocalSymbol> additionalLocals, out BoundStatement? prologue, out BoundStatement? epilogue, out BoundBlockInstrumentation? instrumentation)
97public override BoundStatement InstrumentDoStatementConditionalGotoStart(BoundDoStatement original, BoundStatement ifConditionGotoStart)
102public override BoundStatement? InstrumentForEachStatementCollectionVarDeclaration(BoundForEachStatement original, BoundStatement? collectionVarDecl)
107public override BoundStatement InstrumentForEachStatement(BoundForEachStatement original, BoundStatement rewritten)
112public override BoundStatement InstrumentForEachStatementIterationVarDeclaration(BoundForEachStatement original, BoundStatement iterationVarDecl)
117public override BoundStatement InstrumentForStatementConditionalGotoStartOrBreak(BoundForStatement original, BoundStatement branchBack)
122public override BoundStatement InstrumentForEachStatementConditionalGotoStart(BoundForEachStatement original, BoundStatement branchBack)
132public override BoundStatement InstrumentIfStatement(BoundIfStatement original, BoundStatement rewritten)
142public override BoundStatement InstrumentLabelStatement(BoundLabeledStatement original, BoundStatement rewritten)
147public override BoundStatement InstrumentUserDefinedLocalInitialization(BoundLocalDeclaration original, BoundStatement rewritten)
172public override BoundStatement InstrumentLockTargetCapture(BoundLockStatement original, BoundStatement lockTargetCapture)
177public override BoundStatement InstrumentReturnStatement(BoundReturnStatement original, BoundStatement rewritten)
182public override BoundStatement InstrumentSwitchStatement(BoundSwitchStatement original, BoundStatement rewritten)
187public override BoundStatement InstrumentSwitchWhenClauseConditionalGotoBody(BoundExpression original, BoundStatement ifConditionGotoBody)
192public override BoundStatement InstrumentUsingTargetCapture(BoundUsingStatement original, BoundStatement usingTargetCapture)
202public override BoundStatement InstrumentWhileStatementConditionalGotoStartOrBreak(BoundWhileStatement original, BoundStatement ifConditionGotoStart)
226public override BoundExpression InstrumentSwitchStatementExpression(BoundStatement original, BoundExpression rewrittenExpression, SyntheticBoundNodeFactory factory)
236public override BoundStatement InstrumentSwitchBindCasePatternVariables(BoundStatement bindings)
241public 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)
78public override BoundStatement InstrumentFieldOrPropertyInitializer(BoundStatement original, BoundStatement rewritten)
92private static BoundStatement InstrumentFieldOrPropertyInitializer(BoundStatement rewritten, SyntaxNode syntax)
117public override BoundStatement InstrumentGotoStatement(BoundGotoStatement original, BoundStatement rewritten)
122public override BoundStatement InstrumentThrowStatement(BoundThrowStatement original, BoundStatement rewritten)
127public override BoundStatement InstrumentYieldBreakStatement(BoundYieldBreakStatement original, BoundStatement rewritten)
140public override BoundStatement InstrumentYieldReturnStatement(BoundYieldReturnStatement original, BoundStatement rewritten)
145public override void InstrumentBlock(BoundBlock original, LocalRewriter rewriter, ref TemporaryArray<LocalSymbol> additionalLocals, out BoundStatement? prologue, out BoundStatement? epilogue, out BoundBlockInstrumentation? instrumentation)
147base.InstrumentBlock(original, rewriter, ref additionalLocals, out var previousPrologue, out var previousEpilogue, out instrumentation);
196public override BoundStatement InstrumentDoStatementConditionalGotoStart(BoundDoStatement original, BoundStatement ifConditionGotoStart)
206public override BoundStatement InstrumentWhileStatementConditionalGotoStartOrBreak(BoundWhileStatement original, BoundStatement ifConditionGotoStart)
224public override BoundStatement InstrumentForEachStatementCollectionVarDeclaration(BoundForEachStatement original, BoundStatement? collectionVarDecl)
231public override BoundStatement InstrumentForEachStatementDeconstructionVariablesDeclaration(BoundForEachStatement original, BoundStatement iterationVarDecl)
245public override BoundStatement InstrumentForEachStatement(BoundForEachStatement original, BoundStatement rewritten)
254ImmutableArray.Create<BoundStatement>(foreachKeywordSequencePoint,
266public override BoundStatement InstrumentForEachStatementIterationVarDeclaration(BoundForEachStatement original, BoundStatement iterationVarDecl)
291public override BoundStatement InstrumentForStatementConditionalGotoStartOrBreak(BoundForStatement original, BoundStatement branchBack)
298public override BoundStatement InstrumentForEachStatementConditionalGotoStart(BoundForEachStatement original, BoundStatement branchBack)
313public override BoundStatement InstrumentIfStatement(BoundIfStatement original, BoundStatement rewritten)
332public override BoundStatement InstrumentLabelStatement(BoundLabeledStatement original, BoundStatement rewritten)
341public override BoundStatement InstrumentUserDefinedLocalInitialization(BoundLocalDeclaration original, BoundStatement rewritten)
349public override BoundStatement InstrumentLockTargetCapture(BoundLockStatement original, BoundStatement lockTargetCapture)
357public override BoundStatement InstrumentReturnStatement(BoundReturnStatement original, BoundStatement rewritten)
370public override BoundStatement InstrumentSwitchStatement(BoundSwitchStatement original, BoundStatement rewritten)
384public override BoundStatement InstrumentSwitchWhenClauseConditionalGotoBody(BoundExpression original, BoundStatement ifConditionGotoBody)
395public override BoundStatement InstrumentUsingTargetCapture(BoundUsingStatement original, BoundStatement usingTargetCapture)
433public override BoundExpression InstrumentSwitchStatementExpression(BoundStatement original, BoundExpression rewrittenExpression, SyntheticBoundNodeFactory factory)
445public override BoundStatement InstrumentSwitchBindCasePatternVariables(BoundStatement bindings)
Lowering\Instrumentation\Instrumenter.cs (59)
36private static BoundStatement InstrumentStatement(BoundStatement original, BoundStatement rewritten)
42public virtual BoundStatement InstrumentNoOpStatement(BoundNoOpStatement original, BoundStatement rewritten)
47public virtual BoundStatement InstrumentYieldBreakStatement(BoundYieldBreakStatement original, BoundStatement rewritten)
53public virtual BoundStatement InstrumentYieldReturnStatement(BoundYieldReturnStatement original, BoundStatement rewritten)
73public virtual void InstrumentBlock(BoundBlock original, LocalRewriter rewriter, ref TemporaryArray<LocalSymbol> additionalLocals, out BoundStatement? prologue, out BoundStatement? epilogue, out BoundBlockInstrumentation? instrumentation)
80public virtual BoundStatement InstrumentThrowStatement(BoundThrowStatement original, BoundStatement rewritten)
85public virtual BoundStatement InstrumentContinueStatement(BoundContinueStatement original, BoundStatement rewritten)
90public virtual BoundStatement InstrumentGotoStatement(BoundGotoStatement original, BoundStatement rewritten)
95public virtual BoundStatement InstrumentExpressionStatement(BoundExpressionStatement original, BoundStatement rewritten)
100public virtual BoundStatement InstrumentFieldOrPropertyInitializer(BoundStatement original, BoundStatement rewritten)
106public virtual BoundStatement InstrumentBreakStatement(BoundBreakStatement original, BoundStatement rewritten)
127public virtual BoundStatement InstrumentDoStatementConditionalGotoStart(BoundDoStatement original, BoundStatement ifConditionGotoStart)
134public virtual BoundStatement InstrumentWhileStatementConditionalGotoStartOrBreak(BoundWhileStatement original, BoundStatement ifConditionGotoStart)
142public virtual BoundStatement? InstrumentForEachStatementCollectionVarDeclaration(BoundForEachStatement original, BoundStatement? collectionVarDecl)
149public virtual BoundStatement InstrumentForEachStatement(BoundForEachStatement original, BoundStatement rewritten)
155public virtual BoundStatement InstrumentForEachStatementIterationVarDeclaration(BoundForEachStatement original, BoundStatement iterationVarDecl)
162public virtual BoundStatement InstrumentForEachStatementDeconstructionVariablesDeclaration(BoundForEachStatement original, BoundStatement iterationVarDecl)
169public virtual BoundStatement InstrumentForEachStatementConditionalGotoStart(BoundForEachStatement original, BoundStatement branchBack)
176public virtual BoundStatement InstrumentForStatementConditionalGotoStartOrBreak(BoundForStatement original, BoundStatement branchBack)
191public virtual BoundStatement InstrumentIfStatement(BoundIfStatement original, BoundStatement rewritten)
205public virtual BoundStatement InstrumentLabelStatement(BoundLabeledStatement original, BoundStatement rewritten)
211public virtual BoundStatement InstrumentUserDefinedLocalInitialization(BoundLocalDeclaration original, BoundStatement rewritten)
241public virtual BoundStatement InstrumentLockTargetCapture(BoundLockStatement original, BoundStatement lockTargetCapture)
248public virtual BoundStatement InstrumentReturnStatement(BoundReturnStatement original, BoundStatement rewritten)
253public virtual BoundStatement InstrumentSwitchStatement(BoundSwitchStatement original, BoundStatement rewritten)
264public virtual BoundStatement InstrumentSwitchWhenClauseConditionalGotoBody(BoundExpression original, BoundStatement ifConditionGotoBody)
271public virtual BoundStatement InstrumentUsingTargetCapture(BoundUsingStatement original, BoundStatement usingTargetCapture)
290public virtual BoundExpression InstrumentSwitchStatementExpression(BoundStatement original, BoundExpression rewrittenExpression, SyntheticBoundNodeFactory factory)
308public virtual BoundStatement InstrumentSwitchBindCasePatternVariables(BoundStatement bindings)
Lowering\Instrumentation\LocalStateTracingInstrumenter.cs (9)
154BoundStatement methodBody,
279public override void InstrumentBlock(BoundBlock original, LocalRewriter rewriter, ref TemporaryArray<LocalSymbol> additionalLocals, out BoundStatement? prologue, out BoundStatement? epilogue, out BoundBlockInstrumentation? instrumentation)
281base.InstrumentBlock(original, rewriter, ref additionalLocals, out var previousPrologue, out epilogue, out instrumentation);
298var prologueBuilder = ArrayBuilder<BoundStatement>.GetInstance(_factory.CurrentFunction.ParameterCount);
339var instrumentationPrologue = (entryLogger != null) ?
343var instrumentationEpilogue = (returnLogger != null) ?
541ImmutableArray.Create<BoundStatement>(logCallStatement, rewrittenFilterPrologue) :
542ImmutableArray.Create<BoundStatement>(logCallStatement));
Lowering\LocalRewriter\LocalRewriter_Block.cs (14)
22var builder = ArrayBuilder<BoundStatement>.GetInstance();
30Instrumenter.InstrumentBlock(node, this, ref additionalLocals, out var prologue, out var epilogue, out instrumentation);
51/// <returns>An <see cref="ImmutableArray{T}"/> of <see cref="BoundStatement"/></returns>
52public void VisitStatementSubList(ArrayBuilder<BoundStatement> builder, ImmutableArray<BoundStatement> statements, int startIndex = 0)
56BoundStatement? statement = VisitPossibleUsingDeclaration(statements[i], statements, i, out var replacedUsingDeclarations);
76/// <returns>A <see cref="BoundStatement"/></returns>
82public BoundStatement? VisitPossibleUsingDeclaration(BoundStatement node, ImmutableArray<BoundStatement> statements, int statementIndex, out bool replacedLocalDeclarations)
91ArrayBuilder<BoundStatement> builder = ArrayBuilder<BoundStatement>.GetInstance();
105? 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(
388BoundStatement localInit = InstrumentLocalDeclarationIfNecessary(localDecl, localSymbol, factory.Assignment(factory.Local(localSymbol), pinAndGetPtr));
401private BoundStatement InitializeFixedStatementStringLocal(
427BoundStatement stringTempInit = factory.Assignment(factory.Local(pinnedTemp), initializerExpr);
437BoundStatement localInit = InstrumentLocalDeclarationIfNecessary(localDecl, localSymbol,
454BoundStatement conditionalAdd = factory.If(notNullCheck, factory.Assignment(factory.Local(localSymbol), addition));
470private BoundStatement InitializeFixedStatementArrayLocal(
537BoundStatement localInit = factory.ExpressionStatement(
Lowering\LocalRewriter\LocalRewriter_ForEachStatement.cs (61)
105private BoundStatement RewriteEnumeratorForEachStatement(BoundForEachStatement node)
115BoundStatement? rewrittenBody = VisitStatement(node.Body);
150BoundStatement enumeratorVarDecl = MakeLocalDeclaration(forEachSyntax, enumeratorVar, enumeratorVarInitValue);
169BoundStatement iterationVarDecl = LocalOrDeconstructionDeclaration(node, iterationVariables, iterationVarAssignValue);
191BoundStatement whileLoop = RewriteWhileStatement(
199BoundStatement result;
203BoundStatement tryFinally = WrapWithTryFinallyDispose(forEachSyntax, enumeratorInfo, enumeratorType, boundEnumeratorVar, whileLoop);
211statements: ImmutableArray.Create<BoundStatement>(enumeratorVarDecl, tryFinally));
223statements: ImmutableArray.Create<BoundStatement>(enumeratorVarDecl, whileLoop));
248private BoundStatement WrapWithTryFinallyDispose(
253BoundStatement rewrittenBody)
310BoundStatement disposeCallStatement;
324BoundStatement alwaysOrMaybeDisposeStmt;
378BoundStatement disposableVarDecl = MakeLocalDeclaration(forEachSyntax, disposableVar, disposableVarInitValue);
382BoundStatement disposeCallStatement = new BoundExpressionStatement(forEachSyntax, expression: disposeCall);
385BoundStatement ifStmt = RewriteIfStatement(
416BoundStatement tryFinally = new BoundTryStatement(forEachSyntax,
419statements: ImmutableArray.Create<BoundStatement>(rewrittenBody)),
429private BoundStatement WrapWithAwait(CommonForEachStatementSyntax forEachSyntax, BoundExpression disposeCall, BoundAwaitableInfo disposeAwaitableInfoOpt)
521private BoundStatement RewriteForEachStatementAsFor(BoundForEachStatement node, MethodSymbol indexerGet, MethodSymbol lengthGet)
533BoundStatement? rewrittenBody = VisitStatement(node.Body);
540BoundStatement arrayVarDecl = MakeLocalDeclaration(forEachSyntax, collectionTemp, rewrittenExpression);
554BoundStatement positionVarDecl = MakeLocalDeclaration(forEachSyntax, positionVar,
569BoundStatement iterationVariableDecl = LocalOrDeconstructionDeclaration(node, iterationVariables, iterationVarInitValue);
573BoundStatement initializer = new BoundStatementList(forEachSyntax,
574statements: ImmutableArray.Create<BoundStatement>(arrayVarDecl, positionVarDecl));
595BoundStatement positionIncrement = MakePositionIncrement(forEachSyntax, boundPositionVar, intType);
602BoundStatement loopBody = CreateBlockDeclaringIterationVariables(iterationVariables, iterationVariableDecl, rewrittenBody, forEachSyntax);
608BoundStatement result = RewriteForStatementWithoutInnerLocals(
631private BoundStatement LocalOrDeconstructionDeclaration(
638BoundStatement iterationVarDecl;
663BoundStatement iteratorVariableInitialization,
664BoundStatement rewrittenBody,
698private BoundStatement RewriteSingleDimensionalArrayForEachStatement(BoundForEachStatement node)
712BoundStatement? rewrittenBody = VisitStatement(node.Body);
719BoundStatement arrayVarDecl = MakeLocalDeclaration(forEachSyntax, arrayVar, rewrittenExpression);
733BoundStatement positionVarDecl = MakeLocalDeclaration(forEachSyntax, positionVar,
748BoundStatement iterationVariableDecl = LocalOrDeconstructionDeclaration(node, iterationVariables, iterationVarInitValue);
752BoundStatement initializer = new BoundStatementList(forEachSyntax,
753statements: ImmutableArray.Create<BoundStatement>(arrayVarDecl, positionVarDecl));
774BoundStatement positionIncrement = MakePositionIncrement(forEachSyntax, boundPositionVar, intType);
781BoundStatement loopBody = CreateBlockDeclaringIterationVariables(iterationVariables, iterationVariableDecl, rewrittenBody, forEachSyntax);
787BoundStatement result = RewriteForStatementWithoutInnerLocals(
823private BoundStatement RewriteMultiDimensionalArrayForEachStatement(BoundForEachStatement node)
843BoundStatement? rewrittenBody = VisitStatement(node.Body);
851BoundStatement arrayVarDecl = MakeLocalDeclaration(forEachSyntax, arrayVar, rewrittenExpression);
863BoundStatement[] upperVarDecl = new BoundStatement[rank];
903BoundStatement iterationVarDecl = LocalOrDeconstructionDeclaration(node, iterationVariables, iterationVarInitValue);
912BoundStatement innermostLoopBody = CreateBlockDeclaringIterationVariables(iterationVariables, iterationVarDecl, rewrittenBody, forEachSyntax);
922BoundStatement? forLoop = null;
934BoundStatement positionVarDecl = MakeLocalDeclaration(forEachSyntax, positionVar[dimension], currentDimensionLowerBound);
953BoundStatement positionIncrement = MakePositionIncrement(forEachSyntax, boundPositionVar[dimension], intType);
955BoundStatement body;
984BoundStatement result = new BoundBlock(
1015private BoundStatement MakeLocalDeclaration(CSharpSyntaxNode syntax, LocalSymbol local, BoundExpression rewrittenInitialValue)
1017var result = RewriteLocalDeclaration(
1027private BoundStatement MakePositionIncrement(CSharpSyntaxNode syntax, BoundLocal boundPositionVar, TypeSymbol intType)
1050private void InstrumentForEachStatementCollectionVarDeclaration(BoundForEachStatement original, [NotNullIfNotNull(nameof(collectionVarDecl))] ref BoundStatement? collectionVarDecl)
1058private void InstrumentForEachStatementIterationVarDeclaration(BoundForEachStatement original, ref BoundStatement iterationVarDecl)
1074private void InstrumentForEachStatement(BoundForEachStatement original, ref BoundStatement result)
Lowering\LocalRewriter\LocalRewriter_ForStatement.cs (18)
20var rewrittenInitializer = VisitStatement(node.Initializer);
22var rewrittenIncrement = VisitStatement(node.Increment);
23var rewrittenBody = VisitStatement(node.Body);
41private BoundStatement RewriteForStatementWithoutInnerLocals(
44BoundStatement? rewrittenInitializer,
46BoundStatement? rewrittenIncrement,
47BoundStatement rewrittenBody,
75var statementBuilder = ArrayBuilder<BoundStatement>.GetInstance();
105BoundStatement gotoEnd = new BoundGotoStatement(syntax, endLabel);
135BoundStatement? branchBack = null;
169private BoundStatement RewriteForStatement(
171BoundStatement? rewrittenInitializer,
173BoundStatement? rewrittenIncrement,
174BoundStatement rewrittenBody)
213var statementBuilder = ArrayBuilder<BoundStatement>.GetInstance();
224BoundStatement startLabelStatement = new BoundLabelStatement(syntax, startLabel);
233var blockBuilder = ArrayBuilder<BoundStatement>.GetInstance();
238BoundStatement ifNotConditionGotoBreak = new BoundConditionalGoto(rewrittenCondition.Syntax, rewrittenCondition, false, node.BreakLabel);
Lowering\LocalRewriter\LocalRewriter_UsingStatement.cs (17)
36BoundStatement? rewrittenBody = VisitStatement(node.Body);
61private BoundStatement MakeDeclarationUsingStatement(SyntaxNode syntax,
82ImmutableArray.Create<BoundStatement>(result));
88private BoundStatement MakeLocalUsingDeclarationStatement(BoundUsingLocalDeclarations usingDeclarations, ImmutableArray<BoundStatement> statements)
93var usingStatement = MakeDeclarationUsingStatement(syntax,
183BoundStatement expressionStatement = new BoundExpressionStatement(expressionSyntax, tempAssignment);
189BoundStatement tryFinally = RewriteUsingStatementTryFinally(usingSyntax, usingSyntax, tryBlock, boundTemp, usingSyntax.AwaitKeyword, node.AwaitOpt, node.PatternDisposeInfoOpt);
195statements: ImmutableArray.Create<BoundStatement>(expressionStatement, tryFinally));
222BoundStatement? rewrittenDeclaration = VisitStatement(localDeclaration);
253BoundStatement tryFinally = RewriteUsingStatementTryFinally(usingSyntax, declarationSyntax, tryBlock, boundTemp, awaitKeywordOpt, awaitOpt, patternDisposeInfo);
258statements: ImmutableArray.Create<BoundStatement>(
265BoundStatement tryFinally = RewriteUsingStatementTryFinally(usingSyntax, declarationSyntax, tryBlock, boundLocal, awaitKeywordOpt, awaitOpt, patternDisposeInfo);
278private BoundStatement RewriteUsingStatementTryFinally(
375BoundStatement disposeStatement = new BoundExpressionStatement(resourceSyntax, disposeCall);
394BoundStatement 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);
101private BoundStatement RewriteWhileStatement(
105BoundStatement rewrittenBody,
132BoundStatement continueLabelStatement = new BoundLabelStatement(syntax, continueLabel);
133BoundStatement ifNotConditionGotoBreak = new BoundConditionalGoto(rewrittenCondition.Syntax, rewrittenCondition, false, breakLabel);
Lowering\SpillSequenceSpiller.cs (18)
43private ArrayBuilder<BoundStatement> _statements;
73public ImmutableArray<BoundStatement> GetStatements()
77return ImmutableArray<BoundStatement>.Empty;
141public void AddStatement(BoundStatement statement)
145_statements = ArrayBuilder<BoundStatement>.GetInstance();
151public void AddStatements(ImmutableArray<BoundStatement> statements)
153foreach (var statement in statements)
233internal static BoundStatement Rewrite(BoundStatement body, MethodSymbol method, TypeCompilationState compilationState, BindingDiagnosticBag diagnostics)
242return (BoundStatement)result;
283private BoundStatement UpdateStatement(BoundSpillSequenceBuilder builder, BoundStatement statement)
660Debug.Assert(!(node is BoundStatement));
1233var whenNotNullStatement = UpdateStatement(whenNotNullBuilder, _F.ExpressionStatement(whenNotNull));
1245var whenNotNullStatement = UpdateStatement(whenNotNullBuilder, _F.Assignment(_F.Local(tmp), whenNotNull));
1277public static BoundStatement Replace(BoundNode node, BoundExpression receiver, int receiverID, int recursionDepth)
1280var result = (BoundStatement)replacer.Visit(node);
Lowering\StateMachineRewriter\MethodToStateMachineRewriter.cs (15)
168protected abstract BoundStatement GenerateReturn(bool finished);
241protected BoundStatement Dispatch(bool isOutermost)
247var result = F.Switch(F.Local(cachedState), sections.ToImmutableArray());
257var missingStateDispatch = GenerateMissingStateDispatch();
267protected virtual BoundStatement? GenerateMissingStateDispatch()
292private BoundStatement PossibleIteratorScope(ImmutableArray<LocalSymbol> locals, Func<BoundStatement> wrapped)
337var translatedStatement = wrapped();
378F.Block(variableCleanup.SelectAsArray((e, f) => (BoundStatement)f.ExpressionStatement(e), F)));
397internal BoundBlock MakeStateMachineScope(ImmutableArray<StateMachineFieldSymbol> hoistedLocals, BoundStatement statement)
405internal static bool TryUnwrapBoundStateMachineScope(ref BoundStatement statement, out ImmutableArray<StateMachineFieldSymbol> hoistedLocals)
740BoundStatement translated;
845BoundBlock tryBlock = F.Block((BoundStatement)this.Visit(node.TryBlock));
872BoundStatement result = node.Update(tryBlock, catchBlocks, finallyBlockOpt, node.FinallyLabelOpt, node.PreferFaultHandler);
904protected BoundStatement CacheThisIfNeeded()
Lowering\StateMachineRewriter\StateMachineRewriter.cs (15)
20protected 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()
282private BoundStatement GenerateKickoffMethodBody()
285var bodyBuilder = ArrayBuilder<BoundStatement>.GetInstance();
301protected BoundStatement GenerateParameterStorage(LocalSymbol stateMachineVariable, IReadOnlyDictionary<Symbol, CapturedSymbolReplacement> proxies)
303var bodyBuilder = ArrayBuilder<BoundStatement>.GetInstance();
411var bodyBuilder = ArrayBuilder<BoundStatement>.GetInstance();
415BoundStatement makeIterator = F.Assignment(F.Local(resultVariable), F.New(stateMachineType.Constructor, F.Literal(initialState)));
423var thenBuilder = ArrayBuilder<BoundStatement>.GetInstance(4);
476BoundStatement copy = InitializeParameterField(getEnumeratorMethod, parameter, resultParameter, parameterProxy);
490protected virtual void GenerateResetInstance(ArrayBuilder<BoundStatement> builder, StateMachineState initialState)
497protected virtual BoundStatement InitializeParameterField(MethodSymbol getEnumeratorMethod, ParameterSymbol parameter, BoundExpression resultParameter, BoundExpression parameterProxy)
Lowering\SyntheticBoundNodeFactory.cs (37)
458return Block(ImmutableArray<BoundStatement>.Empty);
461public BoundBlock Block(ImmutableArray<BoundStatement> statements)
466public BoundBlock Block(params BoundStatement[] statements)
471public BoundBlock Block(ImmutableArray<LocalSymbol> locals, params BoundStatement[] statements)
476public BoundBlock Block(ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundStatement> statements)
481public BoundBlock Block(ImmutableArray<LocalSymbol> locals, ImmutableArray<LocalFunctionSymbol> localFunctions, params BoundStatement[] statements)
486public BoundBlock Block(ImmutableArray<LocalSymbol> locals, ImmutableArray<LocalFunctionSymbol> localFunctions, ImmutableArray<BoundStatement> statements)
498return StatementList(ImmutableArray<BoundStatement>.Empty);
501public BoundStatementList StatementList(ImmutableArray<BoundStatement> statements)
506public BoundStatementList StatementList(BoundStatement first, BoundStatement second)
537public void CloseMethod(BoundStatement body)
851public BoundStatement If(BoundExpression condition, BoundStatement thenClause, BoundStatement? elseClauseOpt = null)
856public BoundStatement ConditionalGoto(BoundExpression condition, LabelSymbol label, bool jumpIfTrue)
861public BoundStatement If(BoundExpression condition, ImmutableArray<LocalSymbol> locals, BoundStatement thenClause, BoundStatement? elseClauseOpt = null)
876var statements = ArrayBuilder<BoundStatement>.GetInstance();
970public BoundSpillSequence SpillSequence(ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundStatement> sideEffects, BoundExpression result)
982public readonly ImmutableArray<BoundStatement> Statements;
984public SyntheticSwitchSection(ImmutableArray<int> values, ImmutableArray<BoundStatement> statements)
991public SyntheticSwitchSection SwitchSection(int value, params BoundStatement[] statements)
994public SyntheticSwitchSection SwitchSection(ImmutableArray<int> values, params BoundStatement[] statements)
1000public BoundStatement Switch(BoundExpression ex, ImmutableArray<SyntheticSwitchSection> sections)
1014var statements = ArrayBuilder<BoundStatement>.GetInstance();
1120public BoundStatement BaseInitialization()
1129public BoundStatement SequencePoint(SyntaxNode syntax, BoundStatement statement)
1134public BoundStatement SequencePointWithSpan(CSharpSyntaxNode syntax, TextSpan span, BoundStatement statement)
1139public BoundStatement HiddenSequencePoint(BoundStatement? statementOpt = null)
1144public BoundStatement ThrowNull()
1451internal BoundStatement Try(
1581internal BoundStatement NoOp(NoOpStatementFlavor noOpStatementFlavor)
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);