]> git.kaiwu.me - quickjs.git/commitdiff
reject destructuring patterns without ':' after a property name
authorFabrice Bellard <fabrice@bellard.org>
Sat, 21 Nov 2026 15:56:06 +0000 (16:56 +0100)
committerFabrice Bellard <fabrice@bellard.org>
Sat, 21 Nov 2026 15:56:06 +0000 (16:56 +0100)
quickjs.c

index 9e905333bfb371004bc6dbe08001d3dfadac58db..7d23daff85fef83869af0f75c48098400f8d7c24 100644 (file)
--- a/quickjs.c
+++ b/quickjs.c
@@ -27123,7 +27123,7 @@ static int js_parse_destructuring_element(JSParseState *s, int tok, int is_arg,
                 return -1;
             var_name = JS_ATOM_NULL;
             if (prop_type == PROP_TYPE_IDENT) {
-                if (next_token(s))
+                if (js_parse_expect(s, ':'))
                     goto prop_error;
                 if ((s->token.val == '[' || s->token.val == '{')
                     &&  ((tok1 = js_parse_skip_parens_token(s, &skip_bits, FALSE)) == ',' ||