diff options
author | Fabrice Bellard <fabrice@bellard.org> | 2025-05-24 13:01:50 +0200 |
---|---|---|
committer | Fabrice Bellard <fabrice@bellard.org> | 2025-05-24 13:01:50 +0200 |
commit | 3d92a9d30cbb43fc0685c44fc3fb9727a2b4be7c (patch) | |
tree | a10a639d4f892d0c6977fabf53b9890903bfa10a /quickjs.c | |
parent | 02a2643142a0522e9e2d0d60df19e72daa84bbc3 (diff) | |
download | quickjs-3d92a9d30cbb43fc0685c44fc3fb9727a2b4be7c.tar.gz quickjs-3d92a9d30cbb43fc0685c44fc3fb9727a2b4be7c.zip |
new keyword cannot be used with an optional chain
Diffstat (limited to 'quickjs.c')
-rw-r--r-- | quickjs.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -25660,6 +25660,8 @@ static __exception int js_parse_postfix_expr(JSParseState *s, int parse_flags) BOOL has_optional_chain = FALSE; if (s->token.val == TOK_QUESTION_MARK_DOT) { + if ((parse_flags & PF_POSTFIX_CALL) == 0) + return js_parse_error(s, "new keyword cannot be used with an optional chain"); op_token_ptr = s->token.ptr; /* optional chaining */ if (next_token(s)) |