0
0
mirror of https://github.com/vim/vim.git synced 2025-09-30 04:44:14 -04:00

patch 8.2.2805: Vim9: cannot use legacy syntax in Vim9 script

Problem:    Vim9: cannot use legacy syntax in Vim9 script.
Solution:   Add the :legacy command.
This commit is contained in:
Bram Moolenaar
2021-04-24 14:15:41 +02:00
parent 7ba1e4d363
commit 96cf4ba8fb
11 changed files with 64 additions and 28 deletions

View File

@@ -1500,33 +1500,33 @@ def Test_script_local_in_legacy()
# OK to define script-local later when prefixed with s:
var lines =<< trim END
def SetLater()
s:legacy = 'two'
s:legvar = 'two'
enddef
defcompile
let s:legacy = 'one'
let s:legvar = 'one'
call SetLater()
call assert_equal('two', s:legacy)
call assert_equal('two', s:legvar)
END
CheckScriptSuccess(lines)
# OK to leave out s: prefix when script-local already defined
lines =<< trim END
let s:legacy = 'one'
let s:legvar = 'one'
def SetNoPrefix()
legacy = 'two'
legvar = 'two'
enddef
call SetNoPrefix()
call assert_equal('two', s:legacy)
call assert_equal('two', s:legvar)
END
CheckScriptSuccess(lines)
# Not OK to leave out s: prefix when script-local defined later
lines =<< trim END
def SetLaterNoPrefix()
legacy = 'two'
legvar = 'two'
enddef
defcompile
let s:legacy = 'one'
let s:legvar = 'one'
END
CheckScriptFailure(lines, 'E476:', 1)
enddef