[parser] Make pattern DCHECK dependent on !has_error

Bug: chromium:926036
Change-Id: Ibc8d3ffc3f9411fa33c0ed6326cb6b19a7d8dd05
Reviewed-on: https://chromium-review.googlesource.com/c/1442635
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59162}
This commit is contained in:
Leszek Swirski 2019-01-29 11:06:45 +01:00 committed by Commit Bot
parent c559f868a5
commit b0e1c2bfe5
2 changed files with 6 additions and 1 deletions

View File

@ -1853,7 +1853,7 @@ void Parser::DesugarBindingInForEachStatement(ForInfo* for_info,
for_info->parsing_result.declarations[0];
Variable* temp = NewTemporary(ast_value_factory()->dot_for_string());
ScopedPtrList<Statement> each_initialization_statements(pointer_buffer());
DCHECK_NOT_NULL(decl.pattern);
DCHECK_IMPLIES(!has_error(), decl.pattern != nullptr);
decl.initializer = factory()->NewVariableProxy(temp, for_info->position);
InitializeVariables(&each_initialization_statements, NORMAL_VARIABLE, &decl);

View File

@ -0,0 +1,5 @@
// Copyright 2019 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("async() => { for await (var a ;;) {} }", SyntaxError);