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 '('.
diff --git a/src/vim9compile.c b/src/vim9compile.c
index aeb950c..6408b67 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -4821,22 +4821,11 @@
p = (*ea.cmd == '&' || *ea.cmd == '$' || *ea.cmd == '@')
? ea.cmd + 1 : ea.cmd;
p = to_name_end(p);
- if (p > ea.cmd && *p != NUL)
+ if ((p > ea.cmd && *p != NUL) || *p == '(')
{
int oplen;
int heredoc;
- // "funcname(" is always a function call.
- // "varname[]" is an expression.
- // "varname->expr" is an expression.
- if (*p == '('
- || *p == '['
- || ((p - ea.cmd) > 2 && ea.cmd[1] == ':')
- || (*p == '-' && p[1] == '>'))
- {
- // TODO
- }
-
oplen = assignment_len(skipwhite(p), &heredoc);
if (oplen > 0)
{