summaryrefslogtreecommitdiffstats
path: root/src/ex_docmd.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-07-20 22:37:44 +0200
committerBram Moolenaar <Bram@vim.org>2020-07-20 22:37:44 +0200
commitb31be3f909e074214b7f346888209c866faed56f (patch)
tree969254b6cb1430581c64b8b15f0ba29a2bd5595f /src/ex_docmd.c
parent7892b953e0e496408008434ae3505293c0c93af1 (diff)
patch 8.2.1257: Vim9: list unpack doesn't work at the script levelv8.2.1257
Problem: Vim9: list unpack doesn't work at the script level. Solution: Detect unpack assignment better. (closes #6494)
Diffstat (limited to 'src/ex_docmd.c')
-rw-r--r--src/ex_docmd.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 91a51681af..db1df0d726 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -3282,10 +3282,19 @@ find_ex_command(
// after the "]" by to_name_const_end(): check if a "=" follows.
// If "[...]" has a line break "p" still points at the "[" and it can't
// be an assignment.
- if (*eap->cmd == '[' && (p == eap->cmd || *skipwhite(p) != '='))
+ if (*eap->cmd == '[')
{
- eap->cmdidx = CMD_eval;
- return eap->cmd;
+ p = to_name_const_end(eap->cmd);
+ if (p == eap->cmd || *skipwhite(p) != '=')
+ {
+ eap->cmdidx = CMD_eval;
+ return eap->cmd;
+ }
+ if (p > eap->cmd && *skipwhite(p) == '=')
+ {
+ eap->cmdidx = CMD_let;
+ return eap->cmd;
+ }
}
// Recognize an assignment if we recognize the variable name: