0
0
mirror of https://github.com/vim/vim.git synced 2025-09-29 04:34:16 -04:00

patch 8.2.0298: Vim9 script: cannot start command with a string constant

Problem:    Vim9 script: cannot start command with a string constant.
Solution:   Recognize expression starting with '('.
This commit is contained in:
Bram Moolenaar
2020-02-22 18:36:32 +01:00
parent 8b430b4c1d
commit 0c6ceaf903
5 changed files with 17 additions and 17 deletions

View File

@@ -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] == ':'