diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-02-22 18:36:32 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-02-22 18:36:32 +0100 |
commit | 0c6ceaf90389b41545d803458c4813013811c756 (patch) | |
tree | 885e0983a420271d5d98b58e7669252d972f8bd5 /src/ex_docmd.c | |
parent | 8b430b4c1df74bde757a7e5ee0ee2854fdad6472 (diff) | |
download | vim-git-0c6ceaf90389b41545d803458c4813013811c756.tar.gz |
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.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 511e8c5de..70c0da2f0 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] == ':' |