changeset 21751:cc8188c22a47 v8.2.1425

patch 8.2.1425: Vim9: cannot use call() without :call Commit: https://github.com/vim/vim/commit/575f24b3f3d8cd8bfc2da402c2938c0c7ace7877 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Aug 12 14:21:11 2020 +0200 patch 8.2.1425: Vim9: cannot use call() without :call Problem: Vim9: cannot use call() without :call. Solution: Do not skip over "call(". (closes https://github.com/vim/vim/issues/6689)
author Bram Moolenaar <Bram@vim.org>
date Wed, 12 Aug 2020 14:30:04 +0200
parents 3a928a619b67
children 6b6f91a7959d
files src/testdir/test_vim9_func.vim src/version.c src/vim9compile.c
diffstat 3 files changed, 16 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/testdir/test_vim9_func.vim
+++ b/src/testdir/test_vim9_func.vim
@@ -290,6 +290,12 @@ def Test_call_def_varargs()
   CheckScriptFailure(lines, 'E1013:')
 enddef
 
+def Test_call_call()
+  let l = [3, 2, 1]
+  call('reverse', [l])
+  assert_equal([1, 2, 3], l)
+enddef
+
 let s:value = ''
 
 def FuncOneDefArg(opt = 'text')
--- 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 */
 /**/
+    1425,
+/**/
     1424,
 /**/
     1423,
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -6484,8 +6484,15 @@ compile_def_function(ufunc_T *ufunc, int
 	cmdmod = save_cmdmod;
 
 	// Skip ":call" to get to the function name.
+	p = ea.cmd;
 	if (checkforcmd(&ea.cmd, "call", 3))
-	    ea.cmd = skipwhite(ea.cmd);
+	{
+	    if (*ea.cmd == '(')
+		// not for "call()"
+		ea.cmd = p;
+	    else
+		ea.cmd = skipwhite(ea.cmd);
+	}
 
 	if (!starts_with_colon)
 	{