]> granicus.if.org Git - vim/commitdiff
patch 8.2.1683: Vim9: assignment test fails v8.2.1683
authorBram Moolenaar <Bram@vim.org>
Mon, 14 Sep 2020 16:35:18 +0000 (18:35 +0200)
committerBram Moolenaar <Bram@vim.org>
Mon, 14 Sep 2020 16:35:18 +0000 (18:35 +0200)
Problem:    Vim9: assignment test fails.
Solution:   Include changes to find Ex command.

src/ex_docmd.c
src/version.c

index ed52b464bee7f2b8e970f633ba3ff212b4e47f14..bc01b69c7759af1cde94cc621a135a181361cfad 100644 (file)
@@ -3224,19 +3224,33 @@ find_ex_command(
                            // "g:varname" is an expression.
                         || eap->cmd[1] == ':'
                            )
-                       : (
-                           // "varname[]" is an expression.
-                           *p == '['
                            // "varname->func()" is an expression.
-                        || (*p == '-' && p[1] == '>')
-                           // "varname.expr" is an expression.
-                        || (*p == '.' && ASCII_ISALPHA(p[1]))
-                        )))
+                       : (*p == '-' && p[1] == '>')))
            {
                eap->cmdidx = CMD_eval;
                return eap->cmd;
            }
 
+           if (p != eap->cmd && (
+                           // "varname[]" is an expression.
+                           *p == '['
+                           // "varname.key" is an expression.
+                        || (*p == '.' && ASCII_ISALPHA(p[1]))))
+           {
+               char_u  *after = p;
+
+               // When followed by "=" or "+=" then it is an assignment.
+               ++emsg_silent;
+               if (skip_expr(&after) == OK
+                                 && (*after == '='
+                                     || (*after != NUL && after[1] == '=')))
+                   eap->cmdidx = CMD_let;
+               else
+                   eap->cmdidx = CMD_eval;
+               --emsg_silent;
+               return eap->cmd;
+           }
+
            // "[...]->Method()" is a list expression, but "[a, b] = Func()" is
            // an assignment.
            // If there is no line break inside the "[...]" then "p" is
index d5996e9571fe46a1aa176c7df10467da921620b4..1b05536d4d682d3a6656830608b051cdb7fb6155 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1683,
 /**/
     1682,
 /**/