1
0
forked from aniani/vim

patch 8.2.2753: Vim9: cannot ignore an item in assignment unpack

Problem:    Vim9: cannot ignore an item in assignment unpack.
Solution:   Allow using an underscore.
This commit is contained in:
Bram Moolenaar
2021-04-10 22:35:43 +02:00
parent e8e3078184
commit f93bbd0262
7 changed files with 46 additions and 22 deletions

View File

@@ -970,8 +970,8 @@ ex_let_vars(
{
arg = skipwhite(arg + 1);
++var_idx;
arg = ex_let_one(arg, &item->li_tv, TRUE, flags, (char_u *)",;]",
op, var_idx);
arg = ex_let_one(arg, &item->li_tv, TRUE,
flags | ASSIGN_UNPACK, (char_u *)",;]", op, var_idx);
item = item->li_next;
if (arg == NULL)
return FAIL;
@@ -996,8 +996,8 @@ ex_let_vars(
l->lv_refcount = 1;
++var_idx;
arg = ex_let_one(skipwhite(arg + 1), &ltv, FALSE, flags,
(char_u *)"]", op, var_idx);
arg = ex_let_one(skipwhite(arg + 1), &ltv, FALSE,
flags | ASSIGN_UNPACK, (char_u *)"]", op, var_idx);
clear_tv(&ltv);
if (arg == NULL)
return FAIL;
@@ -3190,7 +3190,9 @@ set_var_const(
var_in_vim9script = is_script_local && current_script_is_vim9();
if (var_in_vim9script && name[0] == '_' && name[1] == NUL)
{
emsg(_(e_cannot_use_underscore_here));
// For "[a, _] = list" the underscore is ignored.
if ((flags & ASSIGN_UNPACK) == 0)
emsg(_(e_cannot_use_underscore_here));
goto failed;
}