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)

c4ce36d486

Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
zeertzjq 2025-02-03 10:15:09 +08:00
parent 0309d3fbf0
commit cd42740245

View File

@ -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);
}