提交 37e8a94a 编写于 作者: T Ty Overby 提交者: GitHub

added a local-functionsless constructor for BoundBlock (#13408)

上级 48a14c14
...@@ -755,9 +755,7 @@ internal BoundStatement WrapWithVariablesIfAny(CSharpSyntaxNode scopeDesignator, ...@@ -755,9 +755,7 @@ internal BoundStatement WrapWithVariablesIfAny(CSharpSyntaxNode scopeDesignator,
return statement; return statement;
} }
return new BoundBlock(statement.Syntax, locals, return new BoundBlock(statement.Syntax, locals, ImmutableArray.Create(statement))
ImmutableArray<LocalFunctionSymbol>.Empty,
ImmutableArray.Create(statement))
{ WasCompilerGenerated = true }; { WasCompilerGenerated = true };
} }
......
...@@ -3606,7 +3606,7 @@ internal BoundBlock CreateBlockFromExpression(CSharpSyntaxNode node, ImmutableAr ...@@ -3606,7 +3606,7 @@ internal BoundBlock CreateBlockFromExpression(CSharpSyntaxNode node, ImmutableAr
} }
// Need to attach the tree for when we generate sequence points. // Need to attach the tree for when we generate sequence points.
return new BoundBlock(node, locals, ImmutableArray<LocalFunctionSymbol>.Empty, ImmutableArray.Create(statement)) { WasCompilerGenerated = node.Kind() != SyntaxKind.ArrowExpressionClause }; return new BoundBlock(node, locals, ImmutableArray.Create(statement)) { WasCompilerGenerated = node.Kind() != SyntaxKind.ArrowExpressionClause };
} }
/// <summary> /// <summary>
......
...@@ -502,21 +502,24 @@ public BoundGotoStatement(SyntaxNode syntax, LabelSymbol label, bool hasErrors = ...@@ -502,21 +502,24 @@ public BoundGotoStatement(SyntaxNode syntax, LabelSymbol label, bool hasErrors =
internal partial class BoundBlock internal partial class BoundBlock
{ {
public BoundBlock(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundStatement> statements, bool hasErrors = false): this(syntax, locals, ImmutableArray<LocalFunctionSymbol>.Empty, statements, hasErrors)
{
}
public static BoundBlock SynthesizedNoLocals(SyntaxNode syntax, BoundStatement statement) public static BoundBlock SynthesizedNoLocals(SyntaxNode syntax, BoundStatement statement)
{ {
return new BoundBlock(syntax, ImmutableArray<LocalSymbol>.Empty, ImmutableArray<LocalFunctionSymbol>.Empty, return new BoundBlock(syntax, ImmutableArray<LocalSymbol>.Empty, ImmutableArray.Create(statement))
ImmutableArray.Create(statement))
{ WasCompilerGenerated = true }; { WasCompilerGenerated = true };
} }
public static BoundBlock SynthesizedNoLocals(SyntaxNode syntax, ImmutableArray<BoundStatement> statements) public static BoundBlock SynthesizedNoLocals(SyntaxNode syntax, ImmutableArray<BoundStatement> statements)
{ {
return new BoundBlock(syntax, ImmutableArray<LocalSymbol>.Empty, ImmutableArray<LocalFunctionSymbol>.Empty, statements) { WasCompilerGenerated = true }; return new BoundBlock(syntax, ImmutableArray<LocalSymbol>.Empty, statements) { WasCompilerGenerated = true };
} }
public static BoundBlock SynthesizedNoLocals(SyntaxNode syntax, params BoundStatement[] statements) public static BoundBlock SynthesizedNoLocals(SyntaxNode syntax, params BoundStatement[] statements)
{ {
return new BoundBlock(syntax, ImmutableArray<LocalSymbol>.Empty, ImmutableArray<LocalFunctionSymbol>.Empty, statements.AsImmutableOrNull()) { WasCompilerGenerated = true }; return new BoundBlock(syntax, ImmutableArray<LocalSymbol>.Empty, statements.AsImmutableOrNull()) { WasCompilerGenerated = true };
} }
} }
......
...@@ -498,7 +498,6 @@ internal static BoundBlock ConstructFieldLikeEventAccessorBody_Regular(SourceEve ...@@ -498,7 +498,6 @@ internal static BoundBlock ConstructFieldLikeEventAccessorBody_Regular(SourceEve
return new BoundBlock(syntax, return new BoundBlock(syntax,
locals: tmps.AsImmutable(), locals: tmps.AsImmutable(),
localFunctions: ImmutableArray<LocalFunctionSymbol>.Empty,
statements: ImmutableArray.Create<BoundStatement>( statements: ImmutableArray.Create<BoundStatement>(
tmp0Init, tmp0Init,
loopStart, loopStart,
...@@ -542,7 +541,6 @@ internal static BoundBlock ConstructDestructorBody(MethodSymbol method, BoundBlo ...@@ -542,7 +541,6 @@ internal static BoundBlock ConstructDestructorBody(MethodSymbol method, BoundBlo
return new BoundBlock( return new BoundBlock(
syntax, syntax,
ImmutableArray<LocalSymbol>.Empty, ImmutableArray<LocalSymbol>.Empty,
ImmutableArray<LocalFunctionSymbol>.Empty,
ImmutableArray.Create<BoundStatement>( ImmutableArray.Create<BoundStatement>(
new BoundTryStatement( new BoundTryStatement(
syntax, syntax,
...@@ -551,7 +549,6 @@ internal static BoundBlock ConstructDestructorBody(MethodSymbol method, BoundBlo ...@@ -551,7 +549,6 @@ internal static BoundBlock ConstructDestructorBody(MethodSymbol method, BoundBlo
new BoundBlock( new BoundBlock(
syntax, syntax,
ImmutableArray<LocalSymbol>.Empty, ImmutableArray<LocalSymbol>.Empty,
ImmutableArray<LocalFunctionSymbol>.Empty,
ImmutableArray.Create<BoundStatement>( ImmutableArray.Create<BoundStatement>(
baseFinalizeCall) baseFinalizeCall)
) )
......
...@@ -854,7 +854,7 @@ public override object VisitField(FieldSymbol symbol, TypeCompilationState argum ...@@ -854,7 +854,7 @@ public override object VisitField(FieldSymbol symbol, TypeCompilationState argum
if (methodSymbol.IsScriptConstructor) if (methodSymbol.IsScriptConstructor)
{ {
body = new BoundBlock(methodSymbol.GetNonNullSyntaxNode(), ImmutableArray<LocalSymbol>.Empty, ImmutableArray<LocalFunctionSymbol>.Empty, ImmutableArray<BoundStatement>.Empty) { WasCompilerGenerated = true }; body = new BoundBlock(methodSymbol.GetNonNullSyntaxNode(), ImmutableArray<LocalSymbol>.Empty, ImmutableArray<BoundStatement>.Empty) { WasCompilerGenerated = true };
} }
else if (methodSymbol.IsScriptInitializer) else if (methodSymbol.IsScriptInitializer)
{ {
......
...@@ -58,7 +58,7 @@ internal class FlowAnalysisPass ...@@ -58,7 +58,7 @@ internal class FlowAnalysisPass
var trailingExpression = new BoundDefaultOperator(method.GetNonNullSyntaxNode(), submissionResultType); var trailingExpression = new BoundDefaultOperator(method.GetNonNullSyntaxNode(), submissionResultType);
var newStatements = block.Statements.Add(new BoundReturnStatement(trailingExpression.Syntax, RefKind.None, trailingExpression)); var newStatements = block.Statements.Add(new BoundReturnStatement(trailingExpression.Syntax, RefKind.None, trailingExpression));
block = new BoundBlock(block.Syntax, ImmutableArray<LocalSymbol>.Empty, ImmutableArray<LocalFunctionSymbol>.Empty, newStatements) { WasCompilerGenerated = true }; block = new BoundBlock(block.Syntax, ImmutableArray<LocalSymbol>.Empty, newStatements) { WasCompilerGenerated = true };
#if DEBUG #if DEBUG
// It should not be necessary to repeat analysis after adding this node, because adding a trailing // It should not be necessary to repeat analysis after adding this node, because adding a trailing
// return in cases where one was missing should never produce different Diagnostics. // return in cases where one was missing should never produce different Diagnostics.
......
...@@ -267,7 +267,7 @@ private BoundStatement AddStatementsIfNeeded(BoundStatement body) ...@@ -267,7 +267,7 @@ private BoundStatement AddStatementsIfNeeded(BoundStatement body)
if (_addedLocals != null) if (_addedLocals != null)
{ {
_addedStatements.Add(body); _addedStatements.Add(body);
body = new BoundBlock(body.Syntax, _addedLocals.ToImmutableAndFree(), ImmutableArray<LocalFunctionSymbol>.Empty, _addedStatements.ToImmutableAndFree()) { WasCompilerGenerated = true }; body = new BoundBlock(body.Syntax, _addedLocals.ToImmutableAndFree(), _addedStatements.ToImmutableAndFree()) { WasCompilerGenerated = true };
_addedLocals = null; _addedLocals = null;
_addedStatements = null; _addedStatements = null;
} }
...@@ -1046,7 +1046,7 @@ public override BoundNode VisitStatementList(BoundStatementList node) ...@@ -1046,7 +1046,7 @@ public override BoundNode VisitStatementList(BoundStatementList node)
newStatements.Add((BoundStatement)this.Visit(s)); newStatements.Add((BoundStatement)this.Visit(s));
} }
return new BoundBlock(node.Syntax, newLocals.ToImmutableAndFree(), ImmutableArray<LocalFunctionSymbol>.Empty, newStatements.ToImmutableAndFree(), node.HasErrors); return new BoundBlock(node.Syntax, newLocals.ToImmutableAndFree(), newStatements.ToImmutableAndFree(), node.HasErrors);
}); });
} }
else else
...@@ -1067,7 +1067,7 @@ public override BoundNode VisitSwitchStatement(BoundSwitchStatement node) ...@@ -1067,7 +1067,7 @@ public override BoundNode VisitSwitchStatement(BoundSwitchStatement node)
InsertAndFreePrologue(newStatements, prologue); InsertAndFreePrologue(newStatements, prologue);
newStatements.Add((BoundStatement)base.VisitSwitchStatement(node)); newStatements.Add((BoundStatement)base.VisitSwitchStatement(node));
return new BoundBlock(node.Syntax, newLocals.ToImmutableAndFree(), ImmutableArray<LocalFunctionSymbol>.Empty, newStatements.ToImmutableAndFree(), node.HasErrors); return new BoundBlock(node.Syntax, newLocals.ToImmutableAndFree(), newStatements.ToImmutableAndFree(), node.HasErrors);
}); });
} }
else else
......
...@@ -44,7 +44,7 @@ public override BoundNode VisitBlock(BoundBlock node) ...@@ -44,7 +44,7 @@ public override BoundNode VisitBlock(BoundBlock node)
public override BoundNode VisitNoOpStatement(BoundNoOpStatement node) public override BoundNode VisitNoOpStatement(BoundNoOpStatement node)
{ {
return (node.WasCompilerGenerated || !this.Instrument) return (node.WasCompilerGenerated || !this.Instrument)
? new BoundBlock(node.Syntax, ImmutableArray<LocalSymbol>.Empty, ImmutableArray<LocalFunctionSymbol>.Empty, ImmutableArray<BoundStatement>.Empty) ? new BoundBlock(node.Syntax, ImmutableArray<LocalSymbol>.Empty, ImmutableArray<BoundStatement>.Empty)
: _instrumenter.InstrumentNoOpStatement(node, node); : _instrumenter.InstrumentNoOpStatement(node, node);
} }
} }
......
...@@ -209,7 +209,6 @@ private BoundStatement RewriteEnumeratorForEachStatement(BoundForEachStatement n ...@@ -209,7 +209,6 @@ private BoundStatement RewriteEnumeratorForEachStatement(BoundForEachStatement n
finallyBlockOpt = new BoundBlock(forEachSyntax, finallyBlockOpt = new BoundBlock(forEachSyntax,
locals: ImmutableArray<LocalSymbol>.Empty, locals: ImmutableArray<LocalSymbol>.Empty,
localFunctions: ImmutableArray<LocalFunctionSymbol>.Empty,
statements: ImmutableArray.Create<BoundStatement>(disposeStmt)); statements: ImmutableArray.Create<BoundStatement>(disposeStmt));
} }
else else
...@@ -261,7 +260,6 @@ private BoundStatement RewriteEnumeratorForEachStatement(BoundForEachStatement n ...@@ -261,7 +260,6 @@ private BoundStatement RewriteEnumeratorForEachStatement(BoundForEachStatement n
// if (d != null) d.Dispose(); // if (d != null) d.Dispose();
finallyBlockOpt = new BoundBlock(forEachSyntax, finallyBlockOpt = new BoundBlock(forEachSyntax,
locals: ImmutableArray.Create<LocalSymbol>(disposableVar), locals: ImmutableArray.Create<LocalSymbol>(disposableVar),
localFunctions: ImmutableArray<LocalFunctionSymbol>.Empty,
statements: ImmutableArray.Create<BoundStatement>(disposableVarDecl, ifStmt)); statements: ImmutableArray.Create<BoundStatement>(disposableVarDecl, ifStmt));
} }
...@@ -277,7 +275,6 @@ private BoundStatement RewriteEnumeratorForEachStatement(BoundForEachStatement n ...@@ -277,7 +275,6 @@ private BoundStatement RewriteEnumeratorForEachStatement(BoundForEachStatement n
BoundStatement tryFinally = new BoundTryStatement(forEachSyntax, BoundStatement tryFinally = new BoundTryStatement(forEachSyntax,
tryBlock: new BoundBlock(forEachSyntax, tryBlock: new BoundBlock(forEachSyntax,
locals: ImmutableArray<LocalSymbol>.Empty, locals: ImmutableArray<LocalSymbol>.Empty,
localFunctions: ImmutableArray<LocalFunctionSymbol>.Empty,
statements: ImmutableArray.Create<BoundStatement>(whileLoop)), statements: ImmutableArray.Create<BoundStatement>(whileLoop)),
catchBlocks: ImmutableArray<BoundCatchBlock>.Empty, catchBlocks: ImmutableArray<BoundCatchBlock>.Empty,
finallyBlockOpt: finallyBlockOpt); finallyBlockOpt: finallyBlockOpt);
...@@ -288,7 +285,6 @@ private BoundStatement RewriteEnumeratorForEachStatement(BoundForEachStatement n ...@@ -288,7 +285,6 @@ private BoundStatement RewriteEnumeratorForEachStatement(BoundForEachStatement n
result = new BoundBlock( result = new BoundBlock(
syntax: forEachSyntax, syntax: forEachSyntax,
locals: ImmutableArray.Create(enumeratorVar), locals: ImmutableArray.Create(enumeratorVar),
localFunctions: ImmutableArray<LocalFunctionSymbol>.Empty,
statements: ImmutableArray.Create<BoundStatement>(enumeratorVarDecl, tryFinally)); statements: ImmutableArray.Create<BoundStatement>(enumeratorVarDecl, tryFinally));
} }
else else
...@@ -301,7 +297,6 @@ private BoundStatement RewriteEnumeratorForEachStatement(BoundForEachStatement n ...@@ -301,7 +297,6 @@ private BoundStatement RewriteEnumeratorForEachStatement(BoundForEachStatement n
result = new BoundBlock( result = new BoundBlock(
syntax: forEachSyntax, syntax: forEachSyntax,
locals: ImmutableArray.Create(enumeratorVar), locals: ImmutableArray.Create(enumeratorVar),
localFunctions: ImmutableArray<LocalFunctionSymbol>.Empty,
statements: ImmutableArray.Create<BoundStatement>(enumeratorVarDecl, whileLoop)); statements: ImmutableArray.Create<BoundStatement>(enumeratorVarDecl, whileLoop));
} }
...@@ -549,7 +544,6 @@ private BoundStatement RewriteStringForEachStatement(BoundForEachStatement node) ...@@ -549,7 +544,6 @@ private BoundStatement RewriteStringForEachStatement(BoundForEachStatement node)
return new BoundBlock( return new BoundBlock(
forEachSyntax, forEachSyntax,
locals: iterationVariables, locals: iterationVariables,
localFunctions: ImmutableArray<LocalFunctionSymbol>.Empty,
statements: ImmutableArray.Create(iteratorVariableInitialization, rewrittenBody)); statements: ImmutableArray.Create(iteratorVariableInitialization, rewrittenBody));
} }
...@@ -865,7 +859,6 @@ private BoundStatement RewriteMultiDimensionalArrayForEachStatement(BoundForEach ...@@ -865,7 +859,6 @@ private BoundStatement RewriteMultiDimensionalArrayForEachStatement(BoundForEach
BoundStatement result = new BoundBlock( BoundStatement result = new BoundBlock(
forEachSyntax, forEachSyntax,
ImmutableArray.Create(arrayVar).Concat(upperVar.AsImmutableOrNull()), ImmutableArray.Create(arrayVar).Concat(upperVar.AsImmutableOrNull()),
ImmutableArray<LocalFunctionSymbol>.Empty,
ImmutableArray.Create(arrayVarDecl).Concat(upperVarDecl.AsImmutableOrNull()).Add(forLoop)); ImmutableArray.Create(arrayVarDecl).Concat(upperVarDecl.AsImmutableOrNull()).Add(forLoop));
InstrumentForEachStatement(node, ref result); InstrumentForEachStatement(node, ref result);
......
...@@ -168,7 +168,7 @@ public override BoundNode VisitForStatement(BoundForStatement node) ...@@ -168,7 +168,7 @@ public override BoundNode VisitForStatement(BoundForStatement node)
statementBuilder.Add(new BoundLabelStatement(syntax, breakLabel)); statementBuilder.Add(new BoundLabelStatement(syntax, breakLabel));
var statements = statementBuilder.ToImmutableAndFree(); var statements = statementBuilder.ToImmutableAndFree();
return new BoundBlock(syntax, outerLocals, ImmutableArray<LocalFunctionSymbol>.Empty, statements, hasErrors); return new BoundBlock(syntax, outerLocals, statements, hasErrors);
} }
} }
} }
...@@ -120,7 +120,6 @@ public override BoundNode VisitLockStatement(BoundLockStatement node) ...@@ -120,7 +120,6 @@ public override BoundNode VisitLockStatement(BoundLockStatement node)
return new BoundBlock( return new BoundBlock(
lockSyntax, lockSyntax,
ImmutableArray.Create(boundLockTemp.LocalSymbol, boundLockTakenTemp.LocalSymbol), ImmutableArray.Create(boundLockTemp.LocalSymbol, boundLockTakenTemp.LocalSymbol),
ImmutableArray<LocalFunctionSymbol>.Empty,
ImmutableArray.Create( ImmutableArray.Create(
InstrumentLockTargetCapture(node, boundLockTempInit), InstrumentLockTargetCapture(node, boundLockTempInit),
boundLockTakenTempInit, boundLockTakenTempInit,
...@@ -171,7 +170,6 @@ public override BoundNode VisitLockStatement(BoundLockStatement node) ...@@ -171,7 +170,6 @@ public override BoundNode VisitLockStatement(BoundLockStatement node)
return new BoundBlock( return new BoundBlock(
lockSyntax, lockSyntax,
ImmutableArray.Create(boundLockTemp.LocalSymbol), ImmutableArray.Create(boundLockTemp.LocalSymbol),
ImmutableArray<LocalFunctionSymbol>.Empty,
ImmutableArray.Create( ImmutableArray.Create(
InstrumentLockTargetCapture(node, boundLockTempInit), InstrumentLockTargetCapture(node, boundLockTempInit),
enterCall, enterCall,
......
...@@ -184,7 +184,6 @@ public override BoundNode VisitSwitchStatement(BoundSwitchStatement node) ...@@ -184,7 +184,6 @@ public override BoundNode VisitSwitchStatement(BoundSwitchStatement node)
return new BoundBlock( return new BoundBlock(
syntax, syntax,
locals: (object)tempLocal == null ? ImmutableArray<LocalSymbol>.Empty : ImmutableArray.Create<LocalSymbol>(tempLocal), locals: (object)tempLocal == null ? ImmutableArray<LocalSymbol>.Empty : ImmutableArray.Create<LocalSymbol>(tempLocal),
localFunctions: ImmutableArray<LocalFunctionSymbol>.Empty,
statements: statementBuilder.ToImmutableAndFree()); statements: statementBuilder.ToImmutableAndFree());
} }
......
...@@ -56,7 +56,6 @@ public override BoundNode VisitUsingStatement(BoundUsingStatement node) ...@@ -56,7 +56,6 @@ public override BoundNode VisitUsingStatement(BoundUsingStatement node)
return new BoundBlock( return new BoundBlock(
usingSyntax, usingSyntax,
node.Locals, node.Locals,
ImmutableArray<LocalFunctionSymbol>.Empty,
ImmutableArray.Create<BoundStatement>(result)); ImmutableArray.Create<BoundStatement>(result));
} }
} }
...@@ -142,7 +141,6 @@ private BoundBlock RewriteExpressionUsingStatement(BoundUsingStatement node, Bou ...@@ -142,7 +141,6 @@ private BoundBlock RewriteExpressionUsingStatement(BoundUsingStatement node, Bou
return new BoundBlock( return new BoundBlock(
syntax: usingSyntax, syntax: usingSyntax,
locals: node.Locals.Add(boundTemp.LocalSymbol), locals: node.Locals.Add(boundTemp.LocalSymbol),
localFunctions: ImmutableArray<LocalFunctionSymbol>.Empty,
statements: ImmutableArray.Create<BoundStatement>(expressionStatement, tryFinally)); statements: ImmutableArray.Create<BoundStatement>(expressionStatement, tryFinally));
} }
...@@ -192,7 +190,6 @@ private BoundBlock RewriteDeclarationUsingStatement(SyntaxNode usingSyntax, Boun ...@@ -192,7 +190,6 @@ private BoundBlock RewriteDeclarationUsingStatement(SyntaxNode usingSyntax, Boun
return new BoundBlock( return new BoundBlock(
syntax: usingSyntax, syntax: usingSyntax,
locals: ImmutableArray.Create<LocalSymbol>(boundTemp.LocalSymbol), //localSymbol will be declared by an enclosing block locals: ImmutableArray.Create<LocalSymbol>(boundTemp.LocalSymbol), //localSymbol will be declared by an enclosing block
localFunctions: ImmutableArray<LocalFunctionSymbol>.Empty,
statements: ImmutableArray.Create<BoundStatement>( statements: ImmutableArray.Create<BoundStatement>(
rewrittenDeclaration, rewrittenDeclaration,
new BoundExpressionStatement(declarationSyntax, tempAssignment), new BoundExpressionStatement(declarationSyntax, tempAssignment),
......
...@@ -408,7 +408,7 @@ public BoundBlock Block(ImmutableArray<LocalSymbol> locals, params BoundStatemen ...@@ -408,7 +408,7 @@ public BoundBlock Block(ImmutableArray<LocalSymbol> locals, params BoundStatemen
public BoundBlock Block(ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundStatement> statements) public BoundBlock Block(ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundStatement> statements)
{ {
return new BoundBlock(Syntax, locals, ImmutableArray<LocalFunctionSymbol>.Empty, statements) { WasCompilerGenerated = true }; return new BoundBlock(Syntax, locals, statements) { WasCompilerGenerated = true };
} }
public BoundBlock Block(ImmutableArray<LocalSymbol> locals, ImmutableArray<LocalFunctionSymbol> localFunctions, params BoundStatement[] statements) public BoundBlock Block(ImmutableArray<LocalSymbol> locals, ImmutableArray<LocalFunctionSymbol> localFunctions, params BoundStatement[] statements)
......
...@@ -377,7 +377,6 @@ internal override BoundBlock CreateBody() ...@@ -377,7 +377,6 @@ internal override BoundBlock CreateBody()
return new BoundBlock(syntax, return new BoundBlock(syntax,
ImmutableArray.Create<LocalSymbol>(scriptLocal.LocalSymbol), ImmutableArray.Create<LocalSymbol>(scriptLocal.LocalSymbol),
ImmutableArray<LocalFunctionSymbol>.Empty,
ImmutableArray.Create<BoundStatement>( ImmutableArray.Create<BoundStatement>(
// var script = new Script(); // var script = new Script();
new BoundExpressionStatement( new BoundExpressionStatement(
...@@ -497,7 +496,6 @@ internal override BoundBlock CreateBody() ...@@ -497,7 +496,6 @@ internal override BoundBlock CreateBody()
return new BoundBlock(syntax, return new BoundBlock(syntax,
ImmutableArray.Create<LocalSymbol>(submissionLocal.LocalSymbol), ImmutableArray.Create<LocalSymbol>(submissionLocal.LocalSymbol),
ImmutableArray<LocalFunctionSymbol>.Empty,
ImmutableArray.Create<BoundStatement>(submissionAssignment, returnStatement)) ImmutableArray.Create<BoundStatement>(submissionAssignment, returnStatement))
{ WasCompilerGenerated = true }; { WasCompilerGenerated = true };
} }
......
...@@ -18,7 +18,6 @@ internal EEConstructorSymbol(NamedTypeSymbol containingType) ...@@ -18,7 +18,6 @@ internal EEConstructorSymbol(NamedTypeSymbol containingType)
internal override void GenerateMethodBody(TypeCompilationState compilationState, DiagnosticBag diagnostics) internal override void GenerateMethodBody(TypeCompilationState compilationState, DiagnosticBag diagnostics)
{ {
var noLocals = ImmutableArray<LocalSymbol>.Empty; var noLocals = ImmutableArray<LocalSymbol>.Empty;
var noLocalFunctions = ImmutableArray<LocalFunctionSymbol>.Empty;
var initializerInvocation = MethodCompiler.BindConstructorInitializer(this, diagnostics, compilationState.Compilation); var initializerInvocation = MethodCompiler.BindConstructorInitializer(this, diagnostics, compilationState.Compilation);
var syntax = initializerInvocation.Syntax; var syntax = initializerInvocation.Syntax;
...@@ -26,7 +25,6 @@ internal override void GenerateMethodBody(TypeCompilationState compilationState, ...@@ -26,7 +25,6 @@ internal override void GenerateMethodBody(TypeCompilationState compilationState,
new BoundBlock( new BoundBlock(
syntax, syntax,
noLocals, noLocals,
noLocalFunctions,
ImmutableArray.Create<BoundStatement>( ImmutableArray.Create<BoundStatement>(
new BoundExpressionStatement(syntax, initializerInvocation), new BoundExpressionStatement(syntax, initializerInvocation),
new BoundReturnStatement(syntax, RefKind.None, null)))); new BoundReturnStatement(syntax, RefKind.None, null))));
......
...@@ -492,7 +492,7 @@ internal override void GenerateMethodBody(TypeCompilationState compilationState, ...@@ -492,7 +492,7 @@ internal override void GenerateMethodBody(TypeCompilationState compilationState,
} }
localsSet.Free(); localsSet.Free();
body = new BoundBlock(syntax, localsBuilder.ToImmutableAndFree(), ImmutableArray<LocalFunctionSymbol>.Empty, statementsBuilder.ToImmutableAndFree()) { WasCompilerGenerated = true }; body = new BoundBlock(syntax, localsBuilder.ToImmutableAndFree(), statementsBuilder.ToImmutableAndFree()) { WasCompilerGenerated = true };
Debug.Assert(!diagnostics.HasAnyErrors()); Debug.Assert(!diagnostics.HasAnyErrors());
Debug.Assert(!body.HasErrors); Debug.Assert(!body.HasErrors);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册