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)
642public BoundStatement BindExpressionStatement(ExpressionStatementSyntax node, BindingDiagnosticBag diagnostics)
686internal BoundStatement BindLocalDeclarationStatement(LocalDeclarationStatementSyntax node, BindingDiagnosticBag diagnostics)
698private BoundStatement BindUsingDeclarationStatementParts(LocalDeclarationStatementSyntax node, BindingDiagnosticBag diagnostics)
700var usingDeclaration = UsingStatementBinder.BindUsingStatementOrDeclarationFromParts(node, node.UsingKeyword, node.AwaitKeyword, originalBinder: this, usingBinderOpt: null, diagnostics);
705private BoundStatement BindDeclarationStatementParts(LocalDeclarationStatementSyntax node, BindingDiagnosticBag diagnostics)
1881ArrayBuilder<BoundStatement> boundStatements = ArrayBuilder<BoundStatement>.GetInstance(nStatements);
1885var boundStatement = BindStatement(syntaxStatements[i], diagnostics);
1892private BoundBlock FinishBindBlockParts(CSharpSyntaxNode node, ImmutableArray<BoundStatement> boundStatements)
2530private BoundStatement BindIfStatement(IfStatementSyntax node, BindingDiagnosticBag diagnostics)
2534static BoundStatement bindIfStatement(Binder binder, IfStatementSyntax node, BindingDiagnosticBag diagnostics)
2536var stack = ArrayBuilder<(Binder, IfStatementSyntax IfStatementSyntax, BoundExpression Condition, BoundStatement Consequence)>.GetInstance();
2538BoundStatement? alternative;
2542var consequence = binder.BindPossibleEmbeddedStatement(node.Statement, diagnostics);
2572BoundStatement result;
2576BoundStatement consequence;
2593protected virtual bool TryGetBoundElseIfStatement(IfStatementSyntax node, out BoundStatement? alternative)
2735private BoundStatement BindSwitchStatement(SwitchStatementSyntax node, BindingDiagnosticBag diagnostics)
2742internal virtual BoundStatement BindSwitchStatementCore(SwitchStatementSyntax node, Binder originalBinder, BindingDiagnosticBag diagnostics)
2752private BoundStatement BindWhile(WhileStatementSyntax node, BindingDiagnosticBag diagnostics)
2766private BoundStatement BindDo(DoStatementSyntax node, BindingDiagnosticBag diagnostics)
2791internal BoundStatement BindForOrUsingOrFixedDeclarations(VariableDeclarationSyntax nodeOpt, LocalDeclarationKind localKind, BindingDiagnosticBag diagnostics, out ImmutableArray<BoundLocalDeclaration> declarations)
2848(BoundStatement)declarations[0] :
2852internal BoundStatement BindStatementExpressionList(SeparatedSyntaxList<ExpressionSyntax> statements, BindingDiagnosticBag diagnostics)
2866var statementBuilder = ArrayBuilder<BoundStatement>.GetInstance();
2877private BoundStatement BindForEach(CommonForEachStatementSyntax node, BindingDiagnosticBag diagnostics)
2883internal virtual BoundStatement BindForEachParts(BindingDiagnosticBag diagnostics, Binder originalBinder)
2891internal virtual BoundStatement BindForEachDeconstruction(BindingDiagnosticBag diagnostics, Binder originalBinder)
2896private BoundStatement BindBreak(BreakStatementSyntax node, BindingDiagnosticBag diagnostics)
2907private BoundStatement BindContinue(ContinueStatementSyntax node, BindingDiagnosticBag diagnostics)
2984private BoundStatement BindReturn(ReturnStatementSyntax syntax, BindingDiagnosticBag diagnostics)
3449BoundStatement statement;
3652ArrayBuilder<BoundStatement> boundStatements = ArrayBuilder<BoundStatement>.GetInstance();
3664var boundStatement = BindStatement(topLevelStatement.Statement, diagnostics);
3697blockBody: 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)
608public static BoundStatementList Synthesized(SyntaxNode syntax, params BoundStatement[] statements)
613public static BoundStatementList Synthesized(SyntaxNode syntax, bool hasErrors, params BoundStatement[] statements)
618public static BoundStatementList Synthesized(SyntaxNode syntax, ImmutableArray<BoundStatement> statements)
623public static BoundStatementList Synthesized(SyntaxNode syntax, bool hasErrors, ImmutableArray<BoundStatement> statements)
655public BoundBlock(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundStatement> statements, bool hasErrors = false)
660public static BoundBlock SynthesizedNoLocals(SyntaxNode syntax, BoundStatement statement)
666public static BoundBlock SynthesizedNoLocals(SyntaxNode syntax, ImmutableArray<BoundStatement> statements)
671public 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,
189BoundStatement statement;
311BoundStatement returnStatement = BoundReturnStatement.Synthesized(syntax, RefKind.None, processHandlerCall);
320BoundStatement callStatement = new BoundExpressionStatement(syntax, processHandlerCall);
321BoundStatement returnStatement = new BoundReturnStatement(syntax, RefKind.None, expressionOpt: null, @checked: false);
357BoundStatement @return = new BoundReturnStatement(syntax,
407BoundStatement eventUpdate = new BoundExpressionStatement(syntax,
416statements: ImmutableArray.Create<BoundStatement>(
439BoundStatement tmp0Init = new BoundExpressionStatement(syntax,
448BoundStatement loopStart = new BoundLabelStatement(syntax,
453BoundStatement tmp1Update = new BoundExpressionStatement(syntax,
472BoundStatement tmp2Update = new BoundExpressionStatement(syntax,
488BoundStatement tmp0Update = new BoundExpressionStatement(syntax,
509BoundStatement loopEnd = new BoundConditionalGoto(syntax,
517statements: ImmutableArray.Create<BoundStatement>(
542BoundStatement baseFinalizeCall = new BoundExpressionStatement(
566ImmutableArray.Create<BoundStatement>(
574ImmutableArray.Create<BoundStatement>(
Compiler\MethodCompiler.cs (23)
257BoundStatement body = synthesizedEntryPoint.CreateBody(diagnostics);
271var loweredBody = LowerBodyOrInitializer(
744BoundStatement loweredBody = IteratorRewriter.Rewrite(methodWithBody.Body, method, methodOrdinal, stateMachineStateDebugInfoBuilder, variableSlotAllocatorOpt, compilationState, diagnosticsThisMethod, out iteratorStateMachine);
961body = new BoundBlock(methodSymbol.GetNonNullSyntaxNode(), ImmutableArray<LocalSymbol>.Empty, ImmutableArray<BoundStatement>.Empty) { WasCompilerGenerated = true };
1170BoundStatement loweredBodyOpt = null;
1214ImmutableArray<BoundStatement> boundStatements;
1222boundStatements = ImmutableArray<BoundStatement>.Empty;
1232var initializers = ArrayBuilder<BoundStatement>.GetInstance(capturedParameters.Count);
1252BoundStatement lowered = LowerBodyOrInitializer(
1362internal static BoundStatement LowerBodyOrInitializer(
1365BoundStatement body,
1390var loweredBody = LocalRewriter.Rewrite(
1434BoundStatement bodyWithoutLambdas = loweredBody;
1458BoundStatement bodyWithoutIterators = IteratorRewriter.Rewrite(bodyWithoutLambdas, method, methodOrdinal, stateMachineStateDebugInfoBuilder, lazyVariableSlotAllocator, compilationState, diagnostics,
1466BoundStatement bodyWithoutAsync = AsyncRewriter.Rewrite(bodyWithoutIterators, method, methodOrdinal, stateMachineStateDebugInfoBuilder, lazyVariableSlotAllocator, compilationState, diagnostics,
1489BoundStatement block,
1860body = new BoundBlock(constructor.Syntax, constructor.Locals, ImmutableArray.Create<BoundStatement>(constructor.Initializer));
1864body = new BoundBlock(constructor.Syntax, constructor.Locals, ImmutableArray.Create<BoundStatement>(constructor.Initializer, body));
1909var stmts = ArrayBuilder<BoundStatement>.GetInstance();
1941var constructorInitializer = BindImplicitConstructorInitializerIfAny(method, compilationState, diagnostics);
1942ImmutableArray<BoundStatement> statements;
1951statements = ImmutableArray<BoundStatement>.Empty;
2333private static BoundStatement BindImplicitConstructorInitializerIfAny(MethodSymbol method, TypeCompilationState compilationState, BindingDiagnosticBag diagnostics)
FlowAnalysis\AbstractFlowPass.cs (20)
93private PooledHashSet<BoundStatement> _labelsSeen;
210_labelsSeen = PooledHashSet<BoundStatement>.GetInstance();
670protected virtual void VisitStatement(BoundStatement statement)
762protected virtual void NoteBranch(PendingBranch pending, BoundNode gotoStmt, BoundStatement target)
773private bool ResolveBranches(LabelSymbol label, BoundStatement? target)
792protected virtual void ResolveBranch(PendingBranch pending, LabelSymbol label, BoundStatement? target, ref bool labelStateChanged)
811public readonly PooledHashSet<BoundStatement> LabelsSeen;
813public SavedPending(PendingBranchesCollection pendingBranches, PooledHashSet<BoundStatement> labelsSeen)
831_labelsSeen = PooledHashSet<BoundStatement>.GetInstance();
1311private void VisitStatements(ImmutableArray<BoundStatement> statements)
1313foreach (var statement in statements)
1589if (child is BoundStatement)
1591VisitStatement(child as BoundStatement);
1782var alternative = node.AlternativeOpt;
1908private void VisitTryBlockWithAnyTransferFunction(BoundStatement tryBlock, BoundTryStatement node, ref TLocalState tryState)
1932protected virtual void VisitTryBlock(BoundStatement tryBlock, BoundTryStatement node, ref TLocalState tryState)
1982private void VisitFinallyBlockWithAnyTransferFunction(BoundStatement finallyBlock, ref TLocalState stateMovedUp)
2006protected virtual void VisitFinallyBlock(BoundStatement finallyBlock, ref TLocalState stateMovedUp)
3199foreach (var statement in node.Statements)
3337protected void VisitLabel(LabelSymbol label, BoundStatement node)
Generated\BoundNodes.xml.Generated.cs (144)
398public BoundGlobalStatementInitializer(SyntaxNode syntax, BoundStatement statement, bool hasErrors = false)
407public BoundStatement Statement { get; }
412public BoundGlobalStatementInitializer Update(BoundStatement statement)
2261public BoundBlockInstrumentation(SyntaxNode syntax, OneOrMany<LocalSymbol> locals, BoundStatement? prologue, BoundStatement? epilogue, bool hasErrors = false)
2273public BoundStatement? Prologue { get; }
2274public BoundStatement? Epilogue { get; }
2279public BoundBlockInstrumentation Update(OneOrMany<LocalSymbol> locals, BoundStatement? prologue, BoundStatement? epilogue)
3147public BoundSequencePoint(SyntaxNode syntax, BoundStatement? statementOpt, bool hasErrors = false)
3153public BoundStatement? StatementOpt { get; }
3158public BoundSequencePoint Update(BoundStatement? statementOpt)
3172public BoundSequencePointWithSpan(SyntaxNode syntax, BoundStatement? statementOpt, TextSpan span, bool hasErrors = false)
3179public BoundStatement? StatementOpt { get; }
3185public BoundSequencePointWithSpan Update(BoundStatement? statementOpt, TextSpan span)
3304public BoundBlock(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, ImmutableArray<LocalFunctionSymbol> localFunctions, bool hasUnsafeModifier, BoundBlockInstrumentation? instrumentation, ImmutableArray<BoundStatement> statements, bool hasErrors = false)
3326public BoundBlock Update(ImmutableArray<LocalSymbol> locals, ImmutableArray<LocalFunctionSymbol> localFunctions, bool hasUnsafeModifier, BoundBlockInstrumentation? instrumentation, ImmutableArray<BoundStatement> statements)
3340public BoundScope(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundStatement> statements, bool hasErrors = false)
3355public BoundScope Update(ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundStatement> statements)
3369public BoundStateMachineScope(SyntaxNode syntax, ImmutableArray<StateMachineFieldSymbol> fields, BoundStatement statement, bool hasErrors = false)
3381public BoundStatement Statement { get; }
3386public BoundStateMachineScope Update(ImmutableArray<StateMachineFieldSymbol> fields, BoundStatement statement)
3851public BoundIfStatement(SyntaxNode syntax, BoundExpression condition, BoundStatement consequence, BoundStatement? alternativeOpt, bool hasErrors = false)
3864public BoundStatement Consequence { get; }
3865public BoundStatement? AlternativeOpt { get; }
3870public BoundIfStatement Update(BoundExpression condition, BoundStatement consequence, BoundStatement? alternativeOpt)
3912protected BoundConditionalLoopStatement(BoundKind kind, SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, BoundExpression condition, BoundStatement body, GeneratedLabelSymbol breakLabel, GeneratedLabelSymbol continueLabel, bool hasErrors = false)
3929public BoundStatement Body { get; }
3934public BoundDoStatement(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, BoundExpression condition, BoundStatement body, GeneratedLabelSymbol breakLabel, GeneratedLabelSymbol continueLabel, bool hasErrors = false)
3950public BoundDoStatement Update(ImmutableArray<LocalSymbol> locals, BoundExpression condition, BoundStatement body, GeneratedLabelSymbol breakLabel, GeneratedLabelSymbol continueLabel)
3964public BoundWhileStatement(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, BoundExpression condition, BoundStatement body, GeneratedLabelSymbol breakLabel, GeneratedLabelSymbol continueLabel, bool hasErrors = false)
3980public BoundWhileStatement Update(ImmutableArray<LocalSymbol> locals, BoundExpression condition, BoundStatement body, GeneratedLabelSymbol breakLabel, GeneratedLabelSymbol continueLabel)
3994public BoundForStatement(SyntaxNode syntax, ImmutableArray<LocalSymbol> outerLocals, BoundStatement? initializer, ImmutableArray<LocalSymbol> innerLocals, BoundExpression? condition, BoundStatement? increment, BoundStatement body, GeneratedLabelSymbol breakLabel, GeneratedLabelSymbol continueLabel, bool hasErrors = false)
4013public BoundStatement? Initializer { get; }
4016public BoundStatement? Increment { get; }
4017public BoundStatement Body { get; }
4022public BoundForStatement Update(ImmutableArray<LocalSymbol> outerLocals, BoundStatement? initializer, ImmutableArray<LocalSymbol> innerLocals, BoundExpression? condition, BoundStatement? increment, BoundStatement body, GeneratedLabelSymbol breakLabel, GeneratedLabelSymbol continueLabel)
4036public 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)
4068public BoundStatement Body { get; }
4073public 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)
4118public BoundUsingStatement(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, BoundMultipleLocalDeclarations? declarationsOpt, BoundExpression? expressionOpt, BoundStatement body, BoundAwaitableInfo? awaitOpt, MethodArgumentInfo? patternDisposeInfoOpt, bool hasErrors = false)
4136public BoundStatement Body { get; }
4143public BoundUsingStatement Update(ImmutableArray<LocalSymbol> locals, BoundMultipleLocalDeclarations? declarationsOpt, BoundExpression? expressionOpt, BoundStatement body, BoundAwaitableInfo? awaitOpt, MethodArgumentInfo? patternDisposeInfoOpt)
4157public BoundFixedStatement(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, BoundMultipleLocalDeclarations declarations, BoundStatement body, bool hasErrors = false)
4172public BoundStatement Body { get; }
4177public BoundFixedStatement Update(ImmutableArray<LocalSymbol> locals, BoundMultipleLocalDeclarations declarations, BoundStatement body)
4191public BoundLockStatement(SyntaxNode syntax, BoundExpression argument, BoundStatement body, bool hasErrors = false)
4203public BoundStatement Body { get; }
4208public BoundLockStatement Update(BoundExpression argument, BoundStatement body)
4741public BoundLabeledStatement(SyntaxNode syntax, LabelSymbol label, BoundStatement body, bool hasErrors = false)
4753public BoundStatement Body { get; }
4758public BoundLabeledStatement Update(LabelSymbol label, BoundStatement body)
4809protected BoundStatementList(BoundKind kind, SyntaxNode syntax, ImmutableArray<BoundStatement> statements, bool hasErrors = false)
4818public BoundStatementList(SyntaxNode syntax, ImmutableArray<BoundStatement> statements, bool hasErrors = false)
4827public ImmutableArray<BoundStatement> Statements { get; }
4832public BoundStatementList Update(ImmutableArray<BoundStatement> statements)
5658public BoundSwitchSection(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundSwitchLabel> switchLabels, ImmutableArray<BoundStatement> statements, bool hasErrors = false)
5676public BoundSwitchSection Update(ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundSwitchLabel> switchLabels, ImmutableArray<BoundStatement> statements)
5801public BoundSpillSequence(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundStatement> sideEffects, BoundExpression value, TypeSymbol type, bool hasErrors = false)
5817public ImmutableArray<BoundStatement> SideEffects { get; }
5823public BoundSpillSequence Update(ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundStatement> sideEffects, BoundExpression value, TypeSymbol type)
6506public BoundCollectionExpressionSpreadElement(SyntaxNode syntax, BoundExpression expression, BoundCollectionExpressionSpreadExpressionPlaceholder? expressionPlaceholder, BoundExpression? conversion, ForEachEnumeratorInfo? enumeratorInfoOpt, BoundExpression? lengthOrCount, BoundValuePlaceholder? elementPlaceholder, BoundStatement? iteratorBody, bool hasErrors = false)
6527public BoundStatement? IteratorBody { get; }
6532public BoundCollectionExpressionSpreadElement Update(BoundExpression expression, BoundCollectionExpressionSpreadExpressionPlaceholder? expressionPlaceholder, BoundExpression? conversion, ForEachEnumeratorInfo? enumeratorInfoOpt, BoundExpression? lengthOrCount, BoundValuePlaceholder? elementPlaceholder, BoundStatement? iteratorBody)
7717public BoundTypeOrInstanceInitializers(SyntaxNode syntax, ImmutableArray<BoundStatement> statements, bool hasErrors = false)
7729public new BoundTypeOrInstanceInitializers Update(ImmutableArray<BoundStatement> statements)
8730public BoundConstructorMethodBody(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, BoundStatement? initializer, BoundBlock? blockBody, BoundBlock? expressionBody, bool hasErrors = false)
8741public BoundStatement? Initializer { get; }
8746public BoundConstructorMethodBody Update(ImmutableArray<LocalSymbol> locals, BoundStatement? initializer, BoundBlock? blockBody, BoundBlock? expressionBody)
10816BoundStatement statement = (BoundStatement)this.Visit(node.Statement);
11136BoundStatement? prologue = (BoundStatement?)this.Visit(node.Prologue);
11137BoundStatement? epilogue = (BoundStatement?)this.Visit(node.Epilogue);
11272BoundStatement? statementOpt = (BoundStatement?)this.Visit(node.StatementOpt);
11277BoundStatement? statementOpt = (BoundStatement?)this.Visit(node.StatementOpt);
11286ImmutableArray<BoundStatement> statements = this.VisitList(node.Statements);
11291ImmutableArray<BoundStatement> statements = this.VisitList(node.Statements);
11296BoundStatement statement = (BoundStatement)this.Visit(node.Statement);
11363BoundStatement consequence = (BoundStatement)this.Visit(node.Consequence);
11364BoundStatement? alternativeOpt = (BoundStatement?)this.Visit(node.AlternativeOpt);
11370BoundStatement body = (BoundStatement)this.Visit(node.Body);
11376BoundStatement body = (BoundStatement)this.Visit(node.Body);
11381BoundStatement? initializer = (BoundStatement?)this.Visit(node.Initializer);
11383BoundStatement? increment = (BoundStatement?)this.Visit(node.Increment);
11384BoundStatement body = (BoundStatement)this.Visit(node.Body);
11396BoundStatement body = (BoundStatement)this.Visit(node.Body);
11409BoundStatement body = (BoundStatement)this.Visit(node.Body);
11416BoundStatement body = (BoundStatement)this.Visit(node.Body);
11422BoundStatement body = (BoundStatement)this.Visit(node.Body);
11501BoundStatement body = (BoundStatement)this.Visit(node.Body);
11511ImmutableArray<BoundStatement> statements = this.VisitList(node.Statements);
11656ImmutableArray<BoundStatement> statements = this.VisitList(node.Statements);
11680ImmutableArray<BoundStatement> sideEffects = this.VisitList(node.SideEffects);
11800BoundStatement? iteratorBody = node.IteratorBody;
12006ImmutableArray<BoundStatement> statements = this.VisitList(node.Statements);
12195BoundStatement? initializer = (BoundStatement?)this.Visit(node.Initializer);
13356ImmutableArray<BoundStatement> statements = this.VisitList(node.Statements);
13363ImmutableArray<BoundStatement> statements = this.VisitList(node.Statements);
13370BoundStatement statement = (BoundStatement)this.Visit(node.Statement);
13406BoundStatement body = (BoundStatement)this.Visit(node.Body);
13414BoundStatement body = (BoundStatement)this.Visit(node.Body);
13422BoundStatement? initializer = (BoundStatement?)this.Visit(node.Initializer);
13424BoundStatement? increment = (BoundStatement?)this.Visit(node.Increment);
13425BoundStatement body = (BoundStatement)this.Visit(node.Body);
13439BoundStatement body = (BoundStatement)this.Visit(node.Body);
13448BoundStatement body = (BoundStatement)this.Visit(node.Body);
13457BoundStatement body = (BoundStatement)this.Visit(node.Body);
13727ImmutableArray<BoundStatement> statements = this.VisitList(node.Statements);
13770ImmutableArray<BoundStatement> sideEffects = this.VisitList(node.SideEffects);
14915BoundStatement? 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 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);
344var instrumentationPrologue = (entryLogger != null) ?
348var instrumentationEpilogue = (returnLogger != null) ?
539ImmutableArray.Create<BoundStatement>(logCallStatement, rewrittenFilterPrologue) :
540ImmutableArray.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(
421BoundStatement localInit = InstrumentLocalDeclarationIfNecessary(localDecl, localSymbol, factory.Assignment(factory.Local(localSymbol), pinAndGetPtr));
434private BoundStatement InitializeFixedStatementStringLocal(
460BoundStatement stringTempInit = factory.Assignment(factory.Local(pinnedTemp), initializerExpr);
470BoundStatement localInit = InstrumentLocalDeclarationIfNecessary(localDecl, localSymbol,
487BoundStatement conditionalAdd = factory.If(notNullCheck, factory.Assignment(factory.Local(localSymbol), addition));
503private BoundStatement InitializeFixedStatementArrayLocal(
570BoundStatement localInit = factory.ExpressionStatement(
Lowering\LocalRewriter\LocalRewriter_ForEachStatement.cs (70)
113private BoundStatement RewriteEnumeratorForEachStatement(BoundForEachStatement node)
118BoundStatement? rewrittenBody = VisitStatement(node.Body);
135private BoundStatement RewriteForEachEnumerator(
146BoundStatement rewrittenBody)
187BoundStatement enumeratorVarDecl = MakeLocalDeclaration(forEachSyntax, enumeratorVar, enumeratorVarInitValue);
206BoundStatement iterationVarDecl = LocalOrDeconstructionDeclaration(forEachSyntax, deconstruction, iterationVariables, iterationVarAssignValue);
237BoundStatement whileLoop = RewriteWhileStatement(
245BoundStatement result;
258BoundStatement tryFinally = new BoundTryStatement(
270statements: ImmutableArray.Create<BoundStatement>(enumeratorVarDecl, tryFinally));
282statements: ImmutableArray.Create<BoundStatement>(enumeratorVarDecl, whileLoop));
374BoundStatement disposeCallStatement;
389BoundStatement alwaysOrMaybeDisposeStmt;
442BoundStatement disposableVarDecl = MakeLocalDeclaration(forEachSyntax, disposableVar, disposableVarInitValue);
446BoundStatement disposeCallStatement = new BoundExpressionStatement(forEachSyntax, expression: disposeCall);
449BoundStatement ifStmt = RewriteIfStatement(
475private BoundStatement WrapWithAwait(SyntaxNode forEachSyntax, BoundExpression disposeCall, BoundAwaitableInfo disposeAwaitableInfoOpt)
568private BoundStatement RewriteForEachStatementAsFor<TArg>(BoundForEachStatement node, GetForEachStatementAsForPreamble? getPreamble, GetForEachStatementAsForItem<TArg> getItem, GetForEachStatementAsForLength<TArg> getLength, TArg arg)
572BoundStatement? rewrittenBody = VisitStatement(node.Body);
593private BoundStatement RewriteForEachStatementAsFor<TArg>(
607BoundStatement rewrittenBody)
620BoundStatement? collectionVarInitializationPreamble = getPreamble?.Invoke(this, forEachSyntax, enumeratorInfo, ref rewrittenExpression, out preambleLocal, out collectionTempRefKind);
626BoundStatement arrayVarDecl = MakeLocalDeclaration(forEachSyntax, collectionTemp, rewrittenExpression);
645BoundStatement positionVarDecl = MakeLocalDeclaration(forEachSyntax, positionVar,
655BoundStatement iterationVariableDecl = LocalOrDeconstructionDeclaration(forEachSyntax, deconstructionOpt, iterationVariables, iterationVarInitValue);
659BoundStatement initializer = new BoundStatementList(forEachSyntax,
660statements: ImmutableArray.Create<BoundStatement>(arrayVarDecl, positionVarDecl));
678BoundStatement positionIncrement = MakePositionIncrement(forEachSyntax, boundPositionVar, intType);
685BoundStatement loopBody = CreateBlockDeclaringIterationVariables(iterationVariables, iterationVariableDecl, rewrittenBody, forEachSyntax);
691BoundStatement result = RewriteForStatementWithoutInnerLocals(
707private delegate BoundStatement? GetForEachStatementAsForPreamble(LocalRewriter rewriter, SyntaxNode syntax, ForEachEnumeratorInfo enumeratorInfo, ref BoundExpression rewrittenExpression, out LocalSymbol? preambleLocal, out RefKind collectionTempRefKind);
711private BoundStatement RewriteForEachStatementAsFor(BoundForEachStatement node, MethodSymbol indexerGet, MethodSymbol lengthGet)
735private BoundStatement RewriteInlineArrayForEachStatementAsFor(BoundForEachStatement node)
750BoundStatement? collectionVarInitializationPreamble = null;
809private BoundStatement LocalOrDeconstructionDeclaration(
815BoundStatement iterationVarDecl;
839BoundStatement iteratorVariableInitialization,
840BoundStatement rewrittenBody,
874private BoundStatement RewriteSingleDimensionalArrayForEachStatement(BoundForEachStatement node)
879BoundStatement? rewrittenBody = VisitStatement(node.Body);
894private BoundStatement RewriteSingleDimensionalArrayForEachEnumerator(
903BoundStatement rewrittenBody)
920BoundStatement arrayVarDecl = MakeLocalDeclaration(forEachSyntax, arrayVar, rewrittenExpression);
934BoundStatement positionVarDecl = MakeLocalDeclaration(forEachSyntax, positionVar,
948BoundStatement iterationVariableDecl = LocalOrDeconstructionDeclaration(forEachSyntax, deconstruction, iterationVariables, iterationVarInitValue);
952BoundStatement initializer = new BoundStatementList(forEachSyntax,
953statements: ImmutableArray.Create<BoundStatement>(arrayVarDecl, positionVarDecl));
974BoundStatement positionIncrement = MakePositionIncrement(forEachSyntax, boundPositionVar, intType);
981BoundStatement loopBody = CreateBlockDeclaringIterationVariables(iterationVariables, iterationVariableDecl, rewrittenBody, forEachSyntax);
987BoundStatement result = RewriteForStatementWithoutInnerLocals(
1023private BoundStatement RewriteMultiDimensionalArrayForEachStatement(BoundForEachStatement node)
1028BoundStatement? rewrittenBody = VisitStatement(node.Body);
1043private BoundStatement RewriteMultiDimensionalArrayForEachEnumerator(
1052BoundStatement rewrittenBody)
1077BoundStatement arrayVarDecl = MakeLocalDeclaration(forEachSyntax, arrayVar, rewrittenExpression);
1089BoundStatement[] upperVarDecl = new BoundStatement[rank];
1128BoundStatement iterationVarDecl = LocalOrDeconstructionDeclaration(forEachSyntax, deconstruction, iterationVariables, iterationVarInitValue);
1137BoundStatement innermostLoopBody = CreateBlockDeclaringIterationVariables(iterationVariables, iterationVarDecl, rewrittenBody, forEachSyntax);
1147BoundStatement? forLoop = null;
1159BoundStatement positionVarDecl = MakeLocalDeclaration(forEachSyntax, positionVar[dimension], currentDimensionLowerBound);
1178BoundStatement positionIncrement = MakePositionIncrement(forEachSyntax, boundPositionVar[dimension], intType);
1180BoundStatement body;
1209BoundStatement result = new BoundBlock(
1240private BoundStatement MakeLocalDeclaration(CSharpSyntaxNode syntax, LocalSymbol local, BoundExpression rewrittenInitialValue)
1242var result = RewriteLocalDeclaration(
1252private BoundStatement MakePositionIncrement(CSharpSyntaxNode syntax, BoundLocal boundPositionVar, TypeSymbol intType)
1275private void InstrumentForEachStatementCollectionVarDeclaration(BoundNode node, [NotNullIfNotNull(nameof(collectionVarDecl))] ref BoundStatement? collectionVarDecl)
1283private void InstrumentForEachStatementIterationVarDeclaration(BoundNode node, ref BoundStatement iterationVarDecl)
1299private 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)
731Debug.Assert(!(node is BoundStatement));
1325var whenNotNullStatement = UpdateStatement(whenNotNullBuilder, _F.ExpressionStatement(whenNotNull));
1337var whenNotNullStatement = UpdateStatement(whenNotNullBuilder, _F.Assignment(_F.Local(tmp), whenNotNull));
1369public static BoundStatement Replace(BoundNode node, BoundExpression receiver, int receiverID, int recursionDepth)
1372var 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)
338var translatedStatement = wrapped();
379F.Block(variableCleanup.SelectAsArray((e, f) => (BoundStatement)f.ExpressionStatement(e), F)));
398internal BoundBlock MakeStateMachineScope(ImmutableArray<StateMachineFieldSymbol> hoistedLocals, BoundStatement statement)
406internal static bool TryUnwrapBoundStateMachineScope(ref BoundStatement statement, out ImmutableArray<StateMachineFieldSymbol> hoistedLocals)
758BoundStatement translated;
864BoundBlock tryBlock = F.Block((BoundStatement)this.Visit(node.TryBlock));
891BoundStatement result = node.Update(tryBlock, catchBlocks, finallyBlockOpt, node.FinallyLabelOpt, node.PreferFaultHandler);
923protected 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()
283private BoundStatement GenerateKickoffMethodBody()
286var bodyBuilder = ArrayBuilder<BoundStatement>.GetInstance();
302protected BoundStatement GenerateParameterStorage(LocalSymbol stateMachineVariable, IReadOnlyDictionary<Symbol, CapturedSymbolReplacement> proxies)
304var bodyBuilder = ArrayBuilder<BoundStatement>.GetInstance();
421var bodyBuilder = ArrayBuilder<BoundStatement>.GetInstance();
425BoundStatement makeIterator = F.Assignment(F.Local(resultVariable), F.New(stateMachineType.Constructor, F.Literal(initialState)));
433var thenBuilder = ArrayBuilder<BoundStatement>.GetInstance(4);
494BoundStatement copy = InitializeParameterField(getEnumeratorMethod, parameter, resultParameter, parameterProxy);
508protected virtual void GenerateResetInstance(ArrayBuilder<BoundStatement> builder, StateMachineState initialState)
515protected virtual BoundStatement InitializeParameterField(MethodSymbol getEnumeratorMethod, ParameterSymbol parameter, BoundExpression resultParameter, BoundExpression parameterProxy)
Lowering\SyntheticBoundNodeFactory.cs (45)
445return Block(ImmutableArray<BoundStatement>.Empty);
448public BoundBlock Block(ImmutableArray<BoundStatement> statements)
453public BoundBlock Block(params BoundStatement[] statements)
458public BoundBlock Block(ImmutableArray<LocalSymbol> locals, params BoundStatement[] statements)
463public BoundBlock Block(ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundStatement> statements)
468public BoundBlock Block(ImmutableArray<LocalSymbol> locals, ImmutableArray<LocalFunctionSymbol> localFunctions, params BoundStatement[] statements)
473public BoundBlock Block(ImmutableArray<LocalSymbol> locals, ImmutableArray<LocalFunctionSymbol> localFunctions, ImmutableArray<BoundStatement> statements)
485return StatementList(ImmutableArray<BoundStatement>.Empty);
488public BoundStatementList StatementList(ImmutableArray<BoundStatement> statements)
493public BoundStatementList StatementList(BoundStatement first, BoundStatement second)
499public BoundStatement? Concat(BoundStatement? first, BoundStatement? second)
502public BoundBlockInstrumentation CombineInstrumentation(BoundBlockInstrumentation? innerInstrumentation = null, LocalSymbol? local = null, BoundStatement? prologue = null, BoundStatement? epilogue = null)
517public BoundStatement Instrument(BoundStatement statement, BoundBlockInstrumentation? instrumentation)
524var statements = new TemporaryArray<BoundStatement>();
569public void CloseMethod(BoundStatement body)
914public BoundStatement If(BoundExpression condition, BoundStatement thenClause, BoundStatement? elseClauseOpt = null)
919public BoundStatement ConditionalGoto(BoundExpression condition, LabelSymbol label, bool jumpIfTrue)
924public BoundStatement If(BoundExpression condition, ImmutableArray<LocalSymbol> locals, BoundStatement thenClause, BoundStatement? elseClauseOpt = null)
939var statements = ArrayBuilder<BoundStatement>.GetInstance();
1033public BoundSpillSequence SpillSequence(ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundStatement> sideEffects, BoundExpression result)
1045public readonly ImmutableArray<BoundStatement> Statements;
1047public SyntheticSwitchSection(ImmutableArray<int> values, ImmutableArray<BoundStatement> statements)
1054public SyntheticSwitchSection SwitchSection(int value, params BoundStatement[] statements)
1057public SyntheticSwitchSection SwitchSection(ImmutableArray<int> values, params BoundStatement[] statements)
1063public BoundStatement Switch(BoundExpression ex, ImmutableArray<SyntheticSwitchSection> sections)
1077var statements = ArrayBuilder<BoundStatement>.GetInstance();
1183public BoundStatement BaseInitialization()
1192public BoundStatement SequencePoint(SyntaxNode syntax, BoundStatement statement)
1197public BoundStatement SequencePointWithSpan(CSharpSyntaxNode syntax, TextSpan span, BoundStatement statement)
1202public BoundStatement HiddenSequencePoint(BoundStatement? statementOpt = null)
1207public BoundStatement ThrowNull()
1575internal BoundStatement Try(
1705internal BoundStatement NoOp(NoOpStatementFlavor noOpStatementFlavor)
Symbols\Synthesized\ReadOnlyListType\SynthesizedReadOnlyListTypeSymbol.cs (12)
471static BoundStatement generateGetEnumerator(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
496static BoundStatement generateCount(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
524static BoundStatement generateIsSynchronized(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
531static BoundStatement generateSyncRoot(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
541static BoundStatement generateIsFixedSize(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
548static BoundStatement generateIsReadOnly(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
555static BoundStatement generateContains(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
591static BoundStatement generateCopyTo(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
598BoundStatement statement;
648static BoundStatement generateIndexer(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
682static BoundStatement generateIndexOf(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
721static 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);