summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabrice Bellard <fabrice@bellard.org>2025-04-22 18:53:48 +0200
committerFabrice Bellard <fabrice@bellard.org>2025-04-22 18:53:48 +0200
commit5e71d148f229f9a5ee6824902366844178026966 (patch)
tree6cda560aa4b3a62728caa3e769d7d31e4549ed01
parent99a855f2c76d0b94ede87ef0c1ff416903203313 (diff)
downloadquickjs-5e71d148f229f9a5ee6824902366844178026966.tar.gz
quickjs-5e71d148f229f9a5ee6824902366844178026966.zip
setters cannot have rest arguments
-rw-r--r--quickjs.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/quickjs.c b/quickjs.c
index ba021b7..e3e3074 100644
--- a/quickjs.c
+++ b/quickjs.c
@@ -34126,6 +34126,8 @@ static __exception int js_parse_function_decl2(JSParseState *s,
int idx, has_initializer;
if (s->token.val == TOK_ELLIPSIS) {
+ if (func_type == JS_PARSE_FUNC_SETTER)
+ goto fail_accessor;
fd->has_simple_parameter_list = FALSE;
rest = TRUE;
if (next_token(s))
@@ -34239,6 +34241,7 @@ static __exception int js_parse_function_decl2(JSParseState *s,
}
if ((func_type == JS_PARSE_FUNC_GETTER && fd->arg_count != 0) ||
(func_type == JS_PARSE_FUNC_SETTER && fd->arg_count != 1)) {
+ fail_accessor:
js_parse_error(s, "invalid number of arguments for getter or setter");
goto fail;
}