Mercurial > vim
comparison src/testdir/test_vim9_func.vim @ 30590:d900f0561eee v9.0.0630
patch 9.0.0630: in Vim9 script a numbered function cannot be called
Commit: https://github.com/vim/vim/commit/cfb4d4f312e740c2fbb70c29c47cf74a76f8b605
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Sep 30 19:19:04 2022 +0100
patch 9.0.0630: in Vim9 script a numbered function cannot be called
Problem: In Vim9 script a numbered function cannot be called.
Solution: Do not require "g:" before a numbered function name.
(closes #11254)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 30 Sep 2022 20:30:04 +0200 |
parents | 54e36d01847b |
children | 90a257beac7a |
comparison
equal
deleted
inserted
replaced
30589:2ee5c536668e | 30590:d900f0561eee |
---|---|
4208 # check that the function still exists | 4208 # check that the function still exists |
4209 assert_equal(output, execute('legacy func g:mydict.afunc')) | 4209 assert_equal(output, execute('legacy func g:mydict.afunc')) |
4210 unlet g:mydict | 4210 unlet g:mydict |
4211 enddef | 4211 enddef |
4212 | 4212 |
4213 def Test_numbered_function_call() | |
4214 var lines =<< trim END | |
4215 let s:legacyscript = {} | |
4216 func s:legacyscript.Helper() abort | |
4217 return "Success" | |
4218 endfunc | |
4219 let g:legacyscript = deepcopy(s:legacyscript) | |
4220 | |
4221 let g:legacy_result = eval("g:legacyscript.Helper()") | |
4222 vim9cmd g:vim9_result = eval("g:legacyscript.Helper()") | |
4223 END | |
4224 v9.CheckScriptSuccess(lines) | |
4225 assert_equal('Success', g:legacy_result) | |
4226 assert_equal('Success', g:vim9_result) | |
4227 | |
4228 unlet g:legacy_result | |
4229 unlet g:vim9_result | |
4230 enddef | |
4231 | |
4213 def Test_go_beyond_end_of_cmd() | 4232 def Test_go_beyond_end_of_cmd() |
4214 # this was reading the byte after the end of the line | 4233 # this was reading the byte after the end of the line |
4215 var lines =<< trim END | 4234 var lines =<< trim END |
4216 def F() | 4235 def F() |
4217 cal | 4236 cal |