Commit 14a79f63 authored by Huáng Jùnliàng's avatar Huáng Jùnliàng Committed by Commit Bot

[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: 's avatarToon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65600}
parent 3f7e99ac
...@@ -95,6 +95,7 @@ Hannu Trey <hannu.trey@gmail.com> ...@@ -95,6 +95,7 @@ Hannu Trey <hannu.trey@gmail.com>
Henrique Ferreiro <henrique.ferreiro@gmail.com> Henrique Ferreiro <henrique.ferreiro@gmail.com>
Hirofumi Mako <mkhrfm@gmail.com> Hirofumi Mako <mkhrfm@gmail.com>
Honggyu Kim <honggyu.kp@gmail.com> Honggyu Kim <honggyu.kp@gmail.com>
Huáng Jùnliàng <jlhwung@gmail.com>
Ingvar Stepanyan <me@rreverser.com> Ingvar Stepanyan <me@rreverser.com>
Ioseb Dzmanashvili <ioseb.dzmanashvili@gmail.com> Ioseb Dzmanashvili <ioseb.dzmanashvili@gmail.com>
Isiah Meadows <impinball@gmail.com> Isiah Meadows <impinball@gmail.com>
......
...@@ -2300,6 +2300,7 @@ ParserBase<Impl>::ParseClassPropertyDefinition(ClassInfo* class_info, ...@@ -2300,6 +2300,7 @@ ParserBase<Impl>::ParseClassPropertyDefinition(ClassInfo* class_info,
template <typename Impl> template <typename Impl>
typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseMemberInitializer( typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseMemberInitializer(
ClassInfo* class_info, int beg_pos, bool is_static) { ClassInfo* class_info, int beg_pos, bool is_static) {
FunctionBodyParsingScope body_parsing_scope(impl());
DeclarationScope* initializer_scope = DeclarationScope* initializer_scope =
is_static ? class_info->static_fields_scope is_static ? class_info->static_fields_scope
: class_info->instance_members_scope; : class_info->instance_members_scope;
......
...@@ -9967,6 +9967,8 @@ TEST(AsyncAwait) { ...@@ -9967,6 +9967,8 @@ TEST(AsyncAwait) {
"(async(a = await => 1), async(a) => 1)", "(async(a = await => 1), async(a) => 1)",
"async(a = await => 1, b = async() => 1);", "async(a = await => 1, b = async() => 1);",
"async (x = class { p = await }) => {};",
nullptr nullptr
}; };
// clang-format on // clang-format on
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment