[parser] Fix preparsing of modules containing labels

Fixes spurious DCHECK triggering due to bug introduced in
https://chromium-review.googlesource.com/c/v8/v8/+/1836258.

Bug: chromium:1011596
Change-Id: Ia3b1eb25d326e465b3239f191aad11d90a2e56a8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1844777
Reviewed-by: Sathya Gunasekaran  <gsathya@chromium.org>
Commit-Queue: Dan Elphick <delphick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64125}
This commit is contained in:
Dan Elphick 2019-10-07 10:41:33 +01:00 committed by Commit Bot
parent 65940f4369
commit 427a2fd5a9
3 changed files with 14 additions and 5 deletions

View File

@ -1073,7 +1073,7 @@ class PreParser : public ParserBase<PreParser> {
V8_INLINE void DeclareLabel(ZonePtrList<const AstRawString>** labels,
ZonePtrList<const AstRawString>** own_labels,
const AstRawString* label) {
DCHECK(!parsing_module_);
DCHECK(!parsing_module_ || !label->IsOneByteEqualTo("await"));
}
// TODO(nikolaos): The preparser currently does not keep track of labels.
@ -1326,10 +1326,6 @@ class PreParser : public ParserBase<PreParser> {
return identifier.IsEvalOrArguments();
}
V8_INLINE bool IsAwait(const PreParserIdentifier& identifier) const {
return identifier.IsAwait();
}
// Returns true if the expression is of type "this.foo".
V8_INLINE static bool IsThisProperty(const PreParserExpression& expression) {
return expression.IsThisProperty();

View File

@ -0,0 +1,8 @@
// 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.
export function foo() {
{ label: 1 }
return 42;
}

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.
import "./regress-crbug-1011596-module.mjs"