0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

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.
This commit is contained in:
Bram Moolenaar
2022-09-07 17:28:09 +01:00
parent c9c967da09
commit 9667b2c888
5 changed files with 73 additions and 11 deletions

View File

@@ -263,10 +263,17 @@ eval_expr_typval(typval_T *expr, typval_T *argv, int argc, typval_T *rettv)
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