1
0
forked from aniani/vim

patch 8.2.2747: Vim9: not always an error for too many function arguments

Problem:    Vim9: not always an error for too many function arguments.
Solution:   Check for getting too many arguments.
This commit is contained in:
Bram Moolenaar
2021-04-10 20:10:26 +02:00
parent 87795939d0
commit bb8a7ce0a1
4 changed files with 27 additions and 4 deletions

View File

@@ -1336,6 +1336,16 @@ call_def_function(
ga_init2(&ectx.ec_trystack, sizeof(trycmd_T), 10);
ga_init2(&ectx.ec_funcrefs, sizeof(partial_T *), 10);
idx = argc - ufunc->uf_args.ga_len;
if (idx > 0 && ufunc->uf_va_name == NULL)
{
if (idx == 1)
emsg(_(e_one_argument_too_many));
else
semsg(_(e_nr_arguments_too_many), idx);
return FAIL;
}
// Put arguments on the stack, but no more than what the function expects.
// A lambda can be called with more arguments than it uses.
for (idx = 0; idx < argc