mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
patch 8.2.3065: Vim9: error when sourcing script twice and reusing function
Problem: Vim9: error when sourcing script twice and reusing a function name. Solution: Check if the function is dead. (closes #8463)
This commit is contained in:
@@ -498,8 +498,9 @@ check_defined(char_u *p, size_t len, cctx_T *cctx, int is_arg)
|
||||
|| (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);
|
||||
|
Reference in New Issue
Block a user