diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-04-10 22:35:43 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-04-10 22:35:43 +0200 |
commit | f93bbd026205f36915312193784f987ad49fb114 (patch) | |
tree | 3d33a10b9e526aa7ed613bb4113df3406025632a /src/evalvars.c | |
parent | e8e307818495d1a5d821df9bd4bde83add0520e5 (diff) |
patch 8.2.2753: Vim9: cannot ignore an item in assignment unpackv8.2.2753
Problem: Vim9: cannot ignore an item in assignment unpack.
Solution: Allow using an underscore.
Diffstat (limited to 'src/evalvars.c')
-rw-r--r-- | src/evalvars.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/evalvars.c b/src/evalvars.c index 5869a82a61..b8a4352f8a 100644 --- a/src/evalvars.c +++ b/src/evalvars.c @@ -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), <v, FALSE, flags, - (char_u *)"]", op, var_idx); + arg = ex_let_one(skipwhite(arg + 1), <v, FALSE, + flags | ASSIGN_UNPACK, (char_u *)"]", op, var_idx); clear_tv(<v); 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; } |