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:
@@ -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
|
||||
|
Reference in New Issue
Block a user