Mercurial > vim
diff src/vim9compile.c @ 25030:214fddf4c765 v8.2.3052
patch 8.2.3052: Vim9: "legacy call" does not work
Commit: https://github.com/vim/vim/commit/ce024c3e20839465dc8c8f79dcccc5414dd8c506
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jun 26 13:00:49 2021 +0200
patch 8.2.3052: Vim9: "legacy call" does not work
Problem: Vim9: "legacy call" does not work.
Solution: Do not skip "call" after "legacy". (closes https://github.com/vim/vim/issues/8454)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 26 Jun 2021 13:15:03 +0200 |
parents | faa3de7aed8b |
children | 123590c942b7 |
line wrap: on
line diff
--- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -9346,27 +9346,30 @@ compile_def_function( break; } - // Skip ":call" to get to the function name. + // Skip ":call" to get to the function name, unless using :legacy p = ea.cmd; - if (checkforcmd(&ea.cmd, "call", 3)) - { - if (*ea.cmd == '(') - // not for "call()" - ea.cmd = p; - else - ea.cmd = skipwhite(ea.cmd); - } - - if (!starts_with_colon) - { - int assign; - - // Check for assignment after command modifiers. - assign = may_compile_assignment(&ea, &line, &cctx); - if (assign == OK) - goto nextline; - if (assign == FAIL) - goto erret; + if (!(local_cmdmod.cmod_flags & CMOD_LEGACY)) + { + if (checkforcmd(&ea.cmd, "call", 3)) + { + if (*ea.cmd == '(') + // not for "call()" + ea.cmd = p; + else + ea.cmd = skipwhite(ea.cmd); + } + + if (!starts_with_colon) + { + int assign; + + // Check for assignment after command modifiers. + assign = may_compile_assignment(&ea, &line, &cctx); + if (assign == OK) + goto nextline; + if (assign == FAIL) + goto erret; + } } /* @@ -9375,8 +9378,9 @@ compile_def_function( * "++nr" and "--nr" are eval commands */ cmd = ea.cmd; - if (starts_with_colon || !(*cmd == '\'' - || (cmd[0] == cmd[1] && (*cmd == '+' || *cmd == '-')))) + if (!(local_cmdmod.cmod_flags & CMOD_LEGACY) + && (starts_with_colon || !(*cmd == '\'' + || (cmd[0] == cmd[1] && (*cmd == '+' || *cmd == '-'))))) { ea.cmd = skip_range(ea.cmd, TRUE, NULL); if (ea.cmd > cmd)