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

@@ -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)
{