|
|
22c937 |
To: vim_dev@googlegroups.com
|
|
|
22c937 |
Subject: Patch 7.4.086
|
|
|
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.086
|
|
|
22c937 |
Problem: Skipping over an expression when not evaluating it does not work
|
|
|
22c937 |
properly for dict members.
|
|
|
22c937 |
Solution: Skip over unrecognized expression. (ZyX)
|
|
|
22c937 |
Files: src/eval.c, src/testdir/test34.in, src/testdir/test34.ok
|
|
|
22c937 |
|
|
|
22c937 |
|
|
|
22c937 |
*** ../vim-7.4.085/src/eval.c 2013-11-08 04:30:06.000000000 +0100
|
|
|
22c937 |
--- src/eval.c 2013-11-11 04:11:38.000000000 +0100
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 19845,19868 ****
|
|
|
22c937 |
while (ret == OK
|
|
|
22c937 |
&& (**arg == '['
|
|
|
22c937 |
|| (**arg == '.' && rettv->v_type == VAR_DICT)
|
|
|
22c937 |
! || (**arg == '(' && rettv->v_type == VAR_FUNC))
|
|
|
22c937 |
&& !vim_iswhite(*(*arg - 1)))
|
|
|
22c937 |
{
|
|
|
22c937 |
if (**arg == '(')
|
|
|
22c937 |
{
|
|
|
22c937 |
/* need to copy the funcref so that we can clear rettv */
|
|
|
22c937 |
! functv = *rettv;
|
|
|
22c937 |
! rettv->v_type = VAR_UNKNOWN;
|
|
|
22c937 |
|
|
|
22c937 |
! /* Invoke the function. Recursive! */
|
|
|
22c937 |
! s = functv.vval.v_string;
|
|
|
22c937 |
ret = get_func_tv(s, (int)STRLEN(s), rettv, arg,
|
|
|
22c937 |
curwin->w_cursor.lnum, curwin->w_cursor.lnum,
|
|
|
22c937 |
&len, evaluate, selfdict);
|
|
|
22c937 |
|
|
|
22c937 |
/* Clear the funcref afterwards, so that deleting it while
|
|
|
22c937 |
* evaluating the arguments is possible (see test55). */
|
|
|
22c937 |
! clear_tv(&functv);
|
|
|
22c937 |
|
|
|
22c937 |
/* Stop the expression evaluation when immediately aborting on
|
|
|
22c937 |
* error, or when an interrupt occurred or an exception was thrown
|
|
|
22c937 |
--- 19845,19874 ----
|
|
|
22c937 |
while (ret == OK
|
|
|
22c937 |
&& (**arg == '['
|
|
|
22c937 |
|| (**arg == '.' && rettv->v_type == VAR_DICT)
|
|
|
22c937 |
! || (**arg == '(' && (!evaluate || rettv->v_type == VAR_FUNC)))
|
|
|
22c937 |
&& !vim_iswhite(*(*arg - 1)))
|
|
|
22c937 |
{
|
|
|
22c937 |
if (**arg == '(')
|
|
|
22c937 |
{
|
|
|
22c937 |
/* need to copy the funcref so that we can clear rettv */
|
|
|
22c937 |
! if (evaluate)
|
|
|
22c937 |
! {
|
|
|
22c937 |
! functv = *rettv;
|
|
|
22c937 |
! rettv->v_type = VAR_UNKNOWN;
|
|
|
22c937 |
|
|
|
22c937 |
! /* Invoke the function. Recursive! */
|
|
|
22c937 |
! s = functv.vval.v_string;
|
|
|
22c937 |
! }
|
|
|
22c937 |
! else
|
|
|
22c937 |
! s = (char_u *)"";
|
|
|
22c937 |
ret = get_func_tv(s, (int)STRLEN(s), rettv, arg,
|
|
|
22c937 |
curwin->w_cursor.lnum, curwin->w_cursor.lnum,
|
|
|
22c937 |
&len, evaluate, selfdict);
|
|
|
22c937 |
|
|
|
22c937 |
/* Clear the funcref afterwards, so that deleting it while
|
|
|
22c937 |
* evaluating the arguments is possible (see test55). */
|
|
|
22c937 |
! if (evaluate)
|
|
|
22c937 |
! clear_tv(&functv);
|
|
|
22c937 |
|
|
|
22c937 |
/* Stop the expression evaluation when immediately aborting on
|
|
|
22c937 |
* error, or when an interrupt occurred or an exception was thrown
|
|
|
22c937 |
*** ../vim-7.4.085/src/testdir/test34.in 2012-07-16 16:51:29.000000000 +0200
|
|
|
22c937 |
--- src/testdir/test34.in 2013-11-11 04:10:13.000000000 +0100
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 1,6 ****
|
|
|
22c937 |
--- 1,7 ----
|
|
|
22c937 |
Test for user functions.
|
|
|
22c937 |
Also test an <expr> mapping calling a function.
|
|
|
22c937 |
Also test that a builtin function cannot be replaced.
|
|
|
22c937 |
+ Also test for regression when calling arbitrary expression.
|
|
|
22c937 |
|
|
|
22c937 |
STARTTEST
|
|
|
22c937 |
:so small.vim
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 62,68 ****
|
|
|
22c937 |
[(one again?:call append(line('$'), max([1, 2, 3]))
|
|
|
22c937 |
:call extend(g:, {'max': function('min')})
|
|
|
22c937 |
:call append(line('$'), max([1, 2, 3]))
|
|
|
22c937 |
! :$-7,$w! test.out
|
|
|
22c937 |
:delfunc Table
|
|
|
22c937 |
:delfunc Compute
|
|
|
22c937 |
:delfunc Expr1
|
|
|
22c937 |
--- 63,79 ----
|
|
|
22c937 |
[(one again?:call append(line('$'), max([1, 2, 3]))
|
|
|
22c937 |
:call extend(g:, {'max': function('min')})
|
|
|
22c937 |
:call append(line('$'), max([1, 2, 3]))
|
|
|
22c937 |
! :try
|
|
|
22c937 |
! : " Regression: the first line below used to throw ?E110: Missing ')'?
|
|
|
22c937 |
! : " Second is here just to prove that this line is correct when not skipping
|
|
|
22c937 |
! : " rhs of &&.
|
|
|
22c937 |
! : $put =(0&&(function('tr'))(1, 2, 3))
|
|
|
22c937 |
! : $put =(1&&(function('tr'))(1, 2, 3))
|
|
|
22c937 |
! :catch
|
|
|
22c937 |
! : $put ='!!! Unexpected exception:'
|
|
|
22c937 |
! : $put =v:exception
|
|
|
22c937 |
! :endtry
|
|
|
22c937 |
! :$-9,$w! test.out
|
|
|
22c937 |
:delfunc Table
|
|
|
22c937 |
:delfunc Compute
|
|
|
22c937 |
:delfunc Expr1
|
|
|
22c937 |
*** ../vim-7.4.085/src/testdir/test34.ok 2012-07-16 16:43:15.000000000 +0200
|
|
|
22c937 |
--- src/testdir/test34.ok 2013-11-11 04:10:13.000000000 +0100
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 6,8 ****
|
|
|
22c937 |
--- 6,10 ----
|
|
|
22c937 |
1. one again
|
|
|
22c937 |
3
|
|
|
22c937 |
3
|
|
|
22c937 |
+ 0
|
|
|
22c937 |
+ 1
|
|
|
22c937 |
*** ../vim-7.4.085/src/version.c 2013-11-11 01:29:16.000000000 +0100
|
|
|
22c937 |
--- src/version.c 2013-11-11 04:15:59.000000000 +0100
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 740,741 ****
|
|
|
22c937 |
--- 740,743 ----
|
|
|
22c937 |
{ /* Add new patch number below this line */
|
|
|
22c937 |
+ /**/
|
|
|
22c937 |
+ 86,
|
|
|
22c937 |
/**/
|
|
|
22c937 |
|
|
|
22c937 |
--
|
|
|
22c937 |
ARTHUR: The swallow may fly south with the sun, or the house martin or the
|
|
|
22c937 |
plover seek warmer hot lands in winter, yet these are not strangers to
|
|
|
22c937 |
our land.
|
|
|
22c937 |
SOLDIER: Are you suggesting coconuts migrate?
|
|
|
22c937 |
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
|
|
|
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 ///
|