0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.2.2540: Vim9: no error for using script var name for argument

Problem:    Vim9: no error for using script var name for argument.
Solution:   Check for this error. (closes #7868)
This commit is contained in:
Bram Moolenaar
2021-02-21 22:20:24 +01:00
parent 7e82c5f338
commit b4893b8450
5 changed files with 21 additions and 1 deletions

View File

@@ -80,6 +80,14 @@ one_function_arg(
semsg(_("E125: Illegal argument: %s"), arg);
return arg;
}
// Vim9 script: cannot use script var name for argument.
if (argtypes != NULL && script_var_exists(arg, p - arg, FALSE, NULL) == OK)
{
semsg(_(e_variable_already_declared_in_script), arg);
return arg;
}
if (newargs != NULL && ga_grow(newargs, 1) == FAIL)
return arg;
if (newargs != NULL)