Patch 8.2.1445
Problem: Vim9: function expanded name is cleared when sourcing a script
again.
Solution: Only clear the expanded name when deleting the function.
(closes #6707)
Files: src/userfunc.c, src/testdir/test_vim9_script.vim
*** ../vim-8.2.1444/src/userfunc.c 2020-08-13 22:47:20.373992741 +0200
--- src/userfunc.c 2020-08-14 17:07:34.001093017 +0200
***************
*** 1090,1096 ****
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);
--- 1090,1095 ----
***************
*** 1146,1152 ****
--- 1145,1154 ----
func_remove(fp);
if ((fp->uf_flags & FC_DEAD) == 0 || force)
+ {
+ VIM_CLEAR(fp->uf_name_exp);
vim_free(fp);
+ }
}
/*
*** ../vim-8.2.1444/src/testdir/test_vim9_script.vim 2020-08-12 22:18:19.121805947 +0200
--- src/testdir/test_vim9_script.vim 2020-08-14 17:04:07.442368556 +0200
***************
*** 1796,1801 ****
--- 1796,1824 ----
delete('Ximport.vim')
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()
let export_lines =<< trim END
vim9script
*** ../vim-8.2.1444/src/version.c 2020-08-13 22:47:20.377992734 +0200
--- src/version.c 2020-08-14 16:58:24.208524216 +0200
***************
*** 756,757 ****
--- 756,759 ----
{ /* Add new patch number below this line */
+ /**/
+ 1445,
/**/
--
Some of the well known MS-Windows errors:
EMEMORY Memory error caused by..., eh...
ELICENSE Your license has expired, give us more money!
EMOUSE Mouse moved, reinstall Windows
EILLEGAL Illegal error, you are not allowed to see this
EVIRUS Undetectable virus found
/// Bram Moolenaar -- Br...@Moolenaar.net --
http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language --
http://www.Zimbu.org ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///