1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
| | To: vim_dev@googlegroups.com
Subject: Patch 8.0.0004
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 8.0.0004
Problem: A string argument for function() that is not a function name
results in an error message with NULL. (Christian Brabandt)
Solution: Use the argument for the error message.
Files: src/evalfunc.c, src/testdir/test_expr.vim
*** vim80/src/evalfunc.c 2016-09-10 13:39:30.000000000 +0200
--- vim80/src/evalfunc.c 2016-09-13 23:04:02.917786784 +0200
***************
*** 3612,3618 ****
if (s == NULL || *s == NUL || (use_string && VIM_ISDIGIT(*s))
|| (is_funcref && trans_name == NULL))
! EMSG2(_(e_invarg2), s);
/* Don't check an autoload name for existence here. */
else if (trans_name != NULL && (is_funcref
? find_func(trans_name) == NULL
--- 3612,3618 ----
if (s == NULL || *s == NUL || (use_string && VIM_ISDIGIT(*s))
|| (is_funcref && trans_name == NULL))
! EMSG2(_(e_invarg2), use_string ? get_tv_string(&argvars[0]) : s);
/* Don't check an autoload name for existence here. */
else if (trans_name != NULL && (is_funcref
? find_func(trans_name) == NULL
*** vim80/src/testdir/test_expr.vim 2016-09-04 21:41:26.000000000 +0200
--- vim80/src/testdir/test_expr.vim 2016-09-13 23:03:20.426385157 +0200
***************
*** 439,444 ****
--- 439,447 ----
let s:fref = function(s:f)
call assert_equal(v:t_string, s:fref('x'))
call assert_fails("call function('s:f')", 'E700:')
+
+ call assert_fails("call function('foo()')", 'E475:')
+ call assert_fails("call function('foo()')", 'foo()')
endfunc
func Test_funcref()
*** vim80/src/version.c 2016-09-12 19:51:07.689659657 +0200
--- vim80/src/version.c 2016-09-14 22:06:19.364036465 +0200
***************
*** 766,767 ****
--- 766,769 ----
{ /* Add new patch number below this line */
+ /**/
+ 4,
/**/
--
|