patch 9.0.0406: deferred functions not invoked when partial func exits
Problem: Deferred functions not invoked when partial func exits.
Solution: Create a funccall_T when calling a :def function.
diff --git a/src/eval.c b/src/eval.c
index c4d3781..9891473 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -263,10 +263,17 @@
if (partial->pt_func != NULL
&& partial->pt_func->uf_def_status != UF_NOT_COMPILED)
{
+ funccall_T *fc = create_funccal(partial->pt_func, rettv);
+ int r;
+
+ if (fc == NULL)
+ return FAIL;
+
// Shortcut to call a compiled function without overhead.
- // FIXME: should create a funccal and link it in current_funccal.
- if (call_def_function(partial->pt_func, argc, argv,
- DEF_USE_PT_ARGV, partial, NULL, rettv) == FAIL)
+ r = call_def_function(partial->pt_func, argc, argv,
+ DEF_USE_PT_ARGV, partial, fc, rettv);
+ remove_funccal();
+ if (r == FAIL)
return FAIL;
}
else