]> granicus.if.org Git - vim/commitdiff
patch 8.0.0004 v8.0.0004
authorBram Moolenaar <Bram@vim.org>
Wed, 14 Sep 2016 20:16:13 +0000 (22:16 +0200)
committerBram Moolenaar <Bram@vim.org>
Wed, 14 Sep 2016 20:16:13 +0000 (22:16 +0200)
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.

src/evalfunc.c
src/testdir/test_expr.vim
src/version.c

index 7dd5c2a4d2888078b1696d147792943fe5e83c55..3207441c2d030143bf418a007ab145769dbbdeb9 100644 (file)
@@ -3612,7 +3612,7 @@ common_function(typval_T *argvars, typval_T *rettv, int is_funcref)
 
     if (s == NULL || *s == NUL || (use_string && VIM_ISDIGIT(*s))
                                         || (is_funcref && trans_name == NULL))
-       EMSG2(_(e_invarg2), s);
+       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
index 108ee508ea0f94d0dde447ef38d685cc2ca0b5a0..dff8e36f4eb9c4b09dba77befed22222ae057dae 100644 (file)
@@ -439,6 +439,9 @@ func Test_function_with_funcref()
   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()
index dcf02c288c2131489406df2fe3ad65e8a042cbef..5634114385ce0e081b6670a949f21aee64158623 100644 (file)
@@ -764,6 +764,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    4,
 /**/
     3,
 /**/