|
|
22c937 |
To: vim_dev@googlegroups.com
|
|
|
22c937 |
Subject: Patch 7.4.268
|
|
|
22c937 |
Fcc: outbox
|
|
|
22c937 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
|
22c937 |
Mime-Version: 1.0
|
|
|
22c937 |
Content-Type: text/plain; charset=UTF-8
|
|
|
22c937 |
Content-Transfer-Encoding: 8bit
|
|
|
22c937 |
------------
|
|
|
22c937 |
|
|
|
22c937 |
Patch 7.4.268
|
|
|
22c937 |
Problem: Using exists() on a funcref for a script-local function does not
|
|
|
22c937 |
work.
|
|
|
22c937 |
Solution: Translate <SNR> to the special byte sequence. Add a test.
|
|
|
22c937 |
Files: src/eval.c, src/testdir/test_eval.in, src/testdir/test_eval.ok,
|
|
|
22c937 |
src/testdir/test_eval_func.vim, Filelist
|
|
|
22c937 |
|
|
|
22c937 |
|
|
|
22c937 |
*** ../vim-7.4.267/src/eval.c 2014-04-24 17:12:29.580911764 +0200
|
|
|
22c937 |
--- src/eval.c 2014-04-29 13:49:26.759933737 +0200
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 22275,22280 ****
|
|
|
22c937 |
--- 22275,22288 ----
|
|
|
22c937 |
{
|
|
|
22c937 |
name = vim_strsave(name);
|
|
|
22c937 |
*pp = end;
|
|
|
22c937 |
+ if (STRNCMP(name, "<SNR>", 5) == 0)
|
|
|
22c937 |
+ {
|
|
|
22c937 |
+ /* Change "<SNR>" to the byte sequence. */
|
|
|
22c937 |
+ name[0] = K_SPECIAL;
|
|
|
22c937 |
+ name[1] = KS_EXTRA;
|
|
|
22c937 |
+ name[2] = (int)KE_SNR;
|
|
|
22c937 |
+ mch_memmove(name + 3, name + 5, STRLEN(name + 5) + 1);
|
|
|
22c937 |
+ }
|
|
|
22c937 |
goto theend;
|
|
|
22c937 |
}
|
|
|
22c937 |
|
|
|
22c937 |
*** ../vim-7.4.267/src/testdir/test_eval.in 2014-04-24 17:12:29.584911764 +0200
|
|
|
22c937 |
--- src/testdir/test_eval.in 2014-04-29 13:59:09.495923525 +0200
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 180,185 ****
|
|
|
22c937 |
--- 180,188 ----
|
|
|
22c937 |
:echo g:Foo(2)
|
|
|
22c937 |
:echo Foo(3)
|
|
|
22c937 |
:"
|
|
|
22c937 |
+ :" script-local function used in Funcref must exist.
|
|
|
22c937 |
+ :so test_eval_func.vim
|
|
|
22c937 |
+ :"
|
|
|
22c937 |
:/^start:/+1,$wq! test.out
|
|
|
22c937 |
:" vim: et ts=4 isk-=\: fmr=???,???
|
|
|
22c937 |
:call getchar()
|
|
|
22c937 |
*** ../vim-7.4.267/src/testdir/test_eval.ok 2014-04-24 17:12:29.584911764 +0200
|
|
|
22c937 |
--- src/testdir/test_eval.ok 2014-04-29 13:59:39.551922998 +0200
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 341,343 ****
|
|
|
22c937 |
--- 341,347 ----
|
|
|
22c937 |
called Foo(1)
|
|
|
22c937 |
called Foo(2)
|
|
|
22c937 |
called Foo(3)
|
|
|
22c937 |
+ s:Testje exists: 0
|
|
|
22c937 |
+ func s:Testje exists: 1
|
|
|
22c937 |
+ Bar exists: 1
|
|
|
22c937 |
+ func Bar exists: 1
|
|
|
22c937 |
*** ../vim-7.4.267/src/testdir/test_eval_func.vim 2014-04-29 14:02:08.415920389 +0200
|
|
|
22c937 |
--- src/testdir/test_eval_func.vim 2014-04-29 13:57:34.503925189 +0200
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 0 ****
|
|
|
22c937 |
--- 1,10 ----
|
|
|
22c937 |
+ " Vim script used in test_eval.in. Needed for script-local function.
|
|
|
22c937 |
+
|
|
|
22c937 |
+ func! s:Testje()
|
|
|
22c937 |
+ return "foo"
|
|
|
22c937 |
+ endfunc
|
|
|
22c937 |
+ let Bar = function('s:Testje')
|
|
|
22c937 |
+ $put ='s:Testje exists: ' . exists('s:Testje')
|
|
|
22c937 |
+ $put ='func s:Testje exists: ' . exists('*s:Testje')
|
|
|
22c937 |
+ $put ='Bar exists: ' . exists('Bar')
|
|
|
22c937 |
+ $put ='func Bar exists: ' . exists('*Bar')
|
|
|
22c937 |
*** ../vim-7.4.267/Filelist 2014-04-05 21:59:35.939178415 +0200
|
|
|
22c937 |
--- Filelist 2014-04-29 13:58:40.207924038 +0200
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 88,93 ****
|
|
|
22c937 |
--- 88,94 ----
|
|
|
22c937 |
src/testdir/test60.vim \
|
|
|
22c937 |
src/testdir/test83-tags? \
|
|
|
22c937 |
src/testdir/test77a.com \
|
|
|
22c937 |
+ src/testdir/test_*.vim \
|
|
|
22c937 |
src/testdir/python2/*.py \
|
|
|
22c937 |
src/testdir/python3/*.py \
|
|
|
22c937 |
src/testdir/pythonx/*.py \
|
|
|
22c937 |
*** ../vim-7.4.267/src/version.c 2014-04-29 12:15:22.860032651 +0200
|
|
|
22c937 |
--- src/version.c 2014-04-29 13:47:32.935935732 +0200
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 736,737 ****
|
|
|
22c937 |
--- 736,739 ----
|
|
|
22c937 |
{ /* Add new patch number below this line */
|
|
|
22c937 |
+ /**/
|
|
|
22c937 |
+ 268,
|
|
|
22c937 |
/**/
|
|
|
22c937 |
|
|
|
22c937 |
--
|
|
|
22c937 |
I AM THANKFUL...
|
|
|
22c937 |
...for the piles of laundry and ironing because it means I
|
|
|
22c937 |
have plenty of clothes to wear.
|
|
|
22c937 |
|
|
|
22c937 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
|
22c937 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
|
22c937 |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
|
22c937 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|