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

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

Issue 1712203002: Revert of Non-pattern rewriting revisited (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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 | « src/parsing/parser-base.h ('k') | src/parsing/preparser.h » ('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 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());
« no previous file with comments | « src/parsing/parser-base.h ('k') | src/parsing/preparser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698