comparison src/vim9compile.c @ 27348:9a9c34c84cd4 v8.2.4202

patch 8.2.4202: Vim9: cannot export function that exists globally Commit: https://github.com/vim/vim/commit/acc4b5648b49ec13c4f35ee0bf552eda71b0c372 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Jan 24 13:54:45 2022 +0000 patch 8.2.4202: Vim9: cannot export function that exists globally Problem: Vim9: cannot export function that exists globally. Solution: When checking if a function already exists only check for script-local functions. (closes #9615)
author Bram Moolenaar <Bram@vim.org>
date Mon, 24 Jan 2022 15:00:04 +0100
parents f7cb41ff22a4
children 1aff400b819e
comparison
equal deleted inserted replaced
27347:b43f497a7e4b 27348:9a9c34c84cd4
330 p[len] = NUL; 330 p[len] = NUL;
331 if ((cctx != NULL 331 if ((cctx != NULL
332 && (lookup_local(p, len, NULL, cctx) == OK 332 && (lookup_local(p, len, NULL, cctx) == OK
333 || arg_exists(p, len, NULL, NULL, NULL, cctx) == OK)) 333 || arg_exists(p, len, NULL, NULL, NULL, cctx) == OK))
334 || find_imported(p, len, FALSE, cctx) != NULL 334 || find_imported(p, len, FALSE, cctx) != NULL
335 || (ufunc = find_func_even_dead(p, FALSE)) != NULL) 335 || (ufunc = find_func_even_dead(p, 0)) != NULL)
336 { 336 {
337 // A local or script-local function can shadow a global function. 337 // A local or script-local function can shadow a global function.
338 if (ufunc == NULL || ((ufunc->uf_flags & FC_DEAD) == 0 338 if (ufunc == NULL || ((ufunc->uf_flags & FC_DEAD) == 0
339 && (!func_is_global(ufunc) 339 && (!func_is_global(ufunc)
340 || (p[0] == 'g' && p[1] == ':')))) 340 || (p[0] == 'g' && p[1] == ':'))))