diff src/userfunc.c @ 25737:d923be9d752d v8.2.3404

patch 8.2.3404: Vim9: no error for white space before "(" Commit: https://github.com/vim/vim/commit/01dd6c3732a2f352d598e36336a65049614d7508 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Sep 5 16:36:23 2021 +0200 patch 8.2.3404: Vim9: no error for white space before "(" Problem: Vim9: no error for white space before "(". Solution: Give an error, like in a compiled function.
author Bram Moolenaar <Bram@vim.org>
date Sun, 05 Sep 2021 16:45:03 +0200
parents ce91372ca07b
children b916d59f259f
line wrap: on
line diff
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -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;