0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.2.1351: Vim9: no proper error if using namespace for nested function

Problem:    Vim9: no proper error if using namespace for nested function.
Solution:   Specifically check for a namespace. (closes #6582)
This commit is contained in:
Bram Moolenaar
2020-08-01 22:35:13 +02:00
parent b9a2cac3ef
commit bcbf41395f
3 changed files with 11 additions and 1 deletions

View File

@@ -4899,12 +4899,18 @@ compile_nested_function(exarg_T *eap, cctx_T *cctx)
{
int is_global = *eap->arg == 'g' && eap->arg[1] == ':';
char_u *name_start = eap->arg;
char_u *name_end = to_name_end(eap->arg, is_global);
char_u *name_end = to_name_end(eap->arg, TRUE);
char_u *lambda_name;
lvar_T *lvar;
ufunc_T *ufunc;
int r;
// Only g:Func() can use a namespace.
if (name_start[1] == ':' && !is_global)
{
semsg(_(e_namespace), name_start);
return NULL;
}
if (check_defined(name_start, name_end - name_start, cctx) == FAIL)
return NULL;