Index: src/parsing/pattern-rewriter.cc |
diff --git a/src/parsing/pattern-rewriter.cc b/src/parsing/pattern-rewriter.cc |
index 04b517ebba4ba0928994237360387df279d1cc92..6e20282785d0ba3495b2b4b723f69cb6e861bfd6 100644 |
--- a/src/parsing/pattern-rewriter.cc |
+++ b/src/parsing/pattern-rewriter.cc |
@@ -33,7 +33,7 @@ |
void Parser::PatternRewriter::RewriteDestructuringAssignment( |
- Parser* parser, RewritableExpression* to_rewrite, Scope* scope) { |
+ Parser* parser, RewritableAssignmentExpression* to_rewrite, Scope* scope) { |
PatternRewriter rewriter; |
DCHECK(!to_rewrite->is_rewritten()); |
@@ -58,7 +58,8 @@ |
Parser* parser, Assignment* assignment, Scope* scope) { |
DCHECK_NOT_NULL(assignment); |
DCHECK_EQ(Token::ASSIGN, assignment->op()); |
- auto to_rewrite = parser->factory()->NewRewritableExpression(assignment); |
+ auto to_rewrite = |
+ parser->factory()->NewRewritableAssignmentExpression(assignment); |
RewriteDestructuringAssignment(parser, to_rewrite, scope); |
return to_rewrite->expression(); |
} |
@@ -90,8 +91,8 @@ |
// AssignmentElement nodes |
PatternContext old_context = context(); |
bool is_destructuring_assignment = |
- node->IsRewritableExpression() && |
- !node->AsRewritableExpression()->is_rewritten(); |
+ node->IsRewritableAssignmentExpression() && |
+ !node->AsRewritableAssignmentExpression()->is_rewritten(); |
bool is_assignment = |
node->IsAssignment() && node->AsAssignment()->op() == Token::ASSIGN; |
if (is_destructuring_assignment || is_assignment) { |
@@ -323,11 +324,10 @@ |
} |
-void Parser::PatternRewriter::VisitRewritableExpression( |
- RewritableExpression* node) { |
- // If this is not a destructuring assignment... |
- if (!IsAssignmentContext() || !node->expression()->IsAssignment()) { |
- // Mark the node as rewritten to prevent redundant rewriting, and |
+void Parser::PatternRewriter::VisitRewritableAssignmentExpression( |
+ RewritableAssignmentExpression* node) { |
+ if (!IsAssignmentContext()) { |
+ // Mark the assignment as rewritten to prevent redundant rewriting, and |
// perform BindingPattern rewriting |
DCHECK(!node->is_rewritten()); |
node->Rewrite(node->expression()); |