1
0
mirror of https://github.com/janet-lang/janet synced 2025-10-31 07:33:01 +00:00

Fix named arguments with optional args.

This commit is contained in:
Calvin Rose
2022-06-18 09:46:28 -05:00
parent 1d905bf07f
commit a1172529bf
4 changed files with 22 additions and 21 deletions

View File

@@ -858,6 +858,7 @@ static JanetSlot janetc_fn(JanetFopts opts, int32_t argn, const Janet *argv) {
for (i = 0; i < paramcount; i++) {
Janet param = params[i];
if (namedargs) {
arity--;
if (!janet_checktype(param, JANET_SYMBOL)) {
errmsg = "only named arguments can follow &named";
goto error;
@@ -915,7 +916,7 @@ static JanetSlot janetc_fn(JanetFopts opts, int32_t argn, const Janet *argv) {
}
vararg = 1;
structarg = 1;
arity = i;
arity--;
seenamp = 1;
namedargs = 1;
named_table = janet_table(10);