summaryrefslogtreecommitdiff
path: root/src/vim9compile.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/vim9compile.c
parent8b430b4c1df74bde757a7e5ee0ee2854fdad6472 (diff)
downloadvim-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/vim9compile.c')
-rw-r--r--src/vim9compile.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/src/vim9compile.c b/src/vim9compile.c
index aeb950ca6..6408b67bf 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -4821,22 +4821,11 @@ compile_def_function(ufunc_T *ufunc, int set_return_type)
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)
{