comparison src/testdir/test_vim9_func.vim @ 25630:c26eb08a0df2 v8.2.3351

patch 8.2.3351: Vim9: using a function by name may delete it Commit: https://github.com/vim/vim/commit/b033ee2ddfa8513b57111a56d6af9e45c41f7d1e Author: Bram Moolenaar <Bram@vim.org> Date: Sun Aug 15 16:08:36 2021 +0200 patch 8.2.3351: Vim9: using a function by name may delete it Problem: Vim9: using a function by name may delete it. (Naohiro Ono) Solution: Increment the reference count when using a function by name. (closes #8760)
author Bram Moolenaar <Bram@vim.org>
date Sun, 15 Aug 2021 16:15:03 +0200
parents f8bcd21e6e24
children c204815f3058
comparison
equal deleted inserted replaced
25629:afbcd19a3e2c 25630:c26eb08a0df2
3087 ) 3087 )
3088 END 3088 END
3089 call CheckDefAndScriptSuccess(lines) 3089 call CheckDefAndScriptSuccess(lines)
3090 enddef 3090 enddef
3091 3091
3092 func CreateMydict()
3093 let g:mydict = {}
3094 func g:mydict.afunc()
3095 let g:result = self.key
3096 endfunc
3097 endfunc
3098
3099 def Test_numbered_function_reference()
3100 CreateMydict()
3101 var output = execute('legacy func g:mydict.afunc')
3102 var funcName = 'g:' .. substitute(output, '.*function \(\d\+\).*', '\1', '')
3103 execute 'function(' .. funcName .. ', [], {key: 42})()'
3104 # check that the function still exists
3105 assert_equal(output, execute('legacy func g:mydict.afunc'))
3106 unlet g:mydict
3107 enddef
3108
3092 if has('python3') 3109 if has('python3')
3093 def Test_python3_heredoc() 3110 def Test_python3_heredoc()
3094 py3 << trim EOF 3111 py3 << trim EOF
3095 import vim 3112 import vim
3096 vim.vars['didit'] = 'yes' 3113 vim.vars['didit'] = 'yes'