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

Unified Diff: src/parsing/parser.cc

Issue 2673313003: [parser] Skipping inner funcs: produce the same scopes / variables for loops. (Closed)
Patch Set: code review (vogelheim@) Created 3 years, 10 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 | src/parsing/preparser.h » ('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 30b048996869293c2250afdbfe9121813011512e..efb76fd5d8ac0eccf8b14e223ab4e3b0bae84ae1 100644
--- a/src/parsing/parser.cc
+++ b/src/parsing/parser.cc
@@ -1967,14 +1967,13 @@ void Parser::DesugarBindingInForEachStatement(ForInfo* for_info,
bool is_for_var_of =
for_info->mode == ForEachStatement::ITERATE &&
for_info->parsing_result.descriptor.mode == VariableMode::VAR;
+ bool collect_names =
+ IsLexicalVariableMode(for_info->parsing_result.descriptor.mode) ||
+ is_for_var_of;
PatternRewriter::DeclareAndInitializeVariables(
this, each_initialization_block, &descriptor, &decl,
- (IsLexicalVariableMode(for_info->parsing_result.descriptor.mode) ||
- is_for_var_of)
- ? &for_info->bound_names
- : nullptr,
- CHECK_OK_VOID);
+ collect_names ? &for_info->bound_names : nullptr, CHECK_OK_VOID);
// Annex B.3.5 prohibits the form
// `try {} catch(e) { for (var e of {}); }`
« no previous file with comments | « no previous file | src/parsing/preparser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698