comparison src/vim9compile.c @ 25057:ffc3e1164652 v8.2.3065

patch 8.2.3065: Vim9: error when sourcing script twice and reusing function Commit: https://github.com/vim/vim/commit/577dc93da9ec78684576bff71328d40f24bd6dd8 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jun 27 15:35:40 2021 +0200 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)
author Bram Moolenaar <Bram@vim.org>
date Sun, 27 Jun 2021 15:45:03 +0200
parents 8d660d1cca8d
children 671ded1facd5
comparison
equal deleted inserted replaced
25056:43593a5d873f 25057:ffc3e1164652
496 || arg_exists(p, len, NULL, NULL, NULL, cctx) == OK)) 496 || arg_exists(p, len, NULL, NULL, NULL, cctx) == OK))
497 || find_imported(p, len, cctx) != NULL 497 || find_imported(p, len, cctx) != NULL
498 || (ufunc = find_func_even_dead(p, FALSE, cctx)) != NULL) 498 || (ufunc = find_func_even_dead(p, FALSE, cctx)) != NULL)
499 { 499 {
500 // A local or script-local function can shadow a global function. 500 // A local or script-local function can shadow a global function.
501 if (ufunc == NULL || !func_is_global(ufunc) 501 if (ufunc == NULL || ((ufunc->uf_flags & FC_DEAD) == 0
502 || (p[0] == 'g' && p[1] == ':')) 502 && (!func_is_global(ufunc)
503 || (p[0] == 'g' && p[1] == ':'))))
503 { 504 {
504 if (is_arg) 505 if (is_arg)
505 semsg(_(e_argument_name_shadows_existing_variable_str), p); 506 semsg(_(e_argument_name_shadows_existing_variable_str), p);
506 else 507 else
507 semsg(_(e_name_already_defined_str), p); 508 semsg(_(e_name_already_defined_str), p);