0
0
mirror of https://github.com/vim/vim.git synced 2025-09-26 04:04:07 -04:00

patch 8.2.4460: Vim9: wrong error for defining dict function

Problem:    Vim9: wrong error for defining dict function.
Solution:   Explicitly check for trying to define a dict function.
            (closes 9827)
This commit is contained in:
Bram Moolenaar
2022-02-23 22:12:02 +00:00
parent fa02616718
commit dea5ab0fc5
5 changed files with 80 additions and 5 deletions

View File

@@ -4268,10 +4268,21 @@ define_function(exarg_T *eap, char_u *name_arg, garray_T *lines_to_free)
}
else
{
if (vim9script && p[0] == 's' && p[1] == ':')
if (vim9script)
{
semsg(_(e_cannot_use_s_colon_in_vim9_script_str), p);
return NULL;
if (p[0] == 's' && p[1] == ':')
{
semsg(_(e_cannot_use_s_colon_in_vim9_script_str), p);
return NULL;
}
p = to_name_end(p, TRUE);
if (*skipwhite(p) == '.' && vim_strchr(p, '(') != NULL)
{
semsg(_(e_cannot_define_dict_func_in_vim9_script_str),
eap->arg);
return NULL;
}
p = eap->arg;
}
name = save_function_name(&p, &is_global, eap->skip,