diff src/vim9cmds.c @ 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 d1c04b4dc60d
children 42a6345b91fd
line wrap: on
line diff
--- 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 *