changeset 30168:6472aa128651 v9.0.0420

patch 9.0.0420: function went missing Commit: https://github.com/vim/vim/commit/c572ad508f53bd89aa29081fc583f17ef1f0f123 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Sep 8 20:49:22 2022 +0100 patch 9.0.0420: function went missing Problem: Function went missing. Solution: Add the function back.
author Bram Moolenaar <Bram@vim.org>
date Thu, 08 Sep 2022 22:00:04 +0200
parents 3a316f08a3c0
children 28feb6ed144b
files src/version.c src/vim9cmds.c
diffstat 2 files changed, 23 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    420,
+/**/
     419,
 /**/
     418,
--- a/src/vim9cmds.c
+++ b/src/vim9cmds.c
@@ -1685,6 +1685,27 @@ compile_eval(char_u *arg, cctx_T *cctx)
 }
 
 /*
+ * 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)".
  */
     char_u *