1
0
forked from aniani/vim

patch 8.2.2942: Vim9: error when calling function with too few arguments

Problem:    Vim9: internal error when calling function with too few arguments
Solution:   Check for argument count to be too few. (closes #8325)
This commit is contained in:
Bram Moolenaar
2021-06-05 18:15:09 +02:00
parent b288ba9f1d
commit 8da6d6db34
4 changed files with 23 additions and 0 deletions

View File

@@ -4234,6 +4234,14 @@ call_def_function(
semsg(_(e_nr_arguments_too_many), idx);
goto failed_early;
}
else if (idx < 0)
{
if (idx == -1)
emsg(_(e_one_argument_too_few));
else
semsg(_(e_nr_arguments_too_few), -idx);
goto failed_early;
}
// Put arguments on the stack, but no more than what the function expects.
// A lambda can be called with more arguments than it uses.