0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 8.2.4123: complete function cannot be import.Name

Problem:    Complete function cannot be import.Name.
Solution:   Dereference the function name if needed.  Also: do not see
            "import.Name" as a builtin function. (closes #9541)
This commit is contained in:
Bram Moolenaar
2022-01-17 20:09:08 +00:00
parent 3f3597be3f
commit 15d1635e50
4 changed files with 114 additions and 49 deletions

View File

@@ -3119,18 +3119,30 @@ free_all_functions(void)
/*
* Return TRUE if "name" looks like a builtin function name: starts with a
* lower case letter and doesn't contain AUTOLOAD_CHAR or ':'.
* lower case letter, doesn't contain AUTOLOAD_CHAR or ':', no "." after the
* name.
* "len" is the length of "name", or -1 for NUL terminated.
*/
int
builtin_function(char_u *name, int len)
{
char_u *p;
int i;
if (!ASCII_ISLOWER(name[0]) || name[1] == ':')
return FALSE;
p = vim_strchr(name, AUTOLOAD_CHAR);
return p == NULL || (len > 0 && p > name + len);
for (i = 0; name[i] != NUL && (len < 0 || i < len); ++i)
{
if (name[i] == AUTOLOAD_CHAR)
return FALSE;
if (!eval_isnamec(name[i]))
{
// "name.something" is not a builtin function
if (name[i] == '.')
return FALSE;
break;
}
}
return TRUE;
}
int