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

Unified Diff: src/parsing/pattern-rewriter.cc

Issue 2520883002: [parser] Fix scopes in rewriting of for-of and destructuring assignments. (Closed)
Patch Set: Remove incorrect DCHECK. Created 4 years, 1 month 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 | « src/parsing/parser.cc ('k') | test/cctest/interpreter/bytecode_expectations/Generators.golden » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/pattern-rewriter.cc
diff --git a/src/parsing/pattern-rewriter.cc b/src/parsing/pattern-rewriter.cc
index 21b1cec69655c092b3c4e822ed3d14dd6987ccb6..f3d9bb02a33bec518052372f713aec08ea3ef756 100644
--- a/src/parsing/pattern-rewriter.cc
+++ b/src/parsing/pattern-rewriter.cc
@@ -37,11 +37,12 @@ void Parser::PatternRewriter::DeclareAndInitializeVariables(
void Parser::PatternRewriter::RewriteDestructuringAssignment(
Parser* parser, RewritableExpression* to_rewrite, Scope* scope) {
- PatternRewriter rewriter;
-
+ DCHECK(!scope->HasBeenRemoved());
DCHECK(!to_rewrite->is_rewritten());
bool ok = true;
+
+ PatternRewriter rewriter;
rewriter.scope_ = scope;
rewriter.parser_ = parser;
rewriter.context_ = ASSIGNMENT;
@@ -586,8 +587,9 @@ void Parser::PatternRewriter::VisitArrayLiteral(ArrayLiteral* node,
Expression* closing_condition = factory()->NewUnaryOperation(
Token::NOT, factory()->NewVariableProxy(done), nopos);
- parser_->FinalizeIteratorUse(completion, closing_condition, iterator, block_,
- target);
+
+ parser_->FinalizeIteratorUse(scope(), completion, closing_condition, iterator,
+ block_, target);
block_ = target;
}
« no previous file with comments | « src/parsing/parser.cc ('k') | test/cctest/interpreter/bytecode_expectations/Generators.golden » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698