summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-04-10 17:46:52 +0200
committerBram Moolenaar <Bram@vim.org>2021-04-10 17:46:52 +0200
commit51e7e78de7320a734ddc2d7931e767bccaf7e6f2 (patch)
tree0b3cfa46020544f0a1b9eaeac464c518cfa42b61
parent962c43bf0d6a33b905f2acd920d3701476ebb5c9 (diff)
downloadvim-git-8.2.2745.tar.gz
patch 8.2.2745: Vim9: missing part of the argument changev8.2.2745
Problem: Vim9: missing part of the argument change. Solution: Add missing changes.
-rw-r--r--src/userfunc.c24
-rw-r--r--src/version.c2
2 files changed, 15 insertions, 11 deletions
diff --git a/src/userfunc.c b/src/userfunc.c
index 8d06b4916..018542681 100644
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -55,7 +55,7 @@ func_tbl_get(void)
/*
* Get one function argument.
- * If "argtypes" is not NULL also get the type: "arg: type".
+ * If "argtypes" is not NULL also get the type: "arg: type" (:def function).
* If "types_optional" is TRUE a missing type is OK, use "any".
* If "evalarg" is not NULL use it to check for an already declared name.
* Return a pointer to after the type.
@@ -73,6 +73,7 @@ one_function_arg(
{
char_u *p = arg;
char_u *arg_copy = NULL;
+ int is_underscore = FALSE;
while (ASCII_ISALNUM(*p) || *p == '_')
++p;
@@ -107,15 +108,16 @@ one_function_arg(
*p = c;
return arg;
}
-
- // Check for duplicate argument name.
- for (i = 0; i < newargs->ga_len; ++i)
- if (STRCMP(((char_u **)(newargs->ga_data))[i], arg_copy) == 0)
- {
- semsg(_("E853: Duplicate argument name: %s"), arg_copy);
- vim_free(arg_copy);
- return arg;
- }
+ is_underscore = arg_copy[0] == '_' && arg_copy[1] == NUL;
+ if (argtypes != NULL && !is_underscore)
+ // Check for duplicate argument name.
+ for (i = 0; i < newargs->ga_len; ++i)
+ if (STRCMP(((char_u **)(newargs->ga_data))[i], arg_copy) == 0)
+ {
+ semsg(_("E853: Duplicate argument name: %s"), arg_copy);
+ vim_free(arg_copy);
+ return arg;
+ }
((char_u **)(newargs->ga_data))[newargs->ga_len] = arg_copy;
newargs->ga_len++;
@@ -146,7 +148,7 @@ one_function_arg(
if (!skip)
type = vim_strnsave(type, p - type);
}
- else if (*skipwhite(p) != '=' && !types_optional)
+ else if (*skipwhite(p) != '=' && !types_optional && !is_underscore)
{
semsg(_(e_missing_argument_type_for_str),
arg_copy == NULL ? arg : arg_copy);
diff --git a/src/version.c b/src/version.c
index d5a9dc796..346b5d1f0 100644
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 2745,
+/**/
2744,
/**/
2743,