From: Fabrice Bellard Date: Sat, 10 Oct 2026 08:26:13 +0000 (+0200) Subject: fixed class elements parsing after a line terminator following get, set or static... X-Git-Url: https://git.kaiwu.me/?a=commitdiff_plain;h=55c5f0b3b253edee21afb919cfe7689a989a2360;p=quickjs.git fixed class elements parsing after a line terminator following get, set or static (#567) --- diff --git a/quickjs.c b/quickjs.c index 66d4514..0aad422 100644 --- a/quickjs.c +++ b/quickjs.c @@ -24808,9 +24808,8 @@ static int __exception js_parse_property_name(JSParseState *s, /* if allow_private is true (for class field parsing) and get/set is following by ';' (or LF with ASI), then it is a field name */ - if ((token_is_pseudo_keyword(s, JS_ATOM_get) || - token_is_pseudo_keyword(s, JS_ATOM_set)) && - (!allow_private || peek_token(s, TRUE) != '\n')) { + if (token_is_pseudo_keyword(s, JS_ATOM_get) || + token_is_pseudo_keyword(s, JS_ATOM_set)) { /* get x(), set x() */ name = JS_DupAtom(s->ctx, s->token.u.ident.atom); if (next_token(s)) @@ -24818,7 +24817,8 @@ static int __exception js_parse_property_name(JSParseState *s, if (s->token.val == ':' || s->token.val == ',' || s->token.val == '}' || s->token.val == '(' || s->token.val == '=' || - (s->token.val == ';' && allow_private)) { + ((s->token.val == ';' || s->token.val == '*') && + allow_private)) { is_non_reserved_ident = TRUE; goto ident_found; } @@ -25546,7 +25546,7 @@ static __exception int js_parse_class(JSParseState *s, BOOL is_class_expr, } is_static = FALSE; if (s->token.val == TOK_STATIC) { - int next = peek_token(s, TRUE); + int next = peek_token(s, FALSE); if (!(next == ';' || next == '}' || next == '(' || next == '=')) is_static = TRUE; }