patch 8.2.1302: Vim9: varargs arg after optional arg does not work
Problem: Vim9: varargs arg after optional arg does not work
Solution: Check for the "..." first. (issue #6507)
diff --git a/src/vim9compile.c b/src/vim9compile.c
index 31e7612..8efb1f6 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -2106,16 +2106,16 @@
first_optional = argcount;
++p;
}
- else if (first_optional != -1)
- {
- emsg(_("E1007: mandatory argument after optional argument"));
- return &t_any;
- }
else if (STRNCMP(p, "...", 3) == 0)
{
flags |= TTFLAG_VARARGS;
p += 3;
}
+ else if (first_optional != -1)
+ {
+ emsg(_("E1007: mandatory argument after optional argument"));
+ return &t_any;
+ }
arg_type[argcount++] = parse_type(&p, type_gap);