Binder\Binder_Statements.cs (55)
40public virtual BoundStatement BindStatement(StatementSyntax node, BindingDiagnosticBag diagnostics)
60BoundStatement result;
165private BoundStatement BindCheckedStatement(CheckedStatementSyntax node, BindingDiagnosticBag diagnostics)
170private BoundStatement BindUnsafeStatement(UnsafeStatementSyntax node, BindingDiagnosticBag diagnostics)
186private BoundStatement BindFixedStatement(FixedStatementSyntax node, BindingDiagnosticBag diagnostics)
196private BoundStatement BindFixedStatementParts(FixedStatementSyntax node, BindingDiagnosticBag diagnostics)
207BoundStatement boundBody = BindPossibleEmbeddedStatement(node.Statement, diagnostics);
234private BoundStatement BindYieldReturnStatement(YieldStatementSyntax node, BindingDiagnosticBag diagnostics)
279private BoundStatement BindYieldBreakStatement(YieldStatementSyntax node, BindingDiagnosticBag diagnostics)
295private BoundStatement BindLockStatement(LockStatementSyntax node, BindingDiagnosticBag diagnostics)
302internal virtual BoundStatement BindLockStatementParts(BindingDiagnosticBag diagnostics, Binder originalBinder)
307private BoundStatement BindUsingStatement(UsingStatementSyntax node, BindingDiagnosticBag diagnostics)
314internal virtual BoundStatement BindUsingStatementParts(BindingDiagnosticBag diagnostics, Binder originalBinder)
319internal BoundStatement BindPossibleEmbeddedStatement(StatementSyntax node, BindingDiagnosticBag diagnostics)
434private BoundStatement BindThrow(ThrowStatementSyntax node, BindingDiagnosticBag diagnostics)
464private static BoundStatement BindEmpty(EmptyStatementSyntax node)
506var body = BindStatement(node.Statement, diagnostics);
510private BoundStatement BindGoto(GotoStatementSyntax node, BindingDiagnosticBag diagnostics)
554private BoundStatement BindLocalFunctionStatement(LocalFunctionStatementSyntax node, BindingDiagnosticBag diagnostics)
644public BoundStatement BindExpressionStatement(ExpressionStatementSyntax node, BindingDiagnosticBag diagnostics)
688internal BoundStatement BindLocalDeclarationStatement(LocalDeclarationStatementSyntax node, BindingDiagnosticBag diagnostics)
700private BoundStatement BindUsingDeclarationStatementParts(LocalDeclarationStatementSyntax node, BindingDiagnosticBag diagnostics)
702var usingDeclaration = UsingStatementBinder.BindUsingStatementOrDeclarationFromParts(node, node.UsingKeyword, node.AwaitKeyword, originalBinder: this, usingBinderOpt: null, diagnostics);
707private BoundStatement BindDeclarationStatementParts(LocalDeclarationStatementSyntax node, BindingDiagnosticBag diagnostics)
1919ArrayBuilder<BoundStatement> boundStatements = ArrayBuilder<BoundStatement>.GetInstance(nStatements);
1923var boundStatement = BindStatement(syntaxStatements[i], diagnostics);
1930private BoundBlock FinishBindBlockParts(CSharpSyntaxNode node, ImmutableArray<BoundStatement> boundStatements)
2572private BoundStatement BindIfStatement(IfStatementSyntax node, BindingDiagnosticBag diagnostics)
2576static BoundStatement bindIfStatement(Binder binder, IfStatementSyntax node, BindingDiagnosticBag diagnostics)
2578var stack = ArrayBuilder<(Binder, IfStatementSyntax IfStatementSyntax, BoundExpression Condition, BoundStatement Consequence)>.GetInstance();
2580BoundStatement? alternative;
2584var consequence = binder.BindPossibleEmbeddedStatement(node.Statement, diagnostics);
2614BoundStatement result;
2618BoundStatement consequence;
2635protected virtual bool TryGetBoundElseIfStatement(IfStatementSyntax node, out BoundStatement? alternative)
2775private BoundStatement BindSwitchStatement(SwitchStatementSyntax node, BindingDiagnosticBag diagnostics)
2782internal virtual BoundStatement BindSwitchStatementCore(SwitchStatementSyntax node, Binder originalBinder, BindingDiagnosticBag diagnostics)
2792private BoundStatement BindWhile(WhileStatementSyntax node, BindingDiagnosticBag diagnostics)
2806private BoundStatement BindDo(DoStatementSyntax node, BindingDiagnosticBag diagnostics)
2831internal BoundStatement BindForOrUsingOrFixedDeclarations(VariableDeclarationSyntax nodeOpt, LocalDeclarationKind localKind, BindingDiagnosticBag diagnostics, out ImmutableArray<BoundLocalDeclaration> declarations)
2888(BoundStatement)declarations[0] :
2892internal BoundStatement BindStatementExpressionList(SeparatedSyntaxList<ExpressionSyntax> statements, BindingDiagnosticBag diagnostics)
2906var statementBuilder = ArrayBuilder<BoundStatement>.GetInstance();
2917private BoundStatement BindForEach(CommonForEachStatementSyntax node, BindingDiagnosticBag diagnostics)
2923internal virtual BoundStatement BindForEachParts(BindingDiagnosticBag diagnostics, Binder originalBinder)
2931internal virtual BoundStatement BindForEachDeconstruction(BindingDiagnosticBag diagnostics, Binder originalBinder)
2936private BoundStatement BindBreak(BreakStatementSyntax node, BindingDiagnosticBag diagnostics)
2947private BoundStatement BindContinue(ContinueStatementSyntax node, BindingDiagnosticBag diagnostics)
3024private BoundStatement BindReturn(ReturnStatementSyntax syntax, BindingDiagnosticBag diagnostics)
3491BoundStatement statement;
3694ArrayBuilder<BoundStatement> boundStatements = ArrayBuilder<BoundStatement>.GetInstance();
3706var boundStatement = BindStatement(topLevelStatement.Statement, diagnostics);
3739blockBody: 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)
537public static BoundStatementList Synthesized(SyntaxNode syntax, params BoundStatement[] statements)
542public static BoundStatementList Synthesized(SyntaxNode syntax, bool hasErrors, params BoundStatement[] statements)
547public static BoundStatementList Synthesized(SyntaxNode syntax, ImmutableArray<BoundStatement> statements)
552public static BoundStatementList Synthesized(SyntaxNode syntax, bool hasErrors, ImmutableArray<BoundStatement> statements)
584public BoundBlock(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundStatement> statements, bool hasErrors = false)
589public static BoundBlock SynthesizedNoLocals(SyntaxNode syntax, BoundStatement statement)
595public static BoundBlock SynthesizedNoLocals(SyntaxNode syntax, ImmutableArray<BoundStatement> statements)
600public 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 (24)
263BoundStatement body = synthesizedEntryPoint.CreateBody(diagnostics);
277var loweredBody = LowerBodyOrInitializer(
772BoundStatement loweredBody = IteratorRewriter.Rewrite(methodWithBody.Body, method, methodOrdinal, stateMachineStateDebugInfoBuilder, variableSlotAllocatorOpt, compilationState, diagnosticsThisMethod, out iteratorStateMachine);
1006body = new BoundBlock(methodSymbol.GetNonNullSyntaxNode(), ImmutableArray<LocalSymbol>.Empty, ImmutableArray<BoundStatement>.Empty) { WasCompilerGenerated = true };
1216BoundStatement loweredBodyOpt = null;
1261ImmutableArray<BoundStatement> boundStatements;
1269boundStatements = ImmutableArray<BoundStatement>.Empty;
1279var initializers = ArrayBuilder<BoundStatement>.GetInstance(capturedParameters.Count);
1299BoundStatement lowered = LowerBodyOrInitializer(
1466internal static BoundStatement LowerBodyOrInitializer(
1470BoundStatement body,
1495var loweredBody = LocalRewriter.Rewrite(
1520loweredBody = (BoundStatement)extensionRewriter.Visit(loweredBody);
1555BoundStatement bodyWithoutLambdas = loweredBody;
1579BoundStatement bodyWithoutIterators = IteratorRewriter.Rewrite(bodyWithoutLambdas, method, methodOrdinal, stateMachineStateDebugInfoBuilder, lazyVariableSlotAllocator, compilationState, diagnostics,
1587BoundStatement bodyWithoutAsync;
1619BoundStatement block,
1994body = new BoundBlock(constructor.Syntax, constructor.Locals, ImmutableArray.Create<BoundStatement>(constructor.Initializer));
1998body = new BoundBlock(constructor.Syntax, constructor.Locals, ImmutableArray.Create<BoundStatement>(constructor.Initializer, body));
2043var stmts = ArrayBuilder<BoundStatement>.GetInstance();
2075var constructorInitializer = BindImplicitConstructorInitializerIfAny(method, compilationState, diagnostics);
2076ImmutableArray<BoundStatement> statements;
2085statements = ImmutableArray<BoundStatement>.Empty;
2467private static BoundStatement BindImplicitConstructorInitializerIfAny(MethodSymbol method, TypeCompilationState compilationState, BindingDiagnosticBag diagnostics)
FlowAnalysis\AbstractFlowPass.cs (21)
92private PooledHashSet<BoundStatement> _labelsSeen;
209_labelsSeen = PooledHashSet<BoundStatement>.GetInstance();
669protected virtual void VisitStatement(BoundStatement statement)
761protected virtual void NoteBranch(PendingBranch pending, BoundNode gotoStmt, BoundStatement target)
772private bool ResolveBranches(LabelSymbol label, BoundStatement? target)
791protected virtual void ResolveBranch(PendingBranch pending, LabelSymbol label, BoundStatement? target, ref bool labelStateChanged)
810public readonly PooledHashSet<BoundStatement> LabelsSeen;
812public SavedPending(PendingBranchesCollection pendingBranches, PooledHashSet<BoundStatement> labelsSeen)
830_labelsSeen = PooledHashSet<BoundStatement>.GetInstance();
844foreach (var node in _labelsSeen)
1310private void VisitStatements(ImmutableArray<BoundStatement> statements)
1312foreach (var statement in statements)
1596if (child is BoundStatement)
1598VisitStatement(child as BoundStatement);
1789var alternative = node.AlternativeOpt;
1915private void VisitTryBlockWithAnyTransferFunction(BoundStatement tryBlock, BoundTryStatement node, ref TLocalState tryState)
1939protected virtual void VisitTryBlock(BoundStatement tryBlock, BoundTryStatement node, ref TLocalState tryState)
1989private void VisitFinallyBlockWithAnyTransferFunction(BoundStatement finallyBlock, ref TLocalState stateMovedUp)
2013protected virtual void VisitFinallyBlock(BoundStatement finallyBlock, ref TLocalState stateMovedUp)
3236foreach (var statement in node.Statements)
3374protected void VisitLabel(LabelSymbol label, BoundStatement node)
Generated\BoundNodes.xml.Generated.cs (148)
380public BoundGlobalStatementInitializer(SyntaxNode syntax, BoundStatement statement, bool hasErrors = false)
389public BoundStatement Statement { get; }
394public BoundGlobalStatementInitializer Update(BoundStatement statement)
2259public BoundBlockInstrumentation(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, BoundStatement? prologue, BoundStatement? epilogue, bool hasErrors = false)
2271public BoundStatement? Prologue { get; }
2272public BoundStatement? Epilogue { get; }
2277public BoundBlockInstrumentation Update(ImmutableArray<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<MethodSymbol> localFunctions, bool hasUnsafeModifier, BoundBlockInstrumentation? instrumentation, ImmutableArray<BoundStatement> statements, bool hasErrors = false)
3326public BoundBlock Update(ImmutableArray<LocalSymbol> locals, ImmutableArray<MethodSymbol> 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, LabelSymbol breakLabel, LabelSymbol continueLabel, bool hasErrors = false)
3929public BoundStatement Body { get; }
3934public BoundDoStatement(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, BoundExpression condition, BoundStatement body, LabelSymbol breakLabel, LabelSymbol continueLabel, bool hasErrors = false)
3950public BoundDoStatement Update(ImmutableArray<LocalSymbol> locals, BoundExpression condition, BoundStatement body, LabelSymbol breakLabel, LabelSymbol continueLabel)
3964public BoundWhileStatement(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, BoundExpression condition, BoundStatement body, LabelSymbol breakLabel, LabelSymbol continueLabel, bool hasErrors = false)
3980public BoundWhileStatement Update(ImmutableArray<LocalSymbol> locals, BoundExpression condition, BoundStatement body, LabelSymbol breakLabel, LabelSymbol continueLabel)
3994public BoundForStatement(SyntaxNode syntax, ImmutableArray<LocalSymbol> outerLocals, BoundStatement? initializer, ImmutableArray<LocalSymbol> innerLocals, BoundExpression? condition, BoundStatement? increment, BoundStatement body, LabelSymbol breakLabel, LabelSymbol 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, LabelSymbol breakLabel, LabelSymbol 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, LabelSymbol breakLabel, LabelSymbol 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, LabelSymbol breakLabel, LabelSymbol 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)
8766public BoundConstructorMethodBody(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, BoundStatement? initializer, BoundBlock? blockBody, BoundBlock? expressionBody, bool hasErrors = false)
8777public BoundStatement? Initializer { get; }
8782public BoundConstructorMethodBody Update(ImmutableArray<LocalSymbol> locals, BoundStatement? initializer, BoundBlock? blockBody, BoundBlock? expressionBody)
10860BoundStatement statement = (BoundStatement)this.Visit(node.Statement);
11206BoundStatement? prologue = (BoundStatement?)this.Visit(node.Prologue);
11207BoundStatement? epilogue = (BoundStatement?)this.Visit(node.Epilogue);
11353BoundStatement? statementOpt = (BoundStatement?)this.Visit(node.StatementOpt);
11358BoundStatement? statementOpt = (BoundStatement?)this.Visit(node.StatementOpt);
11369ImmutableArray<BoundStatement> statements = this.VisitList(node.Statements);
11375ImmutableArray<BoundStatement> statements = this.VisitList(node.Statements);
11381BoundStatement statement = (BoundStatement)this.Visit(node.Statement);
11462BoundStatement consequence = (BoundStatement)this.Visit(node.Consequence);
11463BoundStatement? alternativeOpt = (BoundStatement?)this.Visit(node.AlternativeOpt);
11472BoundStatement body = (BoundStatement)this.Visit(node.Body);
11481BoundStatement body = (BoundStatement)this.Visit(node.Body);
11490BoundStatement? initializer = (BoundStatement?)this.Visit(node.Initializer);
11492BoundStatement? increment = (BoundStatement?)this.Visit(node.Increment);
11493BoundStatement body = (BoundStatement)this.Visit(node.Body);
11508BoundStatement body = (BoundStatement)this.Visit(node.Body);
11522BoundStatement body = (BoundStatement)this.Visit(node.Body);
11530BoundStatement body = (BoundStatement)this.Visit(node.Body);
11536BoundStatement body = (BoundStatement)this.Visit(node.Body);
11627BoundStatement body = (BoundStatement)this.Visit(node.Body);
11638ImmutableArray<BoundStatement> statements = this.VisitList(node.Statements);
11797ImmutableArray<BoundStatement> statements = this.VisitList(node.Statements);
11824ImmutableArray<BoundStatement> sideEffects = this.VisitList(node.SideEffects);
11957BoundStatement? iteratorBody = node.IteratorBody;
12180ImmutableArray<BoundStatement> statements = this.VisitList(node.Statements);
12383BoundStatement? initializer = (BoundStatement?)this.Visit(node.Initializer);
13167BoundStatement? prologue = (BoundStatement?)this.Visit(node.Prologue);
13168BoundStatement? epilogue = (BoundStatement?)this.Visit(node.Epilogue);
13531ImmutableArray<BoundStatement> statements = this.VisitList(node.Statements);
13538ImmutableArray<BoundStatement> statements = this.VisitList(node.Statements);
13545BoundStatement statement = (BoundStatement)this.Visit(node.Statement);
13581BoundStatement body = (BoundStatement)this.Visit(node.Body);
13589BoundStatement body = (BoundStatement)this.Visit(node.Body);
13597BoundStatement? initializer = (BoundStatement?)this.Visit(node.Initializer);
13599BoundStatement? increment = (BoundStatement?)this.Visit(node.Increment);
13600BoundStatement body = (BoundStatement)this.Visit(node.Body);
13614BoundStatement body = (BoundStatement)this.Visit(node.Body);
13623BoundStatement body = (BoundStatement)this.Visit(node.Body);
13632BoundStatement body = (BoundStatement)this.Visit(node.Body);
13902ImmutableArray<BoundStatement> statements = this.VisitList(node.Statements);
13945ImmutableArray<BoundStatement> sideEffects = this.VisitList(node.SideEffects);
15090BoundStatement? initializer = (BoundStatement?)this.Visit(node.Initializer);
Lowering\AsyncRewriter\AsyncRewriter.AsyncIteratorRewriter.cs (15)
35BoundStatement body,
163var bodyBuilder = ArrayBuilder<BoundStatement>.GetInstance();
200protected override void InitializeStateMachine(ArrayBuilder<BoundStatement> bodyBuilder, NamedTypeSymbol frameType, LocalSymbol stateMachineLocal)
210protected override BoundStatement InitializeParameterField(MethodSymbol getEnumeratorMethod, ParameterSymbol parameter, BoundExpression resultParameter, BoundExpression parameterProxy)
212BoundStatement result;
263protected override BoundStatement GenerateStateMachineCreation(LocalSymbol stateMachineVariable, NamedTypeSymbol frameType, IReadOnlyDictionary<Symbol, CapturedSymbolReplacement> proxies)
265var bodyBuilder = ArrayBuilder<BoundStatement>.GetInstance();
326out BoundStatement instAssignment,
330BoundStatement ifFinished = F.If(
341var ifPromiseReady = F.If(
368private void GetPartsForStartingMachine(out BoundExpressionStatement callReset, out LocalSymbol instSymbol, out BoundStatement instAssignment,
436out BoundStatement instAssignment,
440BoundStatement ifInvalidState = F.If(
446BoundStatement ifFinished = F.If(
663protected override void GenerateResetInstance(ArrayBuilder<BoundStatement> builder, StateMachineState initialState)
Lowering\Instrumentation\CodeCoverageInstrumenter.cs (60)
27private readonly BoundStatement _methodBody;
32private readonly BoundStatement? _methodEntryInstrumentation;
41BoundStatement methodBody,
103BoundStatement methodBody,
237public override void InstrumentBlock(BoundBlock original, LocalRewriter rewriter, ref TemporaryArray<LocalSymbol> additionalLocals, out BoundStatement? prologue, out BoundStatement? epilogue, out BoundBlockInstrumentation? instrumentation)
239base.InstrumentBlock(original, rewriter, ref additionalLocals, out var previousPrologue, out epilogue, out instrumentation);
261BoundStatement payloadInitialization =
276BoundStatement createPayloadCall =
296BoundStatement payloadIf = _methodBodyFactory.If(payloadNullTest, createPayloadCall);
300var prologueStatements = ArrayBuilder<BoundStatement>.GetInstance(2 + (_methodEntryInstrumentation != null ? 1 : 0) + (previousPrologue != null ? 1 : 0));
319public override BoundStatement InstrumentNoOpStatement(BoundNoOpStatement original, BoundStatement rewritten)
324public override BoundStatement InstrumentBreakStatement(BoundBreakStatement original, BoundStatement rewritten)
329public override BoundStatement InstrumentContinueStatement(BoundContinueStatement original, BoundStatement rewritten)
334public override BoundStatement InstrumentExpressionStatement(BoundExpressionStatement original, BoundStatement rewritten)
339public override BoundStatement InstrumentFieldOrPropertyInitializer(BoundStatement original, BoundStatement rewritten)
344public override BoundStatement InstrumentGotoStatement(BoundGotoStatement original, BoundStatement rewritten)
349public override BoundStatement InstrumentThrowStatement(BoundThrowStatement original, BoundStatement rewritten)
354public override BoundStatement InstrumentYieldBreakStatement(BoundYieldBreakStatement original, BoundStatement rewritten)
359public override BoundStatement InstrumentYieldReturnStatement(BoundYieldReturnStatement original, BoundStatement rewritten)
364public override BoundStatement InstrumentForEachStatementIterationVarDeclaration(BoundForEachStatement original, BoundStatement iterationVarDecl)
369public override BoundStatement InstrumentForEachStatementDeconstructionVariablesDeclaration(BoundForEachStatement original, BoundStatement iterationVarDecl)
374public override BoundStatement InstrumentIfStatementConditionalGoto(BoundIfStatement original, BoundStatement rewritten)
379public override BoundStatement InstrumentWhileStatementConditionalGotoStartOrBreak(BoundWhileStatement original, BoundStatement ifConditionGotoStart)
384public override BoundStatement InstrumentUserDefinedLocalInitialization(BoundLocalDeclaration original, BoundStatement rewritten)
389public override BoundStatement InstrumentLockTargetCapture(BoundLockStatement original, BoundStatement lockTargetCapture)
394public override BoundStatement InstrumentReturnStatement(BoundReturnStatement original, BoundStatement rewritten)
432public override BoundStatement InstrumentSwitchStatement(BoundSwitchStatement original, BoundStatement rewritten)
437public override BoundStatement InstrumentSwitchWhenClauseConditionalGotoBody(BoundExpression original, BoundStatement ifConditionGotoBody)
450public override BoundStatement InstrumentUsingTargetCapture(BoundUsingStatement original, BoundStatement usingTargetCapture)
455private BoundStatement AddDynamicAnalysis(BoundStatement original, BoundStatement rewritten)
469private BoundStatement CollectDynamicAnalysis(BoundStatement original, BoundStatement rewritten)
493private BoundStatement AddAnalysisPoint(SyntaxNode syntaxForSpan, Text.TextSpan alternateSpan, SyntheticBoundNodeFactory statementFactory)
498private BoundStatement AddAnalysisPoint(SyntaxNode syntaxForSpan, SyntheticBoundNodeFactory statementFactory)
503private BoundStatement AddAnalysisPoint(SyntaxNode syntaxForSpan, FileLinePositionSpan span, SyntheticBoundNodeFactory statementFactory)
523private static SyntaxNode SyntaxForSpan(BoundStatement statement)
Lowering\Instrumentation\CompoundInstrumenter.cs (56)
39public override BoundStatement InstrumentNoOpStatement(BoundNoOpStatement original, BoundStatement rewritten)
44public override BoundStatement InstrumentYieldBreakStatement(BoundYieldBreakStatement original, BoundStatement rewritten)
49public override BoundStatement InstrumentYieldReturnStatement(BoundYieldReturnStatement original, BoundStatement rewritten)
54public override BoundStatement InstrumentThrowStatement(BoundThrowStatement original, BoundStatement rewritten)
59public override BoundStatement InstrumentContinueStatement(BoundContinueStatement original, BoundStatement rewritten)
64public override BoundStatement InstrumentGotoStatement(BoundGotoStatement original, BoundStatement rewritten)
69public override BoundStatement InstrumentExpressionStatement(BoundExpressionStatement original, BoundStatement rewritten)
74public override BoundStatement InstrumentFieldOrPropertyInitializer(BoundStatement original, BoundStatement rewritten)
79public override BoundStatement InstrumentBreakStatement(BoundBreakStatement original, BoundStatement rewritten)
89public override void InstrumentBlock(BoundBlock original, LocalRewriter rewriter, ref TemporaryArray<LocalSymbol> additionalLocals, out BoundStatement? prologue, out BoundStatement? epilogue, out BoundBlockInstrumentation? instrumentation)
99public override BoundStatement InstrumentDoStatementConditionalGotoStart(BoundDoStatement original, BoundStatement ifConditionGotoStart)
104public override BoundStatement? InstrumentForEachStatementCollectionVarDeclaration(BoundForEachStatement original, BoundStatement? collectionVarDecl)
109public override BoundStatement InstrumentForEachStatement(BoundForEachStatement original, BoundStatement rewritten)
114public override BoundStatement InstrumentForEachStatementIterationVarDeclaration(BoundForEachStatement original, BoundStatement iterationVarDecl)
119public override BoundStatement InstrumentForStatementConditionalGotoStartOrBreak(BoundForStatement original, BoundStatement branchBack)
124public override BoundStatement InstrumentForEachStatementConditionalGotoStart(BoundForEachStatement original, BoundStatement branchBack)
134public override BoundStatement InstrumentIfStatementConditionalGoto(BoundIfStatement original, BoundStatement rewritten)
144public override BoundStatement InstrumentLabelStatement(BoundLabeledStatement original, BoundStatement rewritten)
149public override BoundStatement InstrumentUserDefinedLocalInitialization(BoundLocalDeclaration original, BoundStatement rewritten)
183public override BoundStatement InstrumentLockTargetCapture(BoundLockStatement original, BoundStatement lockTargetCapture)
188public override BoundStatement InstrumentReturnStatement(BoundReturnStatement original, BoundStatement rewritten)
193public override BoundStatement InstrumentSwitchStatement(BoundSwitchStatement original, BoundStatement rewritten)
198public override BoundStatement InstrumentSwitchWhenClauseConditionalGotoBody(BoundExpression original, BoundStatement ifConditionGotoBody)
203public override BoundStatement InstrumentUsingTargetCapture(BoundUsingStatement original, BoundStatement usingTargetCapture)
213public override BoundStatement InstrumentWhileStatementConditionalGotoStartOrBreak(BoundWhileStatement original, BoundStatement ifConditionGotoStart)
237public override BoundExpression InstrumentSwitchStatementExpression(BoundStatement original, BoundExpression rewrittenExpression, SyntheticBoundNodeFactory factory)
247public override BoundStatement InstrumentSwitchBindCasePatternVariables(BoundStatement bindings)
252public override BoundStatement InstrumentForEachStatementDeconstructionVariablesDeclaration(BoundForEachStatement original, BoundStatement iterationVarDecl)
Lowering\Instrumentation\DebugInfoInjector.cs (61)
40public override BoundStatement InstrumentNoOpStatement(BoundNoOpStatement original, BoundStatement rewritten)
45public override BoundStatement InstrumentBreakStatement(BoundBreakStatement original, BoundStatement rewritten)
50public override BoundStatement InstrumentContinueStatement(BoundContinueStatement original, BoundStatement rewritten)
55public override BoundStatement InstrumentExpressionStatement(BoundExpressionStatement original, BoundStatement rewritten)
118public override BoundStatement InstrumentFieldOrPropertyInitializer(BoundStatement original, BoundStatement rewritten)
132private static BoundStatement InstrumentFieldOrPropertyInitializer(BoundStatement rewritten, SyntaxNode syntax)
158public override BoundStatement InstrumentGotoStatement(BoundGotoStatement original, BoundStatement rewritten)
163public override BoundStatement InstrumentThrowStatement(BoundThrowStatement original, BoundStatement rewritten)
168public override BoundStatement InstrumentYieldBreakStatement(BoundYieldBreakStatement original, BoundStatement rewritten)
181public override BoundStatement InstrumentYieldReturnStatement(BoundYieldReturnStatement original, BoundStatement rewritten)
186public override void InstrumentBlock(BoundBlock original, LocalRewriter rewriter, ref TemporaryArray<LocalSymbol> additionalLocals, out BoundStatement? prologue, out BoundStatement? epilogue, out BoundBlockInstrumentation? instrumentation)
188base.InstrumentBlock(original, rewriter, ref additionalLocals, out var previousPrologue, out var previousEpilogue, out instrumentation);
241public override BoundStatement InstrumentDoStatementConditionalGotoStart(BoundDoStatement original, BoundStatement ifConditionGotoStart)
251public override BoundStatement InstrumentWhileStatementConditionalGotoStartOrBreak(BoundWhileStatement original, BoundStatement ifConditionGotoStart)
269public override BoundStatement InstrumentForEachStatementCollectionVarDeclaration(BoundForEachStatement original, BoundStatement? collectionVarDecl)
276public override BoundStatement InstrumentForEachStatementDeconstructionVariablesDeclaration(BoundForEachStatement original, BoundStatement iterationVarDecl)
290public override BoundStatement InstrumentForEachStatement(BoundForEachStatement original, BoundStatement rewritten)
299ImmutableArray.Create<BoundStatement>(foreachKeywordSequencePoint,
311public override BoundStatement InstrumentForEachStatementIterationVarDeclaration(BoundForEachStatement original, BoundStatement iterationVarDecl)
336public override BoundStatement InstrumentForStatementConditionalGotoStartOrBreak(BoundForStatement original, BoundStatement branchBack)
343public override BoundStatement InstrumentForEachStatementConditionalGotoStart(BoundForEachStatement original, BoundStatement branchBack)
358public override BoundStatement InstrumentIfStatementConditionalGoto(BoundIfStatement original, BoundStatement rewritten)
377public override BoundStatement InstrumentLabelStatement(BoundLabeledStatement original, BoundStatement rewritten)
386public override BoundStatement InstrumentUserDefinedLocalInitialization(BoundLocalDeclaration original, BoundStatement rewritten)
394public override BoundStatement InstrumentLockTargetCapture(BoundLockStatement original, BoundStatement lockTargetCapture)
402public override BoundStatement InstrumentReturnStatement(BoundReturnStatement original, BoundStatement rewritten)
423public override BoundStatement InstrumentSwitchStatement(BoundSwitchStatement original, BoundStatement rewritten)
437public override BoundStatement InstrumentSwitchWhenClauseConditionalGotoBody(BoundExpression original, BoundStatement ifConditionGotoBody)
448public override BoundStatement InstrumentUsingTargetCapture(BoundUsingStatement original, BoundStatement usingTargetCapture)
486public override BoundExpression InstrumentSwitchStatementExpression(BoundStatement original, BoundExpression rewrittenExpression, SyntheticBoundNodeFactory factory)
498public override BoundStatement InstrumentSwitchBindCasePatternVariables(BoundStatement bindings)
Lowering\Instrumentation\Instrumenter.cs (59)
37private static BoundStatement InstrumentStatement(BoundStatement original, BoundStatement rewritten)
43public virtual BoundStatement InstrumentNoOpStatement(BoundNoOpStatement original, BoundStatement rewritten)
48public virtual BoundStatement InstrumentYieldBreakStatement(BoundYieldBreakStatement original, BoundStatement rewritten)
54public virtual BoundStatement InstrumentYieldReturnStatement(BoundYieldReturnStatement original, BoundStatement rewritten)
74public virtual void InstrumentBlock(BoundBlock original, LocalRewriter rewriter, ref TemporaryArray<LocalSymbol> additionalLocals, out BoundStatement? prologue, out BoundStatement? epilogue, out BoundBlockInstrumentation? instrumentation)
81public virtual BoundStatement InstrumentThrowStatement(BoundThrowStatement original, BoundStatement rewritten)
86public virtual BoundStatement InstrumentContinueStatement(BoundContinueStatement original, BoundStatement rewritten)
91public virtual BoundStatement InstrumentGotoStatement(BoundGotoStatement original, BoundStatement rewritten)
96public virtual BoundStatement InstrumentExpressionStatement(BoundExpressionStatement original, BoundStatement rewritten)
101public virtual BoundStatement InstrumentFieldOrPropertyInitializer(BoundStatement original, BoundStatement rewritten)
107public virtual BoundStatement InstrumentBreakStatement(BoundBreakStatement original, BoundStatement rewritten)
128public virtual BoundStatement InstrumentDoStatementConditionalGotoStart(BoundDoStatement original, BoundStatement ifConditionGotoStart)
135public virtual BoundStatement InstrumentWhileStatementConditionalGotoStartOrBreak(BoundWhileStatement original, BoundStatement ifConditionGotoStart)
143public virtual BoundStatement? InstrumentForEachStatementCollectionVarDeclaration(BoundForEachStatement original, BoundStatement? collectionVarDecl)
150public virtual BoundStatement InstrumentForEachStatement(BoundForEachStatement original, BoundStatement rewritten)
156public virtual BoundStatement InstrumentForEachStatementIterationVarDeclaration(BoundForEachStatement original, BoundStatement iterationVarDecl)
163public virtual BoundStatement InstrumentForEachStatementDeconstructionVariablesDeclaration(BoundForEachStatement original, BoundStatement iterationVarDecl)
170public virtual BoundStatement InstrumentForEachStatementConditionalGotoStart(BoundForEachStatement original, BoundStatement branchBack)
177public virtual BoundStatement InstrumentForStatementConditionalGotoStartOrBreak(BoundForStatement original, BoundStatement branchBack)
192public virtual BoundStatement InstrumentIfStatementConditionalGoto(BoundIfStatement original, BoundStatement rewritten)
206public virtual BoundStatement InstrumentLabelStatement(BoundLabeledStatement original, BoundStatement rewritten)
212public virtual BoundStatement InstrumentUserDefinedLocalInitialization(BoundLocalDeclaration original, BoundStatement rewritten)
256public virtual BoundStatement InstrumentLockTargetCapture(BoundLockStatement original, BoundStatement lockTargetCapture)
263public virtual BoundStatement InstrumentReturnStatement(BoundReturnStatement original, BoundStatement rewritten)
268public virtual BoundStatement InstrumentSwitchStatement(BoundSwitchStatement original, BoundStatement rewritten)
279public virtual BoundStatement InstrumentSwitchWhenClauseConditionalGotoBody(BoundExpression original, BoundStatement ifConditionGotoBody)
286public virtual BoundStatement InstrumentUsingTargetCapture(BoundUsingStatement original, BoundStatement usingTargetCapture)
305public virtual BoundExpression InstrumentSwitchStatementExpression(BoundStatement original, BoundExpression rewrittenExpression, SyntheticBoundNodeFactory factory)
323public virtual BoundStatement InstrumentSwitchBindCasePatternVariables(BoundStatement bindings)
Lowering\Instrumentation\LocalStateTracingInstrumenter.cs (9)
154BoundStatement methodBody,
284public override void InstrumentBlock(BoundBlock original, LocalRewriter rewriter, ref TemporaryArray<LocalSymbol> additionalLocals, out BoundStatement? prologue, out BoundStatement? epilogue, out BoundBlockInstrumentation? instrumentation)
286base.InstrumentBlock(original, rewriter, ref additionalLocals, out var previousPrologue, out epilogue, out instrumentation);
303var prologueBuilder = ArrayBuilder<BoundStatement>.GetInstance(_factory.CurrentFunction.ParameterCount);
348var instrumentationPrologue = (entryLogger != null) ?
352var instrumentationEpilogue = (returnLogger != null) ?
544ImmutableArray.Create<BoundStatement>(logCallStatement, rewrittenFilterPrologue) :
545ImmutableArray.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(
423BoundStatement localInit = InstrumentLocalDeclarationIfNecessary(localDecl, localSymbol, factory.Assignment(factory.Local(localSymbol), pinAndGetPtr));
436private BoundStatement InitializeFixedStatementStringLocal(
462BoundStatement stringTempInit = factory.Assignment(factory.Local(pinnedTemp), initializerExpr);
472BoundStatement localInit = InstrumentLocalDeclarationIfNecessary(localDecl, localSymbol,
489BoundStatement conditionalAdd = factory.If(notNullCheck, factory.Assignment(factory.Local(localSymbol), addition));
505private BoundStatement InitializeFixedStatementArrayLocal(
572BoundStatement localInit = factory.ExpressionStatement(
Lowering\LocalRewriter\LocalRewriter_ForEachStatement.cs (70)
114private BoundStatement RewriteEnumeratorForEachStatement(BoundForEachStatement node)
119BoundStatement? rewrittenBody = VisitStatement(node.Body);
136private BoundStatement RewriteForEachEnumerator(
147BoundStatement rewrittenBody)
188BoundStatement enumeratorVarDecl = MakeLocalDeclaration(forEachSyntax, enumeratorVar, enumeratorVarInitValue);
207BoundStatement 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)
555private BoundStatement RewriteForEachStatementAsFor<TArg>(BoundForEachStatement node, GetForEachStatementAsForPreamble? getPreamble, GetForEachStatementAsForItem<TArg> getItem, GetForEachStatementAsForLength<TArg> getLength, TArg arg)
559BoundStatement? rewrittenBody = VisitStatement(node.Body);
580private BoundStatement RewriteForEachStatementAsFor<TArg>(
594BoundStatement rewrittenBody)
607BoundStatement? collectionVarInitializationPreamble = getPreamble?.Invoke(this, forEachSyntax, enumeratorInfo, ref rewrittenExpression, out preambleLocal, out collectionTempRefKind);
613BoundStatement arrayVarDecl = MakeLocalDeclaration(forEachSyntax, collectionTemp, rewrittenExpression);
632BoundStatement positionVarDecl = MakeLocalDeclaration(forEachSyntax, positionVar,
642BoundStatement iterationVariableDecl = LocalOrDeconstructionDeclaration(forEachSyntax, deconstructionOpt, iterationVariables, iterationVarInitValue);
646BoundStatement initializer = new BoundStatementList(forEachSyntax,
647statements: ImmutableArray.Create<BoundStatement>(arrayVarDecl, positionVarDecl));
665BoundStatement positionIncrement = MakePositionIncrement(forEachSyntax, boundPositionVar, intType);
672BoundStatement loopBody = CreateBlockDeclaringIterationVariables(iterationVariables, iterationVariableDecl, rewrittenBody, forEachSyntax);
678BoundStatement result = RewriteForStatementWithoutInnerLocals(
694private delegate BoundStatement? GetForEachStatementAsForPreamble(LocalRewriter rewriter, SyntaxNode syntax, ForEachEnumeratorInfo enumeratorInfo, ref BoundExpression rewrittenExpression, out LocalSymbol? preambleLocal, out RefKind collectionTempRefKind);
698private BoundStatement RewriteForEachStatementAsFor(BoundForEachStatement node, MethodSymbol indexerGet, MethodSymbol lengthGet)
722private BoundStatement RewriteInlineArrayForEachStatementAsFor(BoundForEachStatement node)
737BoundStatement? collectionVarInitializationPreamble = null;
796private BoundStatement LocalOrDeconstructionDeclaration(
802BoundStatement iterationVarDecl;
826BoundStatement iteratorVariableInitialization,
827BoundStatement rewrittenBody,
861private BoundStatement RewriteSingleDimensionalArrayForEachStatement(BoundForEachStatement node)
866BoundStatement? rewrittenBody = VisitStatement(node.Body);
881private BoundStatement RewriteSingleDimensionalArrayForEachEnumerator(
890BoundStatement rewrittenBody)
907BoundStatement arrayVarDecl = MakeLocalDeclaration(forEachSyntax, arrayVar, rewrittenExpression);
921BoundStatement positionVarDecl = MakeLocalDeclaration(forEachSyntax, positionVar,
935BoundStatement iterationVariableDecl = LocalOrDeconstructionDeclaration(forEachSyntax, deconstruction, iterationVariables, iterationVarInitValue);
939BoundStatement initializer = new BoundStatementList(forEachSyntax,
940statements: ImmutableArray.Create<BoundStatement>(arrayVarDecl, positionVarDecl));
961BoundStatement positionIncrement = MakePositionIncrement(forEachSyntax, boundPositionVar, intType);
968BoundStatement loopBody = CreateBlockDeclaringIterationVariables(iterationVariables, iterationVariableDecl, rewrittenBody, forEachSyntax);
974BoundStatement result = RewriteForStatementWithoutInnerLocals(
1010private BoundStatement RewriteMultiDimensionalArrayForEachStatement(BoundForEachStatement node)
1015BoundStatement? rewrittenBody = VisitStatement(node.Body);
1030private BoundStatement RewriteMultiDimensionalArrayForEachEnumerator(
1039BoundStatement rewrittenBody)
1064BoundStatement arrayVarDecl = MakeLocalDeclaration(forEachSyntax, arrayVar, rewrittenExpression);
1076BoundStatement[] upperVarDecl = new BoundStatement[rank];
1115BoundStatement iterationVarDecl = LocalOrDeconstructionDeclaration(forEachSyntax, deconstruction, iterationVariables, iterationVarInitValue);
1124BoundStatement innermostLoopBody = CreateBlockDeclaringIterationVariables(iterationVariables, iterationVarDecl, rewrittenBody, forEachSyntax);
1134BoundStatement? forLoop = null;
1146BoundStatement positionVarDecl = MakeLocalDeclaration(forEachSyntax, positionVar[dimension], currentDimensionLowerBound);
1165BoundStatement positionIncrement = MakePositionIncrement(forEachSyntax, boundPositionVar[dimension], intType);
1167BoundStatement body;
1196BoundStatement result = new BoundBlock(
1227private BoundStatement MakeLocalDeclaration(CSharpSyntaxNode syntax, LocalSymbol local, BoundExpression rewrittenInitialValue)
1229var result = RewriteLocalDeclaration(
1239private BoundStatement MakePositionIncrement(CSharpSyntaxNode syntax, BoundLocal boundPositionVar, TypeSymbol intType)
1262private void InstrumentForEachStatementCollectionVarDeclaration(BoundNode node, [NotNullIfNotNull(nameof(collectionVarDecl))] ref BoundStatement? collectionVarDecl)
1270private void InstrumentForEachStatementIterationVarDeclaration(BoundNode node, ref BoundStatement iterationVarDecl)
1286private void InstrumentForEachStatement(BoundNode node, ref BoundStatement result)
Lowering\LocalRewriter\LocalRewriter_ForStatement.cs (18)
19var rewrittenInitializer = VisitStatement(node.Initializer);
21var rewrittenIncrement = VisitStatement(node.Increment);
22var rewrittenBody = VisitStatement(node.Body);
40private BoundStatement RewriteForStatementWithoutInnerLocals(
43BoundStatement? rewrittenInitializer,
45BoundStatement? rewrittenIncrement,
46BoundStatement rewrittenBody,
74var statementBuilder = ArrayBuilder<BoundStatement>.GetInstance();
104BoundStatement gotoEnd = new BoundGotoStatement(syntax, endLabel);
134BoundStatement? branchBack = null;
172private BoundStatement RewriteForStatement(
174BoundStatement? rewrittenInitializer,
176BoundStatement? rewrittenIncrement,
177BoundStatement rewrittenBody)
216var statementBuilder = ArrayBuilder<BoundStatement>.GetInstance();
227BoundStatement startLabelStatement = new BoundLabelStatement(syntax, startLabel);
236var blockBuilder = ArrayBuilder<BoundStatement>.GetInstance();
241BoundStatement ifNotConditionGotoBreak = new BoundConditionalGoto(rewrittenCondition.Syntax, rewrittenCondition, false, node.BreakLabel);
Lowering\LocalRewriter\LocalRewriter_UsingStatement.cs (17)
37BoundStatement? rewrittenBody = VisitStatement(node.Body);
62private BoundStatement MakeDeclarationUsingStatement(SyntaxNode syntax,
83ImmutableArray.Create<BoundStatement>(result));
89private BoundStatement MakeLocalUsingDeclarationStatement(BoundUsingLocalDeclarations usingDeclarations, ImmutableArray<BoundStatement> statements)
94var usingStatement = MakeDeclarationUsingStatement(syntax,
184BoundStatement expressionStatement = new BoundExpressionStatement(expressionSyntax, tempAssignment);
190BoundStatement tryFinally = RewriteUsingStatementTryFinally(usingSyntax, usingSyntax, tryBlock, boundTemp, usingSyntax.AwaitKeyword, node.AwaitOpt, node.PatternDisposeInfoOpt);
196statements: ImmutableArray.Create<BoundStatement>(expressionStatement, tryFinally));
223BoundStatement? rewrittenDeclaration = VisitStatement(localDeclaration);
254BoundStatement tryFinally = RewriteUsingStatementTryFinally(usingSyntax, declarationSyntax, tryBlock, boundTemp, awaitKeywordOpt, awaitOpt, patternDisposeInfo);
259statements: ImmutableArray.Create<BoundStatement>(
266BoundStatement tryFinally = RewriteUsingStatementTryFinally(usingSyntax, declarationSyntax, tryBlock, boundLocal, awaitKeywordOpt, awaitOpt, patternDisposeInfo);
279private BoundStatement RewriteUsingStatementTryFinally(
376BoundStatement disposeStatement = new BoundExpressionStatement(resourceSyntax, disposeCall);
395BoundStatement finallyStatement;
419BoundStatement tryFinally = new BoundTryStatement(
Lowering\LocalRewriter\LocalRewriter_WhileStatement.cs (9)
21var rewrittenBody = VisitStatement(node.Body);
41private BoundStatement RewriteWhileStatement(
44BoundStatement rewrittenBody,
67BoundStatement ifConditionGotoStart = new BoundConditionalGoto(rewrittenCondition.Syntax, rewrittenCondition, true, startLabel);
68BoundStatement gotoContinue = new BoundGotoStatement(syntax, continueLabel);
106private BoundStatement RewriteWhileStatement(
110BoundStatement rewrittenBody,
137BoundStatement continueLabelStatement = new BoundLabelStatement(syntax, continueLabel);
138BoundStatement ifNotConditionGotoBreak = new BoundConditionalGoto(rewrittenCondition.Syntax, rewrittenCondition, false, breakLabel);
Lowering\SpillSequenceSpiller.cs (18)
42private ArrayBuilder<BoundStatement> _statements;
72public ImmutableArray<BoundStatement> GetStatements()
76return ImmutableArray<BoundStatement>.Empty;
140public void AddStatement(BoundStatement statement)
144_statements = ArrayBuilder<BoundStatement>.GetInstance();
150public void AddStatements(ImmutableArray<BoundStatement> statements)
152foreach (var statement in statements)
232internal static BoundStatement Rewrite(BoundStatement body, MethodSymbol method, TypeCompilationState compilationState, BindingDiagnosticBag diagnostics)
241return (BoundStatement)result;
282private BoundStatement UpdateStatement(BoundSpillSequenceBuilder builder, BoundStatement statement)
742Debug.Assert(!(node is BoundStatement));
1336var whenNotNullStatement = UpdateStatement(whenNotNullBuilder, _F.ExpressionStatement(whenNotNull));
1348var whenNotNullStatement = UpdateStatement(whenNotNullBuilder, _F.Assignment(_F.Local(tmp), whenNotNull));
1380public static BoundStatement Replace(BoundNode node, BoundExpression receiver, int receiverID, int recursionDepth)
1383var result = (BoundStatement)replacer.Visit(node);
Lowering\StateMachineRewriter\MethodToStateMachineRewriter.cs (16)
173protected abstract BoundStatement GenerateReturn(bool finished);
246protected BoundStatement Dispatch(bool isOutermost)
252var result = F.Switch(F.Local(cachedState), sections.ToImmutableArray());
262var missingStateDispatch = GenerateMissingStateDispatch();
272protected virtual BoundStatement? GenerateMissingStateDispatch()
297private BoundStatement PossibleIteratorScope(ImmutableArray<LocalSymbol> locals, Func<BoundStatement> wrapped)
343var translatedStatement = wrapped();
384F.Block(variableCleanup.SelectAsArray((e, f) => (BoundStatement)f.ExpressionStatement(e), F)));
403internal BoundBlock MakeStateMachineScope(ImmutableArray<StateMachineFieldSymbol> hoistedLocals, BoundStatement statement)
411internal static bool TryUnwrapBoundStateMachineScope(ref BoundStatement statement, out ImmutableArray<StateMachineFieldSymbol> hoistedLocals)
455var result = F.Block(variableCleanup.SelectAsArray((e, f) => (BoundStatement)f.ExpressionStatement(e), F));
783BoundStatement translated;
889BoundBlock tryBlock = F.Block((BoundStatement)this.Visit(node.TryBlock));
916BoundStatement result = node.Update(tryBlock, catchBlocks, finallyBlockOpt, node.FinallyLabelOpt, node.PreferFaultHandler);
948protected BoundStatement CacheThisIfNeeded()
Lowering\StateMachineRewriter\StateMachineRewriter.cs (15)
19protected readonly BoundStatement body;
38BoundStatement body,
81protected abstract void InitializeStateMachine(ArrayBuilder<BoundStatement> bodyBuilder, NamedTypeSymbol frameType, LocalSymbol stateMachineLocal);
86protected abstract BoundStatement GenerateStateMachineCreation(LocalSymbol stateMachineVariable, NamedTypeSymbol frameType, IReadOnlyDictionary<Symbol, CapturedSymbolReplacement> proxies);
93protected BoundStatement Rewrite()
287private BoundStatement GenerateKickoffMethodBody()
290var bodyBuilder = ArrayBuilder<BoundStatement>.GetInstance();
306protected BoundStatement GenerateParameterStorage(LocalSymbol stateMachineVariable, IReadOnlyDictionary<Symbol, CapturedSymbolReplacement> proxies)
308var bodyBuilder = ArrayBuilder<BoundStatement>.GetInstance();
425var bodyBuilder = ArrayBuilder<BoundStatement>.GetInstance();
429BoundStatement makeIterator = F.Assignment(F.Local(resultVariable), F.New(stateMachineType.Constructor, F.Literal(initialState)));
437var thenBuilder = ArrayBuilder<BoundStatement>.GetInstance(4);
498BoundStatement copy = InitializeParameterField(getEnumeratorMethod, parameter, resultParameter, parameterProxy);
512protected virtual void GenerateResetInstance(ArrayBuilder<BoundStatement> builder, StateMachineState initialState)
519protected virtual BoundStatement InitializeParameterField(MethodSymbol getEnumeratorMethod, ParameterSymbol parameter, BoundExpression resultParameter, BoundExpression parameterProxy)
Lowering\SyntheticBoundNodeFactory.cs (46)
453return Block(ImmutableArray<BoundStatement>.Empty);
456public BoundBlock Block(ImmutableArray<BoundStatement> statements)
461public BoundBlock Block(params BoundStatement[] statements)
466public BoundBlock Block(ImmutableArray<LocalSymbol> locals, params BoundStatement[] statements)
471public BoundBlock Block(ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundStatement> statements)
476public BoundBlock Block(ImmutableArray<LocalSymbol> locals, ImmutableArray<LocalFunctionSymbol> localFunctions, params BoundStatement[] statements)
481public BoundBlock Block(ImmutableArray<LocalSymbol> locals, ImmutableArray<LocalFunctionSymbol> localFunctions, ImmutableArray<BoundStatement> statements)
486public BoundBlock Block(ImmutableArray<LocalSymbol> locals, ImmutableArray<MethodSymbol> localFunctions, ImmutableArray<BoundStatement> statements)
498return StatementList(ImmutableArray<BoundStatement>.Empty);
501public BoundStatementList StatementList(ImmutableArray<BoundStatement> statements)
506public BoundStatementList StatementList(BoundStatement first, BoundStatement second)
512public BoundStatement? Concat(BoundStatement? first, BoundStatement? second)
515public BoundBlockInstrumentation CombineInstrumentation(BoundBlockInstrumentation? innerInstrumentation = null, LocalSymbol? local = null, BoundStatement? prologue = null, BoundStatement? epilogue = null)
530public BoundStatement Instrument(BoundStatement statement, BoundBlockInstrumentation? instrumentation)
537var statements = new TemporaryArray<BoundStatement>();
582public void CloseMethod(BoundStatement body)
932public BoundStatement If(BoundExpression condition, BoundStatement thenClause, BoundStatement? elseClauseOpt = null)
937public BoundStatement ConditionalGoto(BoundExpression condition, LabelSymbol label, bool jumpIfTrue)
942public BoundStatement If(BoundExpression condition, ImmutableArray<LocalSymbol> locals, BoundStatement thenClause, BoundStatement? elseClauseOpt = null)
957var statements = ArrayBuilder<BoundStatement>.GetInstance();
1051public BoundSpillSequence SpillSequence(ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundStatement> sideEffects, BoundExpression result)
1063public readonly ImmutableArray<BoundStatement> Statements;
1065public SyntheticSwitchSection(ImmutableArray<int> values, ImmutableArray<BoundStatement> statements)
1072public SyntheticSwitchSection SwitchSection(int value, params BoundStatement[] statements)
1075public SyntheticSwitchSection SwitchSection(ImmutableArray<int> values, params BoundStatement[] statements)
1081public BoundStatement Switch(BoundExpression ex, ImmutableArray<SyntheticSwitchSection> sections)
1095var statements = ArrayBuilder<BoundStatement>.GetInstance();
1201public BoundStatement BaseInitialization()
1210public BoundStatement SequencePoint(SyntaxNode syntax, BoundStatement statement)
1215public BoundStatement SequencePointWithSpan(CSharpSyntaxNode syntax, TextSpan span, BoundStatement statement)
1220public BoundStatement HiddenSequencePoint(BoundStatement? statementOpt = null)
1225public BoundStatement ThrowNull()
1593internal BoundStatement Try(
1723internal BoundStatement NoOp(NoOpStatementFlavor noOpStatementFlavor)
Symbols\Synthesized\ReadOnlyListType\SynthesizedReadOnlyListTypeSymbol.cs (12)
472static BoundStatement generateGetEnumerator(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
497static BoundStatement generateCount(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
525static BoundStatement generateIsSynchronized(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
532static BoundStatement generateSyncRoot(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
542static BoundStatement generateIsFixedSize(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
549static BoundStatement generateIsReadOnly(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
556static BoundStatement generateContains(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
592static BoundStatement generateCopyTo(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
599BoundStatement statement;
649static BoundStatement generateIndexer(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
683static BoundStatement generateIndexOf(SyntheticBoundNodeFactory f, MethodSymbol method, MethodSymbol interfaceMethod)
722static 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);