jkunstle / rpms / vim

Forked from rpms/vim 3 years ago
Clone

Blame SOURCES/7.4.264

3ef2ca
To: vim_dev@googlegroups.com
3ef2ca
Subject: Patch 7.4.264
3ef2ca
Fcc: outbox
3ef2ca
From: Bram Moolenaar <Bram@moolenaar.net>
3ef2ca
Mime-Version: 1.0
3ef2ca
Content-Type: text/plain; charset=UTF-8
3ef2ca
Content-Transfer-Encoding: 8bit
3ef2ca
------------
3ef2ca
3ef2ca
Patch 7.4.264 (after 7.4.260)
3ef2ca
Problem:    Can't define a function starting with "g:".  Can't assign a
3ef2ca
	    funcref to a buffer-local variable.
3ef2ca
Solution:   Skip "g:" at the start of a function name.  Don't check for colons
3ef2ca
	    when assigning to a variable.
3ef2ca
Files:	    src/eval.c, src/testdir/test_eval.in, src/testdir/test_eval.ok
3ef2ca
3ef2ca
3ef2ca
*** ../vim-7.4.263/src/eval.c	2014-04-23 19:44:26.366774008 +0200
3ef2ca
--- src/eval.c	2014-04-23 20:40:16.738693276 +0200
3ef2ca
***************
3ef2ca
*** 21583,21589 ****
3ef2ca
       * Get the function name.  There are these situations:
3ef2ca
       * func	    normal function name
3ef2ca
       *		    "name" == func, "fudi.fd_dict" == NULL
3ef2ca
-      * s:func	    script-local function name
3ef2ca
       * dict.func    new dictionary entry
3ef2ca
       *		    "name" == NULL, "fudi.fd_dict" set,
3ef2ca
       *		    "fudi.fd_di" == NULL, "fudi.fd_newkey" == func
3ef2ca
--- 21583,21588 ----
3ef2ca
***************
3ef2ca
*** 21593,21598 ****
3ef2ca
--- 21592,21599 ----
3ef2ca
       * dict.func    existing dict entry that's not a Funcref
3ef2ca
       *		    "name" == NULL, "fudi.fd_dict" set,
3ef2ca
       *		    "fudi.fd_di" set, "fudi.fd_newkey" == NULL
3ef2ca
+      * s:func	    script-local function name
3ef2ca
+      * g:func	    global function name, same as "func"
3ef2ca
       */
3ef2ca
      p = eap->arg;
3ef2ca
      name = trans_function_name(&p, eap->skip, 0, &fudi);
3ef2ca
***************
3ef2ca
*** 22286,22292 ****
3ef2ca
      }
3ef2ca
      else
3ef2ca
      {
3ef2ca
! 	if (lead == 2)	/* skip over "s:" */
3ef2ca
  	    lv.ll_name += 2;
3ef2ca
  	len = (int)(end - lv.ll_name);
3ef2ca
      }
3ef2ca
--- 22287,22294 ----
3ef2ca
      }
3ef2ca
      else
3ef2ca
      {
3ef2ca
! 	/* skip over "s:" and "g:" */
3ef2ca
! 	if (lead == 2 || (lv.ll_name[0] == 'g' && lv.ll_name[1] == ':'))
3ef2ca
  	    lv.ll_name += 2;
3ef2ca
  	len = (int)(end - lv.ll_name);
3ef2ca
      }
3ef2ca
***************
3ef2ca
*** 22317,22333 ****
3ef2ca
      else if (!(flags & TFN_INT) && builtin_function(lv.ll_name, len))
3ef2ca
      {
3ef2ca
  	EMSG2(_("E128: Function name must start with a capital or \"s:\": %s"),
3ef2ca
! 								  lv.ll_name);
3ef2ca
  	goto theend;
3ef2ca
      }
3ef2ca
!     if (!skip)
3ef2ca
      {
3ef2ca
  	char_u *cp = vim_strchr(lv.ll_name, ':');
3ef2ca
  
3ef2ca
  	if (cp != NULL && cp < end)
3ef2ca
  	{
3ef2ca
! 	    EMSG2(_("E884: Function name cannot contain a colon: %s"),
3ef2ca
! 								  lv.ll_name);
3ef2ca
  	    goto theend;
3ef2ca
  	}
3ef2ca
      }
3ef2ca
--- 22319,22334 ----
3ef2ca
      else if (!(flags & TFN_INT) && builtin_function(lv.ll_name, len))
