summaryrefslogtreecommitdiff
path: root/quickjs.c
diff options
context:
space:
mode:
Diffstat (limited to 'quickjs.c')
-rw-r--r--quickjs.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/quickjs.c b/quickjs.c
index ac4f2aa..42c8d4e 100644
--- a/quickjs.c
+++ b/quickjs.c
@@ -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))