# HG changeset patch # User Bram Moolenaar # Date 1398772982 -7200 # Node ID 1a5ed2626b26a982e307a206572121a557adf709 # Parent 43612f2da963a29f678d45621b590c985ca2d378 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 --- 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 --- 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 --- 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 cfe045b53e0418bf4ac285fa24f4f42a82e86982..f81927bae793f17312ce2f6dad8cf7fba80c8454 GIT binary patch literal 10932 zc%02zOHboS5bm?3y>f144*`i$Vms{2WR*h_JAgEr%Z%oNIM~5JRwhA?nHhxkzi+>) zA9l4#V0Kv!*siYnzUp>Wb#;=br>BsXMNR8sTW^EjnAVT?1^xaf{hpN%#h7OKk{(|4 z*`9(k= z;zrGz$s;8>>}UOB%8{o0y6hhX8Adl%d{fs^TO3R#!GzyWT!LH?%=q;?Bgip=nL?Vm z1hyCm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x85jDD#rCh&Xr^mhXz1dL=Q+{miO-H_Nk zFD_r{P;byd{uYTZa!${-j|QL$xxq-*x-mYa2*t=6>u zv7u~f?>3eCagUFG^0xdTXXoVHjZ1#reMPw%#10R!h=tffJ=1k|SJ1l$X0olbs+LEn zjB($u>a66x^|s^QnBI)}?-EsRy&5h5rDz;0Iy|Di-vhoJ#T8v_Hauyqr^tDVkAm&^ eD>M76V6TZEBFA(Xa7SoM9tN|lvYv#NEBXhPWw{do diff --git a/src/testdir/test_eval_func.vim b/src/testdir/test_eval_func.vim new file mode 100644 --- /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 --- a/src/version.c +++ b/src/version.c @@ -735,6 +735,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 268, +/**/ 267, /**/ 266,