Commit 6c1ea55e authored by verwaest's avatar verwaest Committed by Commit bot

Finalize scope via block-state in BuildParameterInitializationBlock

This avoids direct access to scope() for later lazy scope allocation.

BUG=v8:5209

Review-Url: https://codereview.chromium.org/2225773003
Cr-Commit-Position: refs/heads/master@{#38458}
parent 49f50944
......@@ -4723,16 +4723,14 @@ Block* Parser::BuildParameterInitializationBlock(
param_scope);
}
{
BlockState block_state(&scope_state_, param_scope);
DeclarationParsingResult::Declaration decl(
parameter.pattern, initializer_position, initial_value);
PatternRewriter::DeclareAndInitializeVariables(param_block, &descriptor,
&decl, nullptr, CHECK_OK);
}
if (!parameter.is_simple() && scope()->calls_sloppy_eval()) {
param_scope = param_scope->FinalizeBlockScope();
BlockState block_state(&scope_state_, param_scope);
DeclarationParsingResult::Declaration decl(
parameter.pattern, initializer_position, initial_value);
PatternRewriter::DeclareAndInitializeVariables(param_block, &descriptor,
&decl, nullptr, CHECK_OK);
if (param_block != init_block) {
param_scope = block_state.FinalizedBlockScope();
if (param_scope != nullptr) {
CheckConflictingVarDeclarations(param_scope, CHECK_OK);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment