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

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

Issue 1859423002: [es6] Fix bug in pattern re-writing (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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/destructuring.js » ('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 3ecffb99dbd763f26a5a13756092fb5e8006a64b..1d93271e6e72d3f2e7257340d7ffb3e367278fb3 100644
--- a/src/parsing/pattern-rewriter.cc
+++ b/src/parsing/pattern-rewriter.cc
@@ -79,7 +79,11 @@ bool Parser::PatternRewriter::IsBindingContext(PatternContext c) const {
Parser::PatternRewriter::PatternContext
Parser::PatternRewriter::SetAssignmentContextIfNeeded(Expression* node) {
PatternContext old_context = context();
- if (node->IsAssignment() && node->AsAssignment()->op() == Token::ASSIGN) {
+ // AssignmentExpressions may occur in the Initializer position of a
+ // SingleNameBinding. Such expressions should not prompt a change in the
+ // pattern's context.
+ if (node->IsAssignment() && node->AsAssignment()->op() == Token::ASSIGN &&
+ !IsInitializerContext()) {
set_context(ASSIGNMENT);
}
return old_context;
« no previous file with comments | « no previous file | test/mjsunit/es6/destructuring.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698