0
0
mirror of https://github.com/vim/vim.git synced 2025-10-04 05:25:06 -04:00

patch 8.2.2544: Vim9: error for argument when checking for lambda

Problem:    Vim9: error for argument when checking for lambda.
Solution:   Respect the skip flag. (closes #7887)
This commit is contained in:
Bram Moolenaar
2021-02-23 12:05:46 +01:00
parent 9cb577a682
commit bc327ccc3d
3 changed files with 12 additions and 1 deletions

View File

@@ -1922,6 +1922,14 @@ def Test_expr7_lambda()
CheckDefSuccess(['var Fx = (a) => [0,', ' 1]'])
CheckDefFailure(['var Fx = (a) => [0', ' 1]'], 'E696:', 2)
# no error for existing script variable when checking for lambda
lines =<< trim END
vim9script
var name = 0
eval (name + 2) / 3
END
CheckScriptSuccess(lines)
enddef
def NewLambdaWithComments(): func

View File

@@ -82,7 +82,8 @@ one_function_arg(
}
// Vim9 script: cannot use script var name for argument.
if (argtypes != NULL && script_var_exists(arg, p - arg, FALSE, NULL) == OK)
if (!skip && argtypes != NULL && script_var_exists(arg, p - arg,
FALSE, NULL) == OK)
{
semsg(_(e_variable_already_declared_in_script), arg);
return arg;

View File

@@ -750,6 +750,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
2544,
/**/
2543,
/**/