mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
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)
This commit is contained in:
@@ -1796,6 +1796,29 @@ def Test_import_compile_error()
|
|||||||
delete('Ximport.vim')
|
delete('Ximport.vim')
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
|
def Test_func_redefine_error()
|
||||||
|
let lines = [
|
||||||
|
'vim9script',
|
||||||
|
'def Func()',
|
||||||
|
' eval [][0]',
|
||||||
|
'enddef',
|
||||||
|
'Func()',
|
||||||
|
]
|
||||||
|
writefile(lines, 'Xtestscript.vim')
|
||||||
|
|
||||||
|
for count in range(3)
|
||||||
|
try
|
||||||
|
source Xtestscript.vim
|
||||||
|
catch /E684/
|
||||||
|
# function name should contain <SNR> every time
|
||||||
|
assert_match('E684: list index out of range', v:exception)
|
||||||
|
assert_match('function <SNR>\d\+_Func, line 1', v:throwpoint)
|
||||||
|
endtry
|
||||||
|
endfor
|
||||||
|
|
||||||
|
delete('Xtestscript.vim')
|
||||||
|
enddef
|
||||||
|
|
||||||
def Test_func_overrules_import_fails()
|
def Test_func_overrules_import_fails()
|
||||||
let export_lines =<< trim END
|
let export_lines =<< trim END
|
||||||
vim9script
|
vim9script
|
||||||
|
@@ -1090,7 +1090,6 @@ func_clear_items(ufunc_T *fp)
|
|||||||
ga_clear_strings(&(fp->uf_args));
|
ga_clear_strings(&(fp->uf_args));
|
||||||
ga_clear_strings(&(fp->uf_def_args));
|
ga_clear_strings(&(fp->uf_def_args));
|
||||||
ga_clear_strings(&(fp->uf_lines));
|
ga_clear_strings(&(fp->uf_lines));
|
||||||
VIM_CLEAR(fp->uf_name_exp);
|
|
||||||
VIM_CLEAR(fp->uf_arg_types);
|
VIM_CLEAR(fp->uf_arg_types);
|
||||||
VIM_CLEAR(fp->uf_def_arg_idx);
|
VIM_CLEAR(fp->uf_def_arg_idx);
|
||||||
VIM_CLEAR(fp->uf_va_name);
|
VIM_CLEAR(fp->uf_va_name);
|
||||||
@@ -1146,7 +1145,10 @@ func_free(ufunc_T *fp, int force)
|
|||||||
func_remove(fp);
|
func_remove(fp);
|
||||||
|
|
||||||
if ((fp->uf_flags & FC_DEAD) == 0 || force)
|
if ((fp->uf_flags & FC_DEAD) == 0 || force)
|
||||||
|
{
|
||||||
|
VIM_CLEAR(fp->uf_name_exp);
|
||||||
vim_free(fp);
|
vim_free(fp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -754,6 +754,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1445,
|
||||||
/**/
|
/**/
|
||||||
1444,
|
1444,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user