diff src/userfunc.c @ 33568:4db948057fa6 v9.0.2029

patch 9.0.2029: Vim9: no support for partials using call() Commit: https://github.com/vim/vim/commit/1ace49fb98fa93e2fcff421a5f7da1aa41c512ed Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Sun Oct 15 09:53:41 2023 +0200 patch 9.0.2029: Vim9: no support for partials using call() Problem: Vim9: no support for partials using call() Solution: Add support closes: #13341 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
author Christian Brabandt <cb@256bit.org>
date Sun, 15 Oct 2023 10:00:05 +0200
parents 7c9124711f99
children 28c2f681ec33
line wrap: on
line diff
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -3540,6 +3540,12 @@ func_call(
 	funcexe.fe_lastline = curwin->w_cursor.lnum;
 	funcexe.fe_evaluate = TRUE;
 	funcexe.fe_partial = partial;
+	if (partial != NULL)
+	{
+	    funcexe.fe_object = partial->pt_obj;
+	    if (funcexe.fe_object != NULL)
+		++funcexe.fe_object->obj_refcount;
+	}
 	funcexe.fe_selfdict = selfdict;
 	r = call_func(name, -1, rettv, argc, argv, &funcexe);
     }
@@ -3580,6 +3586,12 @@ call_callback(
     CLEAR_FIELD(funcexe);
     funcexe.fe_evaluate = TRUE;
     funcexe.fe_partial = callback->cb_partial;
+    if (callback->cb_partial != NULL)
+    {
+	funcexe.fe_object = callback->cb_partial->pt_obj;
+	if (funcexe.fe_object != NULL)
+	    ++funcexe.fe_object->obj_refcount;
+    }
     ++callback_depth;
     ret = call_func(callback->cb_name, len, rettv, argcount, argvars, &funcexe);
     --callback_depth;