patch 9.0.2019: Vim9: no support for funcrefs
Problem: Vim9: no support for funcrefs
Solution: Add support for object/class funcref members
closes: #11981 #12417 #12960 #12324 #13333
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
diff --git a/src/eval.c b/src/eval.c
index 4da6246..80ff5a3 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -5256,6 +5256,7 @@
}
else
func_ptr_unref(pt->pt_func);
+ object_unref(pt->pt_obj);
// "out_up" is no longer used, decrement refcount on partial that owns it.
partial_unref(pt->pt_outer.out_up_partial);
@@ -5578,6 +5579,7 @@
/*
* PASS 2: free the items themselves.
*/
+ object_free_items(copyID);
dict_free_items(copyID);
list_free_items(copyID);
@@ -5818,6 +5820,15 @@
set_ref_in_item(&dtv, copyID, ht_stack, list_stack);
}
+ if (pt->pt_obj != NULL)
+ {
+ typval_T objtv;
+
+ objtv.v_type = VAR_OBJECT;
+ objtv.vval.v_object = pt->pt_obj;
+ set_ref_in_item(&objtv, copyID, ht_stack, list_stack);
+ }
+
for (int i = 0; i < pt->pt_argc; ++i)
abort = abort || set_ref_in_item(&pt->pt_argv[i], copyID,
ht_stack, list_stack);