Fix declaring property named get/set/async

This commit is contained in:
Kevin Wang 2024-07-25 12:30:15 +08:00 committed by Saúl Ibarra Corretgé
parent da5b95dcaf
commit c4d3833966
2 changed files with 9 additions and 2 deletions

View file

@ -20889,7 +20889,7 @@ static int __exception js_parse_property_name(JSParseState *s,
goto fail1;
if (s->token.val == ':' || s->token.val == ',' ||
s->token.val == '}' || s->token.val == '(' ||
s->token.val == '=') {
s->token.val == '=' || s->token.val == ';') {
is_non_reserved_ident = TRUE;
goto ident_found;
}
@ -20906,7 +20906,7 @@ static int __exception js_parse_property_name(JSParseState *s,
goto fail1;
if (s->token.val == ':' || s->token.val == ',' ||
s->token.val == '}' || s->token.val == '(' ||
s->token.val == '=') {
s->token.val == '=' || s->token.val == ';') {
is_non_reserved_ident = TRUE;
goto ident_found;
}

View file

@ -349,10 +349,17 @@ function test_class()
assert(S.z === 42);
class P {
get;
set;
async;
get = () => "123";
set = () => "456";
async = () => "789";
static() { return 42; }
}
assert(new P().get() === "123");
assert(new P().set() === "456");
assert(new P().async() === "789");
assert(new P().static() === 42);
};