Commit 78bb3c6e authored by littledan's avatar littledan Committed by Commit bot

Revert of Fix scope flags for default parameters (patchset #2 id:20001 of...

Revert of Fix scope flags for default parameters (patchset #2 id:20001 of https://codereview.chromium.org/2042793002/ )

Reason for revert:
Does not fix the bug it intended to fix.

Original issue's description:
> Fix scope flags for default parameters
>
> R=rossberg,adamk
> BUG=chromium:616386
>
> Committed: https://crrev.com/4cc1331c341f5bfbeee54fec521f682a8a406af4
> Cr-Commit-Position: refs/heads/master@{#36755}

TBR=adamk@chromium.org,rossberg@chromium.org,jochen@chromium.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=chromium:616386

Review-Url: https://codereview.chromium.org/2062593002
Cr-Commit-Position: refs/heads/master@{#36976}
parent d20e8183
......@@ -4564,7 +4564,6 @@ Block* Parser::BuildParameterInitializationBlock(
DCHECK(scope_->is_function_scope());
Block* init_block =
factory()->NewBlock(NULL, 1, true, RelocInfo::kNoPosition);
ZoneList<Scope*>* param_scopes = new (zone()) ZoneList<Scope*>(0, zone());
for (int i = 0; i < parameters.params.length(); ++i) {
auto parameter = parameters.params[i];
if (parameter.is_rest && parameter.pattern->IsVariableProxy()) break;
......@@ -4606,13 +4605,12 @@ Block* Parser::BuildParameterInitializationBlock(
Scope* param_scope = scope_;
Block* param_block = init_block;
if (!parameter.is_simple()) {
if (!parameter.is_simple() && scope_->calls_sloppy_eval()) {
param_scope = NewScope(scope_, BLOCK_SCOPE);
param_scope->set_is_declaration_scope();
param_scope->set_start_position(descriptor.initialization_pos);
param_scope->set_end_position(parameter.initializer_end_position);
param_scopes->Add(param_scope, zone());
scope_->PropagateUsageFlagsToScope(param_scope);
param_scope->RecordEvalCall();
param_block = factory()->NewBlock(NULL, 8, true, RelocInfo::kNoPosition);
param_block->set_scope(param_scope);
descriptor.hoist_scope = scope_;
......@@ -4626,7 +4624,7 @@ Block* Parser::BuildParameterInitializationBlock(
&decl, nullptr, CHECK_OK);
}
if (!parameter.is_simple()) {
if (!parameter.is_simple() && scope_->calls_sloppy_eval()) {
param_scope = param_scope->FinalizeBlockScope();
if (param_scope != nullptr) {
CheckConflictingVarDeclarations(param_scope, CHECK_OK);
......@@ -4634,9 +4632,6 @@ Block* Parser::BuildParameterInitializationBlock(
init_block->statements()->Add(param_block, zone());
}
}
for (Scope* param_scope : *param_scopes) {
scope_->PropagateUsageFlagsToScope(param_scope);
}
return init_block;
}
......
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