]> git.kaiwu.me - quickjs.git/commitdiff
fixed array literal parsing (gengjiawen)
authorFabrice Bellard <fabrice@bellard.org>
Sat, 21 Nov 2026 16:02:32 +0000 (17:02 +0100)
committerFabrice Bellard <fabrice@bellard.org>
Sat, 21 Nov 2026 16:02:32 +0000 (17:02 +0100)
quickjs.c

index 7d23daff85fef83869af0f75c48098400f8d7c24..1544e4f33d9483d4596e2a2c198284253d942e06 100644 (file)
--- a/quickjs.c
+++ b/quickjs.c
@@ -26498,7 +26498,9 @@ static __exception int js_parse_array_literal(JSParseState *s)
         if (s->token.val == ',') {
             if (next_token(s))
                 return -1;
-        }
+        } else
+        if (s->token.val != ']')
+            goto done;
     }
     if (s->token.val == ']') {
         if (need_length) {