0
0
mirror of https://github.com/vim/vim.git synced 2025-09-29 04:34:16 -04:00

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

@@ -6369,6 +6369,17 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
{
int instr_count = -1;
if (var_start[0] == '_' && !eval_isnamec(var_start[1]))
{
// Ignore underscore in "[a, _, b] = list".
if (var_count > 0)
{
var_start = skipwhite(var_start + 2);
continue;
}
emsg(_(e_cannot_use_underscore_here));
goto theend;
}
vim_free(lhs.lhs_name);
/*
@@ -6388,11 +6399,6 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
semsg(_(e_cannot_assign_to_constant), lhs.lhs_name);
goto theend;
}
if (is_decl && lhs.lhs_name[0] == '_' && lhs.lhs_name[1] == NUL)
{
emsg(_(e_cannot_use_underscore_here));
goto theend;
}
if (!heredoc)
{