0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 8.2.4612: Vim9: cannot use a recursive call in a nested function

Problem:    Vim9: cannot use a recursive call in a nested function. (Sergey
            Vlasov)
Solution:   Define the funcref before compiling the function. (closes #9989)
This commit is contained in:
Bram Moolenaar
2022-03-23 11:29:15 +00:00
parent 81b573d7e5
commit a915fa0103
6 changed files with 52 additions and 21 deletions

View File

@@ -1172,9 +1172,10 @@ generate_NEWDICT(cctx_T *cctx, int count)
/*
* Generate an ISN_FUNCREF instruction.
* "isnp" is set to the instruction, so that fr_dfunc_idx can be set later.
*/
int
generate_FUNCREF(cctx_T *cctx, ufunc_T *ufunc)
generate_FUNCREF(cctx_T *cctx, ufunc_T *ufunc, isn_T **isnp)
{
isn_T *isn;
type_T *type;
@@ -1182,6 +1183,8 @@ generate_FUNCREF(cctx_T *cctx, ufunc_T *ufunc)
RETURN_OK_IF_SKIP(cctx);
if ((isn = generate_instr(cctx, ISN_FUNCREF)) == NULL)
return FAIL;
if (isnp != NULL)
*isnp = isn;
if (ufunc->uf_def_status == UF_NOT_COMPILED)
isn->isn_arg.funcref.fr_func_name = vim_strsave(ufunc->uf_name);
else