Problem: Vim9: error when sourcing script twice and reusing a function
name.
Solution: Check if the function is dead. (closes #8463)
delete('XExportReload')
delfunc g:Values
unlet g:loadCount
+
+ lines =<< trim END
+ vim9script
+ def Inner()
+ enddef
+ END
+ lines->writefile('XreloadScript.vim')
+ source XreloadScript.vim
+
+ lines =<< trim END
+ vim9script
+ def Outer()
+ def Inner()
+ enddef
+ enddef
+ defcompile
+ END
+ lines->writefile('XreloadScript.vim')
+ source XreloadScript.vim
+
+ delete('XreloadScript.vim')
enddef
def Test_vim9script_reload_import()
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 3065,
/**/
3064,
/**/
|| (ufunc = find_func_even_dead(p, FALSE, cctx)) != NULL)
{
// A local or script-local function can shadow a global function.
- if (ufunc == NULL || !func_is_global(ufunc)
- || (p[0] == 'g' && p[1] == ':'))
+ if (ufunc == NULL || ((ufunc->uf_flags & FC_DEAD) == 0
+ && (!func_is_global(ufunc)
+ || (p[0] == 'g' && p[1] == ':'))))
{
if (is_arg)
semsg(_(e_argument_name_shadows_existing_variable_str), p);