]> granicus.if.org Git - vim/commitdiff
patch 8.2.3404: Vim9: no error for white space before "(" v8.2.3404
authorBram Moolenaar <Bram@vim.org>
Sun, 5 Sep 2021 14:36:23 +0000 (16:36 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 5 Sep 2021 14:36:23 +0000 (16:36 +0200)
Problem:    Vim9: no error for white space before "(".
Solution:   Give an error, like in a compiled function.

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

index f0c4c0d91c91c0e0412d15278a84b337ea95e09e..09f80e9d19b808629b89d6302a2f8327e7d13d6a 100644 (file)
@@ -467,6 +467,10 @@ def Test_call_varargs()
   MyVarargs('one', 'two', 'three')->assert_equal('one,two,three')
 enddef
 
+def Test_call_white_space()
+  CheckDefAndScriptFailure2(["call Test ('text')"], 'E476:', 'E1068:')
+enddef
+
 def MyDefaultArgs(name = 'string'): string
   return name
 enddef
index 4a2b05e0ce2e7af847c8f39314a8def6f325b90a..aa55bc85ead7fb6b9242b9dba2dcb9e3651110ba 100644 (file)
@@ -4921,13 +4921,16 @@ ex_call(exarg_T *eap)
     // Skip white space to allow ":call func ()".  Not good, but required for
     // backward compatibility.
     startarg = skipwhite(arg);
-    rettv.v_type = VAR_UNKNOWN;        // clear_tv() uses this
-
     if (*startarg != '(')
     {
        semsg(_(e_missing_paren), eap->arg);
        goto end;
     }
+    if (in_vim9script() && startarg > arg)
+    {
+       semsg(_(e_no_white_space_allowed_before_str_str), "(", eap->arg);
+       goto end;
+    }
 
     /*
      * When skipping, evaluate the function once, to find the end of the
@@ -4969,6 +4972,7 @@ ex_call(exarg_T *eap)
        funcexe.partial = partial;
        funcexe.selfdict = fudi.fd_dict;
        funcexe.check_type = type;
+       rettv.v_type = VAR_UNKNOWN;     // clear_tv() uses this
        if (get_func_tv(name, -1, &rettv, &arg, &evalarg, &funcexe) == FAIL)
        {
            failed = TRUE;
index 97467aab99206058526bad55f95f1a0eff685fa7..cfddf6bad62b8f089f72f7ba63671ec5b87187bc 100644 (file)
@@ -755,6 +755,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3404,
 /**/
     3403,
 /**/