mirror of
https://github.com/vim/vim.git
synced 2025-09-27 04:14:06 -04:00
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 #8454)
This commit is contained in:
@@ -2316,6 +2316,23 @@ def Test_legacy_lambda()
|
|||||||
CheckScriptSuccess(lines)
|
CheckScriptSuccess(lines)
|
||||||
enddef
|
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()
|
def Test_legacy_errors()
|
||||||
for cmd in ['if', 'elseif', 'else', 'endif',
|
for cmd in ['if', 'elseif', 'else', 'endif',
|
||||||
'for', 'endfor', 'continue', 'break',
|
'for', 'endfor', 'continue', 'break',
|
||||||
|
@@ -755,6 +755,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
3052,
|
||||||
/**/
|
/**/
|
||||||
3051,
|
3051,
|
||||||
/**/
|
/**/
|
||||||
|
@@ -9346,8 +9346,10 @@ compile_def_function(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skip ":call" to get to the function name.
|
// Skip ":call" to get to the function name, unless using :legacy
|
||||||
p = ea.cmd;
|
p = ea.cmd;
|
||||||
|
if (!(local_cmdmod.cmod_flags & CMOD_LEGACY))
|
||||||
|
{
|
||||||
if (checkforcmd(&ea.cmd, "call", 3))
|
if (checkforcmd(&ea.cmd, "call", 3))
|
||||||
{
|
{
|
||||||
if (*ea.cmd == '(')
|
if (*ea.cmd == '(')
|
||||||
@@ -9368,6 +9370,7 @@ compile_def_function(
|
|||||||
if (assign == FAIL)
|
if (assign == FAIL)
|
||||||
goto erret;
|
goto erret;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* COMMAND after range
|
* COMMAND after range
|
||||||
@@ -9375,8 +9378,9 @@ compile_def_function(
|
|||||||
* "++nr" and "--nr" are eval commands
|
* "++nr" and "--nr" are eval commands
|
||||||
*/
|
*/
|
||||||
cmd = ea.cmd;
|
cmd = ea.cmd;
|
||||||
if (starts_with_colon || !(*cmd == '\''
|
if (!(local_cmdmod.cmod_flags & CMOD_LEGACY)
|
||||||
|| (cmd[0] == cmd[1] && (*cmd == '+' || *cmd == '-'))))
|
&& (starts_with_colon || !(*cmd == '\''
|
||||||
|
|| (cmd[0] == cmd[1] && (*cmd == '+' || *cmd == '-')))))
|
||||||
{
|
{
|
||||||
ea.cmd = skip_range(ea.cmd, TRUE, NULL);
|
ea.cmd = skip_range(ea.cmd, TRUE, NULL);
|
||||||
if (ea.cmd > cmd)
|
if (ea.cmd > cmd)
|
||||||
|
Reference in New Issue
Block a user