[parser] Don't rewrite if we're in error state

Bug: chromium:900585
Change-Id: I2f6045ce23af9a15baddc73127b0c4e3e514841c
Reviewed-on: https://chromium-review.googlesource.com/c/1310294
Commit-Queue: Maya Lekova <mslekova@chromium.org>
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57186}
This commit is contained in:
Toon Verwaest 2018-10-31 17:24:13 +01:00 committed by Commit Bot
parent 322d5978f4
commit 9bd6e601cb
2 changed files with 6 additions and 0 deletions

View File

@ -134,6 +134,7 @@ void Parser::DeclareAndInitializeVariables(
Block* block, const DeclarationDescriptor* declaration_descriptor,
const DeclarationParsingResult::Declaration* declaration,
ZonePtrList<const AstRawString>* names) {
if (has_error()) return;
PatternRewriter::DeclareAndInitializeVariables(
this, block, declaration_descriptor, declaration, names);
}

View File

@ -0,0 +1,5 @@
// Copyright 2018 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.
assertThrows("/*for..in*/for(var [x5, functional] = this = function(id) { return id } in false) var x2, x;", ReferenceError);