Mercurial > vim
diff src/vim9compile.c @ 19481:c27837cbe922 v8.2.0298
patch 8.2.0298: Vim9 script: cannot start command with a string constant
Commit: https://github.com/vim/vim/commit/0c6ceaf90389b41545d803458c4813013811c756
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Feb 22 18:36:32 2020 +0100
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 '('.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 22 Feb 2020 18:45:04 +0100 |
parents | b09afbebffee |
children | 17f0d6dc6a73 |
line wrap: on
line diff
--- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -4821,22 +4821,11 @@ compile_def_function(ufunc_T *ufunc, int 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) {