0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.2.2750: Vim9: error for using underscore in nested function

Problem:    Vim9: error for using underscore in nested function.
Solution:   Do not consider "_" already defined. (closes #8096)
This commit is contained in:
Bram Moolenaar
2021-04-10 21:01:38 +02:00
parent fe95b94ffa
commit da479c7597
3 changed files with 8 additions and 0 deletions

View File

@@ -2637,6 +2637,8 @@ def Test_ignored_argument()
return _
endfunc
assert_equal('too', Oktoo())
assert_equal([[1], [2], [3]], range(3)->mapnew((_, v) => [v]->map((_, w) => w + 1)))
END
CheckScriptSuccess(lines)

View File

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

View File

@@ -422,6 +422,10 @@ check_defined(char_u *p, size_t len, cctx_T *cctx, int is_arg)
int c = p[len];
ufunc_T *ufunc = NULL;
// underscore argument is OK
if (len == 1 && *p == '_')
return OK;
if (script_var_exists(p, len, cctx) == OK)
{
if (is_arg)