Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(740)

Unified Diff: src/parsing/parser.cc

Issue 2042793002: Fix scope flags for default parameters (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Another propagate call Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/parser.cc
diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc
index 50d875feb687347ca72b2f163f3ae84750105911..8164c7d3b2cda7e9dd5af74dac0883f0ff95541e 100644
--- a/src/parsing/parser.cc
+++ b/src/parsing/parser.cc
@@ -4554,6 +4554,7 @@ 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;
@@ -4595,12 +4596,13 @@ Block* Parser::BuildParameterInitializationBlock(
Scope* param_scope = scope_;
Block* param_block = init_block;
- if (!parameter.is_simple() && scope_->calls_sloppy_eval()) {
+ if (!parameter.is_simple()) {
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_scope->RecordEvalCall();
+ param_scopes->Add(param_scope, zone());
+ scope_->PropagateUsageFlagsToScope(param_scope);
adamk 2016/06/06 18:53:36 This is where we have to make the call, so that th
param_block = factory()->NewBlock(NULL, 8, true, RelocInfo::kNoPosition);
param_block->set_scope(param_scope);
descriptor.hoist_scope = scope_;
@@ -4614,7 +4616,7 @@ Block* Parser::BuildParameterInitializationBlock(
&decl, nullptr, CHECK_OK);
}
- if (!parameter.is_simple() && scope_->calls_sloppy_eval()) {
+ if (!parameter.is_simple()) {
param_scope = param_scope->FinalizeBlockScope();
if (param_scope != nullptr) {
CheckConflictingVarDeclarations(param_scope, CHECK_OK);
@@ -4622,6 +4624,9 @@ Block* Parser::BuildParameterInitializationBlock(
init_block->statements()->Add(param_block, zone());
}
}
+ for (Scope* param_scope : *param_scopes) {
+ scope_->PropagateUsageFlagsToScope(param_scope);
adamk 2016/06/06 18:53:36 This call is now redundant, right?
+ }
return init_block;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698