vim-patch:7.4.2137

Problem:    Using function() with a name will find another function when it is
            redefined.
Solution:   Add funcref().  Refer to lambda using a partial.  Fix several
            reference counting issues.

437bafe4c8
This commit is contained in:
Michael Ennen
2016-12-16 14:51:49 -07:00
parent 1f715ac1c1
commit 53fad45115
10 changed files with 384 additions and 227 deletions

View File

@@ -150,3 +150,18 @@ func Test_function_with_funcref()
call assert_equal(v:t_string, s:fref('x'))
call assert_fails("call function('s:f')", 'E700:')
endfunc
func Test_funcref()
func! One()
return 1
endfunc
let OneByName = function('One')
let OneByRef = funcref('One')
func! One()
return 2
endfunc
call assert_equal(2, OneByName())
call assert_equal(1, OneByRef())
let OneByRef = funcref('One')
call assert_equal(2, OneByRef())
endfunc