]> granicus.if.org Git - vim/commitdiff
patch 8.2.1378: cannot put space between function name and paren v8.2.1378
authorBram Moolenaar <Bram@vim.org>
Thu, 6 Aug 2020 09:23:36 +0000 (11:23 +0200)
committerBram Moolenaar <Bram@vim.org>
Thu, 6 Aug 2020 09:23:36 +0000 (11:23 +0200)
Problem:    Cannot put space between function name and paren.
Solution:   Allow this for backwards compatibility.

src/eval.c
src/testdir/test_expr.vim
src/testdir/test_vim9_expr.vim
src/version.c

index a7f6086ef66ba851a5f7f888fd7b630ef6f543fe..877b3bc0ffcd8ace3ce0ce4c916ba8c973c7c2e0 100644 (file)
@@ -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)
index b4eeea653b15d447a9e63b7c2f7a14b6476b469b..cfae760d4910f61f16f0ef43015e4990a4d5a414 100644 (file)
@@ -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
index aa705b2168f5b748b4d7151dd5dbdcbeabc36916..746983d14b1c35d8670d6f53f00e321a2c8e5aa5 100644 (file)
@@ -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
 
 
index f5eb42bcfad815de6a6414d5c2924e8ca9b9de0f..ba24f693f5bf94e324855d464fd1cfac116c5019 100644 (file)
@@ -754,6 +754,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1378,
 /**/
     1377,
 /**/