Parser: Fix InitializerRewriter.

The bug was caused by AstTraversalVisitor refactoring:
https://codereview.chromium.org/2169833002/

InitializerRewriter::VisitRewritableExpression in parser.cc didn't recurse; so
it fails when a rewritable expression contains another rewritable expression.

See the bug for more details.

BUG=chromium:679727

Review-Url: https://codereview.chromium.org/2629623002
Cr-Commit-Position: refs/heads/master@{#42274}
This commit is contained in:
marja 2017-01-12 07:52:00 -08:00 committed by Commit bot
parent 148a903d92
commit aff64e9dfa
2 changed files with 7 additions and 0 deletions

View File

@ -2839,6 +2839,7 @@ class InitializerRewriter final
if (to_rewrite->is_rewritten()) return;
Parser::PatternRewriter::RewriteDestructuringAssignment(parser_, to_rewrite,
scope_);
AstTraversalVisitor::VisitRewritableExpression(to_rewrite);
}
// Code in function literals does not need to be eagerly rewritten, it will be

View File

@ -0,0 +1,6 @@
// Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
f = (e=({} = {} = 1)) => {}; f(1);
((e = ({} = {} = {})) => {})(1)