[parser]: reset expression scope stack to nullptr when parsing class member initializer

When "await" is referenced in a part of an async arrow function head, we will walk up the active ambiguous expression stack and mark the ambiguous arrow head scope. However the class member initializer is always non-ambiguous so we should reset the stack and stop walking up.

Bug: v8:10094
Change-Id: Iac35889158ef46c851888993b6081f8ff8610c43
Fixed: v8:10094
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1987620
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65600}
This commit is contained in:
Huáng Jùnliàng 2020-01-04 15:31:15 -05:00 committed by Commit Bot
parent 3f7e99ac46
commit 14a79f6335
3 changed files with 4 additions and 0 deletions

View File

@ -95,6 +95,7 @@ Hannu Trey <hannu.trey@gmail.com>
Henrique Ferreiro <henrique.ferreiro@gmail.com>
Hirofumi Mako <mkhrfm@gmail.com>
Honggyu Kim <honggyu.kp@gmail.com>
Huáng Jùnliàng <jlhwung@gmail.com>
Ingvar Stepanyan <me@rreverser.com>
Ioseb Dzmanashvili <ioseb.dzmanashvili@gmail.com>
Isiah Meadows <impinball@gmail.com>

View File

@ -2300,6 +2300,7 @@ ParserBase<Impl>::ParseClassPropertyDefinition(ClassInfo* class_info,
template <typename Impl>
typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseMemberInitializer(
ClassInfo* class_info, int beg_pos, bool is_static) {
FunctionBodyParsingScope body_parsing_scope(impl());
DeclarationScope* initializer_scope =
is_static ? class_info->static_fields_scope
: class_info->instance_members_scope;

View File

@ -9967,6 +9967,8 @@ TEST(AsyncAwait) {
"(async(a = await => 1), async(a) => 1)",
"async(a = await => 1, b = async() => 1);",
"async (x = class { p = await }) => {};",
nullptr
};
// clang-format on