Commit 7f4aca77 authored by Toon Verwaest's avatar Toon Verwaest Committed by Commit Bot

[parser] RewritableExpressions are only used for assignments

Change-Id: I07945944f114a32211e4f5f6fc0c5c6b88184940
Reviewed-on: https://chromium-review.googlesource.com/c/1264279Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56401}
parent 3f8c6e01
......@@ -294,12 +294,8 @@ Variable* PatternRewriter::CreateTempVar(Expression* value) {
}
void PatternRewriter::VisitRewritableExpression(RewritableExpression* node) {
if (!node->expression()->IsAssignment()) {
// RewritableExpressions are also used for desugaring Spread, which is
// orthogonal to PatternRewriter; just visit the underlying expression.
DCHECK_EQ(AstNode::kArrayLiteral, node->expression()->node_type());
return Visit(node->expression());
} else if (context() != ASSIGNMENT) {
DCHECK(node->expression()->IsAssignment());
if (context() != ASSIGNMENT) {
// This is not a destructuring assignment. Mark the node as rewritten to
// prevent redundant rewriting and visit the underlying expression.
DCHECK(!node->is_rewritten());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment