summaryrefslogtreecommitdiff
path: root/src/userfunc.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-02-23 22:12:02 +0000
committerBram Moolenaar <Bram@vim.org>2022-02-23 22:12:02 +0000
commitdea5ab0fc5bb51105078d5349f987496b1aa8d6f (patch)
tree9effcbd78f12bdfe98b081b3507dd08c5843ec9a /src/userfunc.c
parentfa02616718103be3f9e13e26d57905d4eddf836d (diff)
downloadvim-git-dea5ab0fc5bb51105078d5349f987496b1aa8d6f.tar.gz
patch 8.2.4460: Vim9: wrong error for defining dict functionv8.2.4460
Problem: Vim9: wrong error for defining dict function. Solution: Explicitly check for trying to define a dict function. (closes 9827)
Diffstat (limited to 'src/userfunc.c')
-rw-r--r--src/userfunc.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/userfunc.c b/src/userfunc.c
index 3a66d2732..ed2fb8668 100644
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -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,