comparison 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
comparison
equal deleted inserted replaced
21790:75be6f383577 21791:d504fcd3d2c0
1088 func_clear_items(ufunc_T *fp) 1088 func_clear_items(ufunc_T *fp)
1089 { 1089 {
1090 ga_clear_strings(&(fp->uf_args)); 1090 ga_clear_strings(&(fp->uf_args));
1091 ga_clear_strings(&(fp->uf_def_args)); 1091 ga_clear_strings(&(fp->uf_def_args));
1092 ga_clear_strings(&(fp->uf_lines)); 1092 ga_clear_strings(&(fp->uf_lines));
1093 VIM_CLEAR(fp->uf_name_exp);
1094 VIM_CLEAR(fp->uf_arg_types); 1093 VIM_CLEAR(fp->uf_arg_types);
1095 VIM_CLEAR(fp->uf_def_arg_idx); 1094 VIM_CLEAR(fp->uf_def_arg_idx);
1096 VIM_CLEAR(fp->uf_va_name); 1095 VIM_CLEAR(fp->uf_va_name);
1097 clear_type_list(&fp->uf_type_list); 1096 clear_type_list(&fp->uf_type_list);
1098 1097
1144 // version of the function with the same name. 1143 // version of the function with the same name.
1145 if ((fp->uf_flags & (FC_DELETED | FC_REMOVED)) == 0) 1144 if ((fp->uf_flags & (FC_DELETED | FC_REMOVED)) == 0)
1146 func_remove(fp); 1145 func_remove(fp);
1147 1146
1148 if ((fp->uf_flags & FC_DEAD) == 0 || force) 1147 if ((fp->uf_flags & FC_DEAD) == 0 || force)
1148 {
1149 VIM_CLEAR(fp->uf_name_exp);
1149 vim_free(fp); 1150 vim_free(fp);
1151 }
1150 } 1152 }
1151 1153
1152 /* 1154 /*
1153 * Free all things that a function contains and free the function itself. 1155 * Free all things that a function contains and free the function itself.
1154 * When "force" is TRUE we are exiting. 1156 * When "force" is TRUE we are exiting.