3ef2ca
      {
3ef2ca
  	EMSG2(_("E128: Function name must start with a capital or \"s:\": %s"),
3ef2ca
! 								       start);
3ef2ca
  	goto theend;
3ef2ca
      }
3ef2ca
!     if (!skip && !(flags & TFN_QUIET))
3ef2ca
      {
3ef2ca
  	char_u *cp = vim_strchr(lv.ll_name, ':');
3ef2ca
  
3ef2ca
  	if (cp != NULL && cp < end)
3ef2ca
  	{
3ef2ca
! 	    EMSG2(_("E884: Function name cannot contain a colon: %s"), start);
3ef2ca
  	    goto theend;
3ef2ca
  	}
3ef2ca
      }
3ef2ca
*** ../vim-7.4.263/src/testdir/test_eval.in	2014-04-23 17:43:37.362948683 +0200
3ef2ca
--- src/testdir/test_eval.in	2014-04-23 20:36:50.494698246 +0200
3ef2ca
***************
3ef2ca
*** 144,150 ****
3ef2ca
  :delcommand AR
3ef2ca
  :call garbagecollect(1)
3ef2ca
  :"
3ef2ca
! :" function name includes a colon
3ef2ca
  :try
3ef2ca
  :func! g:test()
3ef2ca
  :echo "test"
3ef2ca
--- 144,150 ----
3ef2ca
  :delcommand AR
3ef2ca
  :call garbagecollect(1)
3ef2ca
  :"
3ef2ca
! :" function name not starting with capital
3ef2ca
  :try
3ef2ca
  :func! g:test()
3ef2ca
  :echo "test"
3ef2ca
***************
3ef2ca
*** 153,158 ****
3ef2ca
--- 153,167 ----
3ef2ca
  :$put =v:exception
3ef2ca
  :endtry
3ef2ca
  :"
3ef2ca
+ :" function name includes a colon
3ef2ca
+ :try
3ef2ca
+ :func! b:test()
3ef2ca
+ :echo "test"
3ef2ca
+ :endfunc
3ef2ca
+ :catch
3ef2ca
+ :$put =v:exception
3ef2ca
+ :endtry
3ef2ca
+ :"
3ef2ca
  :" function name folowed by #
3ef2ca
  :try
3ef2ca
  :func! test2() "#
3ef2ca
***************
3ef2ca
*** 162,167 ****
3ef2ca
--- 171,183 ----
3ef2ca
  :$put =v:exception
3ef2ca
  :endtry
3ef2ca
  :"
3ef2ca
+ :" function name starting with/without "g:", buffer-local funcref.
3ef2ca
+ :function! g:Foo()
3ef2ca
+ :  $put ='called Foo()'
3ef2ca
+ :endfunction
3ef2ca
+ :let b:my_func = function('Foo')
3ef2ca
+ :call b:my_func()
3ef2ca
+ :"
3ef2ca
  :/^start:/+1,$wq! test.out
3ef2ca
  :" vim: et ts=4 isk-=\: fmr=???,???
3ef2ca
  :call getchar()
3ef2ca
*** ../vim-7.4.263/src/testdir/test_eval.ok	2014-04-23 17:43:37.362948683 +0200
3ef2ca
--- src/testdir/test_eval.ok	2014-04-23 20:37:45.526696920 +0200
3ef2ca
***************
3ef2ca
*** 336,339 ****
3ef2ca
--- 336,341 ----
3ef2ca
  Executing call setreg(1, ["", "", [], ""])
3ef2ca
  Vim(call):E730: using List as a String
3ef2ca
  Vim(function):E128: Function name must start with a capital or "s:": g:test()
3ef2ca
+ Vim(function):E128: Function name must start with a capital or "s:": b:test()
3ef2ca
  Vim(function):E128: Function name must start with a capital or "s:": test2() "#
3ef2ca
+ called Foo()
3ef2ca
*** ../vim-7.4.263/src/version.c	2014-04-23 19:44:26.370774008 +0200
3ef2ca
--- src/version.c	2014-04-23 20:27:17.614712050 +0200
3ef2ca
***************
3ef2ca
*** 736,737 ****
3ef2ca
--- 736,739 ----
3ef2ca
  {   /* Add new patch number below this line */
3ef2ca
+ /**/
3ef2ca
+     264,
3ef2ca
  /**/
3ef2ca
3ef2ca
-- 
3ef2ca
In order for something to become clean, something else must become dirty;
3ef2ca
but you can get everything dirty without getting anything clean.
3ef2ca
3ef2ca
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
3ef2ca
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
3ef2ca
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
3ef2ca
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///