Patch 8.2.3052
Problem: Vim9: "legacy call" does not work.
Solution: Do not skip "call" after "legacy". (closes #8454)
Files: src/vim9compile.c, src/testdir/test_vim9_func.vim
*** ../vim-8.2.3051/src/vim9compile.c 2021-06-26 12:40:53.612934775 +0200
--- src/vim9compile.c 2021-06-26 12:53:16.435542730 +0200
***************
*** 9346,9372 ****
break;
}
! // Skip ":call" to get to the function name.
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;
}
/*
--- 9346,9375 ----
break;
}
! // Skip ":call" to get to the function name, unless using :legacy
p = ea.cmd;
! 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,9382 ****
* "++nr" and "--nr" are eval commands
*/
cmd = ea.cmd;
! if (starts_with_colon || !(*cmd == '\''
! || (cmd[0] == cmd[1] && (*cmd == '+' || *cmd == '-'))))
{
ea.cmd = skip_range(ea.cmd, TRUE, NULL);
if (ea.cmd > cmd)
--- 9378,9386 ----
* "++nr" and "--nr" are eval commands
*/
cmd = ea.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)
*** ../vim-8.2.3051/src/testdir/test_vim9_func.vim 2021-06-22 19:32:13.356374012 +0200
--- src/testdir/test_vim9_func.vim 2021-06-26 12:57:14.179015082 +0200
***************
*** 2316,2321 ****
--- 2316,2338 ----
CheckScriptSuccess(lines)
enddef
+ def Test_legacy()
+ var lines =<< trim END
+ vim9script
+ func g:LegacyFunction()
+ let g:legacyvar = 1
+ endfunc
+ def Testit()
+ legacy call g:LegacyFunction()
+ enddef
+ Testit()
+ assert_equal(1, g:legacyvar)
+ unlet g:legacyvar
+ delfunc g:LegacyFunction
+ END
+ CheckScriptSuccess(lines)
+ enddef
+
def Test_legacy_errors()
for cmd in ['if', 'elseif', 'else', 'endif',
'for', 'endfor', 'continue', 'break',
*** ../vim-8.2.3051/src/version.c 2021-06-26 12:40:53.616934768 +0200
--- src/version.c 2021-06-26 12:58:16.578880971 +0200
***************
*** 757,758 ****
--- 757,760 ----
{ /* Add new patch number below this line */
+ /**/
+ 3052,
/**/
--
Have you heard about the new Beowulf cluster? It's so fast, it executes
an infinite loop in 6 seconds.
/// Bram Moolenaar -- Br...@Moolenaar.net --
http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///