diff src/userfunc.c @ 21791:d504fcd3d2c0 v8.2.1445

patch 8.2.1445: Vim9: function expanded name is cleared when sourcing again Commit: https://github.com/vim/vim/commit/c4ce36d48698669f81ec90f7c9dc9ab8c362e538 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Aug 14 17:08:15 2020 +0200 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 #6707)
author Bram Moolenaar <Bram@vim.org>
date Fri, 14 Aug 2020 17:15:04 +0200
parents f84625b961a8
children 0deb6f96a5a3
line wrap: on
line diff
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -1090,7 +1090,6 @@ 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));
-    VIM_CLEAR(fp->uf_name_exp);
     VIM_CLEAR(fp->uf_arg_types);
     VIM_CLEAR(fp->uf_def_arg_idx);
     VIM_CLEAR(fp->uf_va_name);
@@ -1146,7 +1145,10 @@ func_free(ufunc_T *fp, int force)
 	func_remove(fp);
 
     if ((fp->uf_flags & FC_DEAD) == 0 || force)
+    {
+	VIM_CLEAR(fp->uf_name_exp);
 	vim_free(fp);
+    }
 }
 
 /*