1
0
forked from aniani/vim

patch 8.2.0206: calling Vim9 function using default argument fails

Problem:    Calling Vim9 function using default argument fails.
Solution:   Give an appropriate error. (closes #5572)
This commit is contained in:
Bram Moolenaar
2020-02-04 21:24:15 +01:00
parent a5edb670dc
commit 26e117e9bc
4 changed files with 42 additions and 3 deletions

View File

@@ -1024,9 +1024,11 @@ generate_UCALL(cctx_T *cctx, char_u *name, int argcount)
isn->isn_arg.ufunc.cuf_argcount = argcount;
stack->ga_len -= argcount; // drop the arguments
// drop the funcref/partial, get back the return value
((type_T **)stack->ga_data)[stack->ga_len - 1] = &t_any;
if (ga_grow(stack, 1) == FAIL)
return FAIL;
// add return value
((type_T **)stack->ga_data)[stack->ga_len] = &t_any;
++stack->ga_len;
return OK;
}