commit cd42740245b5dd25ef9c7e116656d6da630f5db0
parent 0309d3fbf0edc5ac958964f85dff76719340c4c7
Author: zeertzjq <zeertzjq@outlook.com>
Date: Mon, 3 Feb 2025 10:15:09 +0800
vim-patch:8.2.1445: Vim9: function expanded name is cleared when sourcing again
Problem: Vim9: function expanded name is cleared when sourcing a script
again.
Solution: Only clear the expanded name when deleting the function.
(closes vim/vim#6707)
https://github.com/vim/vim/commit/c4ce36d48698669f81ec90f7c9dc9ab8c362e538
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/nvim/eval/userfunc.c b/src/nvim/eval/userfunc.c
@@ -891,7 +891,6 @@ static void func_clear_items(ufunc_T *fp)
ga_clear_strings(&(fp->uf_args));
ga_clear_strings(&(fp->uf_def_args));
ga_clear_strings(&(fp->uf_lines));
- XFREE_CLEAR(fp->uf_name_exp);
if (fp->uf_flags & FC_LUAREF) {
api_free_luaref(fp->uf_luaref);
@@ -930,6 +929,8 @@ static void func_free(ufunc_T *fp)
if ((fp->uf_flags & (FC_DELETED | FC_REMOVED)) == 0) {
func_remove(fp);
}
+
+ XFREE_CLEAR(fp->uf_name_exp);
xfree(fp);
}