mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
patch 8.2.1667: local function name cannot shadow a global function name
Problem: Local function name cannot shadow a global function name. Solution: Ignore global functions when checking a script-local or scoped function name. (closes #6926)
This commit is contained in:
@@ -874,6 +874,15 @@ find_func(char_u *name, int is_global, cctx_T *cctx)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return TRUE if "ufunc" is a global function.
|
||||
*/
|
||||
int
|
||||
func_is_global(ufunc_T *ufunc)
|
||||
{
|
||||
return ufunc->uf_name[0] != K_SPECIAL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Copy the function name of "fp" to buffer "buf".
|
||||
* "buf" must be able to hold the function name plus three bytes.
|
||||
@@ -882,7 +891,7 @@ find_func(char_u *name, int is_global, cctx_T *cctx)
|
||||
static void
|
||||
cat_func_name(char_u *buf, ufunc_T *fp)
|
||||
{
|
||||
if (fp->uf_name[0] == K_SPECIAL)
|
||||
if (!func_is_global(fp))
|
||||
{
|
||||
STRCPY(buf, "<SNR>");
|
||||
STRCAT(buf, fp->uf_name + 3);
|
||||
|
Reference in New Issue
Block a user