Mercurial > vim
comparison src/testdir/test_vim9_expr.vim @ 24390:492f7b54f691 v8.2.2735
patch 8.2.2735: Vim9: function reference found with prefix, not without
Commit: https://github.com/vim/vim/commit/fa5963880df1d11613594ab78c0a68f894d34aa3
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Apr 7 21:58:16 2021 +0200
patch 8.2.2735: Vim9: function reference found with prefix, not without
Problem: Vim9: function reference found with prefix, not without.
Solution: Also find function reference without prefix.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 07 Apr 2021 22:00:04 +0200 |
parents | 72f3e40f046c |
children | fe71212fd202 |
comparison
equal
deleted
inserted
replaced
24389:9b13404bbb6f | 24390:492f7b54f691 |
---|---|
2100 enddef | 2100 enddef |
2101 var FuncRef = RetNumber | 2101 var FuncRef = RetNumber |
2102 assert_equal(123, FuncRef()) | 2102 assert_equal(123, FuncRef()) |
2103 END | 2103 END |
2104 CheckDefAndScriptSuccess(lines) | 2104 CheckDefAndScriptSuccess(lines) |
2105 | |
2106 lines =<< trim END | |
2107 vim9script | |
2108 func g:GlobalFunc() | |
2109 return 'global' | |
2110 endfunc | |
2111 func s:ScriptFunc() | |
2112 return 'script' | |
2113 endfunc | |
2114 def Test() | |
2115 var Ref = g:GlobalFunc | |
2116 assert_equal('global', Ref()) | |
2117 Ref = GlobalFunc | |
2118 assert_equal('global', Ref()) | |
2119 | |
2120 Ref = s:ScriptFunc | |
2121 assert_equal('script', Ref()) | |
2122 Ref = ScriptFunc | |
2123 assert_equal('script', Ref()) | |
2124 enddef | |
2125 Test() | |
2126 END | |
2127 CheckScriptSuccess(lines) | |
2105 enddef | 2128 enddef |
2106 | 2129 |
2107 let g:test_space_dict = {'': 'empty', ' ': 'space'} | 2130 let g:test_space_dict = {'': 'empty', ' ': 'space'} |
2108 let g:test_hash_dict = #{one: 1, two: 2} | 2131 let g:test_hash_dict = #{one: 1, two: 2} |
2109 | 2132 |