changeset 21656:c3f6006bf0ba v8.2.1378

patch 8.2.1378: cannot put space between function name and paren Commit: https://github.com/vim/vim/commit/bbd3e3c357487f7a5bdc704a819f63a7dd0dd66e Author: Bram Moolenaar <Bram@vim.org> Date: Thu Aug 6 11:23:36 2020 +0200 patch 8.2.1378: cannot put space between function name and paren Problem: Cannot put space between function name and paren. Solution: Allow this for backwards compatibility.
author Bram Moolenaar <Bram@vim.org>
date Thu, 06 Aug 2020 11:30:04 +0200
parents e46ef9eac57a
children bd3b9e792ad6
files src/eval.c src/testdir/test_expr.vim src/testdir/test_vim9_expr.vim src/version.c
diffstat 4 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/eval.c
+++ b/src/eval.c
@@ -3198,9 +3198,12 @@ eval7(
 	{
 	    int	    flags = evalarg == NULL ? 0 : evalarg->eval_flags;
 
-	    if (**arg == '(')
+	    if ((in_vim9script() ? **arg : *skipwhite(*arg)) == '(')
+	    {
 		// "name(..."  recursive!
+		*arg = skipwhite(*arg);
 		ret = eval_func(arg, evalarg, s, len, rettv, flags, NULL);
+	    }
 	    else if (flags & EVAL_CONSTANT)
 		ret = FAIL;
 	    else if (evaluate)
--- a/src/testdir/test_expr.vim
+++ b/src/testdir/test_expr.vim
@@ -599,6 +599,11 @@ func Test_expr_eval_error()
   call assert_fails("let v = -{}", 'E728:')
 endfunc
 
+func Test_white_in_function_call()
+  let text = substitute ( 'some text' , 't' , 'T' , 'g' )
+  call assert_equal('some TexT', text)
+endfunc
+
 " Test for float value comparison
 func Test_float_compare()
   CheckFeature float
--- a/src/testdir/test_vim9_expr.vim
+++ b/src/testdir/test_vim9_expr.vim
@@ -1686,6 +1686,10 @@ def Test_expr7_call()
   assert_equal([0, 1, 2], --3->range())
 
   call CheckDefFailure(["let x = 'yes'->Echo"], 'E107:')
+  call CheckScriptFailure([
+	"vim9script",
+	"let x = substitute ('x', 'x', 'x', 'x')"
+	], 'E121:')
 enddef
 
 
--- a/src/version.c
+++ b/src/version.c
@@ -755,6 +755,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1378,
+/**/
     1377,
 /**/
     1376,