]> granicus.if.org Git - vim/commitdiff
patch 9.0.0420: function went missing v9.0.0420
authorBram Moolenaar <Bram@vim.org>
Thu, 8 Sep 2022 19:49:22 +0000 (20:49 +0100)
committerBram Moolenaar <Bram@vim.org>
Thu, 8 Sep 2022 19:49:22 +0000 (20:49 +0100)
Problem:    Function went missing.
Solution:   Add the function back.

src/version.c
src/vim9cmds.c

index 81de0b7d2f1ce4ce5a2f9f4bad50a974f1c623bd..cfebf04d757c88b7eb4f3dc97d912b633548c61e 100644 (file)
@@ -703,6 +703,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    420,
 /**/
     419,
 /**/
index 080674d2c941a14d8694e1b3f298b0e296b935c6..2b7c24d8427927c40c4efe832bad94daf7acc8fb 100644 (file)
@@ -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)".
  */