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