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

Unified Diff: src/parsing/parser.cc

Issue 2112163002: Block-scoped functions in evals are now only conditionally hoisted out. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: more tests Created 4 years, 5 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 | test/mjsunit/es6/block-eval-var-over-let.js » ('j') | 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 44d1a8145880902ce0e8e176b8a887b47c3de532..62a6ff5df41d07c9013c6093867d21fc214d0d2a 100644
--- a/src/parsing/parser.cc
+++ b/src/parsing/parser.cc
@@ -5233,7 +5233,11 @@ void Parser::InsertSloppyBlockFunctionVarBindings(Scope* scope,
auto delegates = static_cast<SloppyBlockFunctionMap::Vector*>(p->value);
for (SloppyBlockFunctionStatement* delegate : *delegates) {
// Check if there's a conflict with a lexical declaration
- Scope* outer_scope = scope->outer_scope();
+ Scope* decl_scope = scope;
+ while (decl_scope->is_eval_scope()) {
+ decl_scope = decl_scope->outer_scope()->DeclarationScope();
+ }
+ Scope* outer_scope = decl_scope->outer_scope();
Scope* query_scope = delegate->scope()->outer_scope();
Variable* var = nullptr;
bool should_hoist = true;
« no previous file with comments | « no previous file | test/mjsunit/es6/block-eval-var-over-let.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698