]> granicus.if.org Git - vim/commitdiff
patch 8.2.1425: Vim9: cannot use call() without :call v8.2.1425
authorBram Moolenaar <Bram@vim.org>
Wed, 12 Aug 2020 12:21:11 +0000 (14:21 +0200)
committerBram Moolenaar <Bram@vim.org>
Wed, 12 Aug 2020 12:21:11 +0000 (14:21 +0200)
Problem:    Vim9: cannot use call() without :call.
Solution:   Do not skip over "call(". (closes #6689)

src/testdir/test_vim9_func.vim
src/version.c
src/vim9compile.c

index 772b52ab97b0dbc77b8c161bf1ab19f8d324f1f5..24078f56ed9e87ba23115f6415ec7c965bd9c021 100644 (file)
@@ -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')
index ec86fb4f52c02a1a826d47f2afa55ae29ac215be..1ab7a618ce5dd37b5709e4fc5779ac4191a4fb51 100644 (file)
@@ -754,6 +754,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1425,
 /**/
     1424,
 /**/
index 72c26ce46ee40966bca73bb19a86f9a53cc94f0c..53dca8057b6d9289d1f3b6767d4d6ce470e3524f 100644 (file)
@@ -6484,8 +6484,15 @@ compile_def_function(ufunc_T *ufunc, int set_return_type, cctx_T *outer_cctx)
        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)
        {