mirror of
https://github.com/samsonjs/lake.git
synced 2026-03-25 08:55:49 +00:00
check # of fixed args when applying vararg functions
This commit is contained in:
parent
90e935f93c
commit
67c785179e
1 changed files with 4 additions and 0 deletions
|
|
@ -311,6 +311,10 @@ LakeVal *apply(LakeVal *fnVal, LakeList *args)
|
|||
|
||||
/* bind varargs */
|
||||
if (fn->varargs) {
|
||||
if (LIST_N(args) < nparams) {
|
||||
ERR("expected at least %zu params but got %zu", nparams, LIST_N(args));
|
||||
return NULL;
|
||||
}
|
||||
LakeList *remainingArgs = list_make_with_capacity(LIST_N(args) - nparams);
|
||||
for (; i < LIST_N(args); ++i) {
|
||||
list_append(remainingArgs, LIST_VAL(args, i));
|
||||
|
|
|
|||
Loading…
Reference in a new issue