Patch 8.2.3404
Problem:    Vim9: no error for white space before "(".
Solution:   Give an error, like in a compiled function.
Files:      src/userfunc.c, src/testdir/test_vim9_func.vim


*** ../vim-8.2.3403/src/userfunc.c      2021-08-28 15:56:03.461179888 +0200
--- src/userfunc.c      2021-09-05 16:29:39.056668483 +0200
***************
*** 4921,4933 ****
      // 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;
      }
  
      /*
       * When skipping, evaluate the function once, to find the end of the
--- 4921,4936 ----
      // Skip white space to allow ":call func ()".  Not good, but required for
      // backward compatibility.
      startarg = skipwhite(arg);
      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,4974 ****
--- 4972,4978 ----
        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;
*** ../vim-8.2.3403/src/testdir/test_vim9_func.vim      2021-08-19 
21:08:26.178565751 +0200
--- src/testdir/test_vim9_func.vim      2021-09-05 16:35:12.603822749 +0200
***************
*** 467,472 ****
--- 467,476 ----
    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
*** ../vim-8.2.3403/src/version.c       2021-09-04 21:20:37.895881447 +0200
--- src/version.c       2021-09-05 16:32:22.820257344 +0200
***************
*** 757,758 ****
--- 757,760 ----
  {   /* Add new patch number below this line */
+ /**/
+     3404,
  /**/

-- 
No engineer can take a shower without wondering if some sort of Teflon coating
would make showering unnecessary.
                                (Scott Adams - The Dilbert principle)

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202109051437.185EbbfL1097705%40masaka.moolenaar.net.

Raspunde prin e-mail lui