diff --git a/src/parsing/pattern-rewriter.cc b/src/parsing/pattern-rewriter.cc index ba229ac08c..11d5d8ddc6 100644 --- a/src/parsing/pattern-rewriter.cc +++ b/src/parsing/pattern-rewriter.cc @@ -134,6 +134,7 @@ void Parser::DeclareAndInitializeVariables( Block* block, const DeclarationDescriptor* declaration_descriptor, const DeclarationParsingResult::Declaration* declaration, ZonePtrList* names) { + if (has_error()) return; PatternRewriter::DeclareAndInitializeVariables( this, block, declaration_descriptor, declaration, names); } diff --git a/test/mjsunit/regress/regress-900585.js b/test/mjsunit/regress/regress-900585.js new file mode 100644 index 0000000000..8969644f95 --- /dev/null +++ b/test/mjsunit/regress/regress-900585.js @@ -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);