mirror of
https://github.com/neovim/neovim.git
synced 2024-12-25 21:55:17 -07:00
vim-patch:7.4.268
Problem: Using exists() on a funcref for a script-local function does not work. Solution: Translate <SNR> to the special byte sequence. Add a test. https://code.google.com/p/vim/source/detail?r=1a5ed2626b26a982e307a206572121a557adf709
This commit is contained in:
parent
f30a83f101
commit
046debb935
@ -17883,6 +17883,13 @@ trans_function_name (
|
||||
if (name != NULL) {
|
||||
name = vim_strsave(name);
|
||||
*pp = end;
|
||||
if (strncmp((char *)name, "<SNR>", 5) == 0) {
|
||||
// Change "<SNR>" to the byte sequence.
|
||||
name[0] = K_SPECIAL;
|
||||
name[1] = KS_EXTRA;
|
||||
name[2] = (int)KE_SNR;
|
||||
memmove(name + 3, name + 5, strlen((char *)name + 5) + 1);
|
||||
}
|
||||
goto theend;
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,10 @@ STARTTEST
|
||||
:echo g:Foo(2)
|
||||
:echo Foo(3)
|
||||
|
||||
:$-5,$w! test.out
|
||||
:" script-local function used in Funcref must exist.
|
||||
:so test_eval_func.vim
|
||||
|
||||
:$-9,$w! test.out
|
||||
:q!
|
||||
|
||||
ENDTEST
|
||||
|
@ -4,3 +4,7 @@ Vim(function):E128: Function name must start with a capital or "s:": b:test()
|
||||
called Foo(1)
|
||||
called Foo(2)
|
||||
called Foo(3)
|
||||
s:Testje exists: 0
|
||||
func s:Testje exists: 1
|
||||
Bar exists: 1
|
||||
func Bar exists: 1
|
||||
|
12
src/testdir/test_eval_func.vim
Normal file
12
src/testdir/test_eval_func.vim
Normal file
@ -0,0 +1,12 @@
|
||||
" Vim script used in test_eval.in. Needed for script-local function.
|
||||
|
||||
func! s:Testje()
|
||||
return "foo"
|
||||
endfunc
|
||||
|
||||
let Bar = function('s:Testje')
|
||||
|
||||
$put ='s:Testje exists: ' . exists('s:Testje')
|
||||
$put ='func s:Testje exists: ' . exists('*s:Testje')
|
||||
$put ='Bar exists: ' . exists('Bar')
|
||||
$put ='func Bar exists: ' . exists('*Bar')
|
@ -204,7 +204,7 @@ static int included_patches[] = {
|
||||
// Add new patch number below this line
|
||||
//270,
|
||||
269,
|
||||
//268,
|
||||
268,
|
||||
//267,
|
||||
266,
|
||||
265,
|
||||
|
Loading…
Reference in New Issue
Block a user