summaryrefslogtreecommitdiffstats
path: root/src/ex_docmd.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-02-22 18:36:32 +0100
committerBram Moolenaar <Bram@vim.org>2020-02-22 18:36:32 +0100
commit0c6ceaf90389b41545d803458c4813013811c756 (patch)
tree885e0983a420271d5d98b58e7669252d972f8bd5 /src/ex_docmd.c
parent8b430b4c1df74bde757a7e5ee0ee2854fdad6472 (diff)
patch 8.2.0298: Vim9 script: cannot start command with a string constantv8.2.0298
Problem: Vim9 script: cannot start command with a string constant. Solution: Recognize expression starting with '('.
Diffstat (limited to 'src/ex_docmd.c')
-rw-r--r--src/ex_docmd.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 511e8c5dea..70c0da2f03 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -3146,8 +3146,9 @@ find_ex_command(
* Recognize a Vim9 script function/method call and assignment:
* "lvar = value", "lvar(arg)", "[1, 2 3]->Func()"
*/
- if (lookup != NULL && (p = to_name_const_end(eap->cmd)) > eap->cmd
- && *p != NUL)
+ p = eap->cmd;
+ if (lookup != NULL && (*p == '('
+ || ((p = to_name_const_end(eap->cmd)) > eap->cmd && *p != NUL)))
{
int oplen;
int heredoc;
@@ -3156,6 +3157,7 @@ find_ex_command(
// "varname[]" is an expression.
// "g:varname" is an expression.
// "varname->expr" is an expression.
+ // "(..." is an expression.
if (*p == '('
|| *p == '['
|| p[1] == ':'