0
0
mirror of https://github.com/vim/vim.git synced 2025-10-03 05:14:07 -04:00

patch 8.2.2734: Vim9: cannot use legacy script-local var from :def function

Problem:    Vim9: cannot use legacy script-local var from :def function.
Solution:   Do not insist on using "s:" prefix. (closes #8076)
This commit is contained in:
Bram Moolenaar
2021-04-07 21:21:13 +02:00
parent 130cbfc312
commit 15e5e53ef2
4 changed files with 25 additions and 16 deletions

View File

@@ -2714,6 +2714,21 @@ def Test_expr7_negate_add()
CheckDefAndScriptFailure(lines, 'E1050:')
enddef
def Test_expr7_legacy_script()
var lines =<< trim END
let s:legacy = 'legacy'
def GetLocal(): string
return legacy
enddef
def GetLocalPrefix(): string
return s:legacy
enddef
call assert_equal('legacy', GetLocal())
call assert_equal('legacy', GetLocalPrefix())
END
CheckScriptSuccess(lines)
enddef
def Echo(arg: any): string
return arg
enddef