Mercurial > vim
diff src/vim9instr.c @ 28173:b0c885507de4 v8.2.4612
patch 8.2.4612: Vim9: cannot use a recursive call in a nested function
Commit: https://github.com/vim/vim/commit/a915fa010330ee7212e06d3511acd363d04d2d28
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Mar 23 11:29:15 2022 +0000
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)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 23 Mar 2022 12:30:04 +0100 |
parents | 088d8dc22045 |
children | 662d2d5db9a6 |
line wrap: on
line diff
--- a/src/vim9instr.c +++ b/src/vim9instr.c @@ -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 * 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