comparison src/vim9compile.c @ 21602:7028f45bf0ea v8.2.1351

patch 8.2.1351: Vim9: no proper error if using namespace for nested function Commit: https://github.com/vim/vim/commit/bcbf41395f93aabd577a17dc4fbabe523d0a7ce8 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Aug 1 22:35:13 2020 +0200 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 https://github.com/vim/vim/issues/6582)
author Bram Moolenaar <Bram@vim.org>
date Sat, 01 Aug 2020 22:45:03 +0200
parents 7b5b9558500a
children d9c45474cac1
comparison
equal deleted inserted replaced
21601:4f4faadeaa2a 21602:7028f45bf0ea
4897 static char_u * 4897 static char_u *
4898 compile_nested_function(exarg_T *eap, cctx_T *cctx) 4898 compile_nested_function(exarg_T *eap, cctx_T *cctx)
4899 { 4899 {
4900 int is_global = *eap->arg == 'g' && eap->arg[1] == ':'; 4900 int is_global = *eap->arg == 'g' && eap->arg[1] == ':';
4901 char_u *name_start = eap->arg; 4901 char_u *name_start = eap->arg;
4902 char_u *name_end = to_name_end(eap->arg, is_global); 4902 char_u *name_end = to_name_end(eap->arg, TRUE);
4903 char_u *lambda_name; 4903 char_u *lambda_name;
4904 lvar_T *lvar; 4904 lvar_T *lvar;
4905 ufunc_T *ufunc; 4905 ufunc_T *ufunc;
4906 int r; 4906 int r;
4907 4907
4908 // Only g:Func() can use a namespace.
4909 if (name_start[1] == ':' && !is_global)
4910 {
4911 semsg(_(e_namespace), name_start);
4912 return NULL;
4913 }
4908 if (check_defined(name_start, name_end - name_start, cctx) == FAIL) 4914 if (check_defined(name_start, name_end - name_start, cctx) == FAIL)
4909 return NULL; 4915 return NULL;
4910 4916
4911 eap->arg = name_end; 4917 eap->arg = name_end;
4912 eap->getline = exarg_getline; 4918 eap->getline = exarg_getline;