]> git.kaiwu.me - quickjs.git/commitdiff
fixed class elements parsing after a line terminator following get, set or static...
authorFabrice Bellard <fabrice@bellard.org>
Sat, 10 Oct 2026 08:26:13 +0000 (10:26 +0200)
committerFabrice Bellard <fabrice@bellard.org>
Sat, 10 Oct 2026 08:26:13 +0000 (10:26 +0200)
quickjs.c

index 66d4514f0fd680e1732bd3b14e050f45fe319ceb..0aad4222dec32fdef490da3416133cab914234f0 100644 (file)
--- 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;
         }