From: Bram Moolenaar Date: Thu, 8 Sep 2022 19:49:22 +0000 (+0100) Subject: patch 9.0.0420: function went missing X-Git-Tag: v9.0.0420 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c572ad508f53bd89aa29081fc583f17ef1f0f123;p=vim patch 9.0.0420: function went missing Problem: Function went missing. Solution: Add the function back. --- diff --git a/src/version.c b/src/version.c index 81de0b7d2..cfebf04d7 100644 --- a/src/version.c +++ b/src/version.c @@ -703,6 +703,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 420, /**/ 419, /**/ diff --git a/src/vim9cmds.c b/src/vim9cmds.c index 080674d2c..2b7c24d84 100644 --- a/src/vim9cmds.c +++ b/src/vim9cmds.c @@ -1684,6 +1684,27 @@ compile_eval(char_u *arg, cctx_T *cctx) return skipwhite(p); } +/* + * Get the local variable index for deferred function calls. + * Reserve it when not done already. + * Returns zero for failure. + */ + int +get_defer_var_idx(cctx_T *cctx) +{ + dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data) + + cctx->ctx_ufunc->uf_dfunc_idx; + if (dfunc->df_defer_var_idx == 0) + { + lvar_T *lvar = reserve_local(cctx, (char_u *)"@defer@", 7, + TRUE, &t_list_any); + if (lvar == NULL) + return 0; + dfunc->df_defer_var_idx = lvar->lv_idx + 1; + } + return dfunc->df_defer_var_idx; +} + /* * Compile "defer func(arg)". */