mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
patch 8.2.2218: Vim9: failure if passing more args to lambda than expected
Problem: Vim9: failure if passing more arguments to a lambda than expected. Solution: Only put expected arguments on the stack. (closes #7548)
This commit is contained in:
@@ -1020,8 +1020,11 @@ call_def_function(
|
||||
ga_init2(&ectx.ec_trystack, sizeof(trycmd_T), 10);
|
||||
ga_init2(&ectx.ec_funcrefs, sizeof(partial_T *), 10);
|
||||
|
||||
// Put arguments on the stack.
|
||||
for (idx = 0; idx < argc; ++idx)
|
||||
// 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
|
||||
&& (ufunc->uf_va_name != NULL || idx < ufunc->uf_args.ga_len);
|
||||
++idx)
|
||||
{
|
||||
if (ufunc->uf_arg_types != NULL && idx < ufunc->uf_args.ga_len
|
||||
&& check_typval_type(ufunc->uf_arg_types[idx], &argv[idx],
|
||||
|
Reference in New Issue
Block a user