From: Bram Moolenaar Date: Tue, 29 Apr 2014 12:03:02 +0000 (+0200) Subject: updated for version 7.4.268 X-Git-Tag: v7.4.268 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=355a95a079d3c8c64cf496df434741891d07985a;p=vim updated for version 7.4.268 Problem: Using exists() on a funcref for a script-local function does not work. Solution: Translate to the special byte sequence. Add a test. --- diff --git a/Filelist b/Filelist index 9f73a3d89..60221160a 100644 --- a/Filelist +++ b/Filelist @@ -88,6 +88,7 @@ SRC_ALL = \ src/testdir/test60.vim \ src/testdir/test83-tags? \ src/testdir/test77a.com \ + src/testdir/test_*.vim \ src/testdir/python2/*.py \ src/testdir/python3/*.py \ src/testdir/pythonx/*.py \ diff --git a/src/eval.c b/src/eval.c index f91578928..3e1088a1e 100644 --- a/src/eval.c +++ b/src/eval.c @@ -22275,6 +22275,14 @@ trans_function_name(pp, skip, flags, fdp) { name = vim_strsave(name); *pp = end; + if (STRNCMP(name, "", 5) == 0) + { + /* Change "" to the byte sequence. */ + name[0] = K_SPECIAL; + name[1] = KS_EXTRA; + name[2] = (int)KE_SNR; + mch_memmove(name + 3, name + 5, STRLEN(name + 5) + 1); + } goto theend; } diff --git a/src/testdir/test_eval.in b/src/testdir/test_eval.in index 214a99edb..8c3d839a4 100644 --- a/src/testdir/test_eval.in +++ b/src/testdir/test_eval.in @@ -180,6 +180,9 @@ endfun :echo g:Foo(2) :echo Foo(3) :" +:" script-local function used in Funcref must exist. +:so test_eval_func.vim +:" :/^start:/+1,$wq! test.out :" vim: et ts=4 isk-=\: fmr=???,??? :call getchar() diff --git a/src/testdir/test_eval.ok b/src/testdir/test_eval.ok index cfe045b53..f81927bae 100644 Binary files a/src/testdir/test_eval.ok and b/src/testdir/test_eval.ok differ diff --git a/src/testdir/test_eval_func.vim b/src/testdir/test_eval_func.vim new file mode 100644 index 000000000..4fcd0421a --- /dev/null +++ b/src/testdir/test_eval_func.vim @@ -0,0 +1,10 @@ +" 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') diff --git a/src/version.c b/src/version.c index 5aae1d2a7..bd97da3a4 100644 --- a/src/version.c +++ b/src/version.c @@ -734,6 +734,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 268, /**/ 267, /**/