Skip to content

Commit 01dd6c3

Browse files
committed
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.
1 parent 2ddb89f commit 01dd6c3

3 files changed

Lines changed: 12 additions & 2 deletions

File tree

src/testdir/test_vim9_func.vim

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,10 @@ def Test_call_varargs()
467467
MyVarargs('one', 'two', 'three')->assert_equal('one,two,three')
468468
enddef
469469

470+
def Test_call_white_space()
471+
CheckDefAndScriptFailure2(["call Test ('text')"], 'E476:', 'E1068:')
472+
enddef
473+
470474
def MyDefaultArgs(name = 'string'): string
471475
return name
472476
enddef

src/userfunc.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4921,13 +4921,16 @@ ex_call(exarg_T *eap)
49214921
// Skip white space to allow ":call func ()". Not good, but required for
49224922
// backward compatibility.
49234923
startarg = skipwhite(arg);
4924-
rettv.v_type = VAR_UNKNOWN; // clear_tv() uses this
4925-
49264924
if (*startarg != '(')
49274925
{
49284926
semsg(_(e_missing_paren), eap->arg);
49294927
goto end;
49304928
}
4929+
if (in_vim9script() && startarg > arg)
4930+
{
4931+
semsg(_(e_no_white_space_allowed_before_str_str), "(", eap->arg);
4932+
goto end;
4933+
}
49314934

49324935
/*
49334936
* When skipping, evaluate the function once, to find the end of the
@@ -4969,6 +4972,7 @@ ex_call(exarg_T *eap)
49694972
funcexe.partial = partial;
49704973
funcexe.selfdict = fudi.fd_dict;
49714974
funcexe.check_type = type;
4975+
rettv.v_type = VAR_UNKNOWN; // clear_tv() uses this
49724976
if (get_func_tv(name, -1, &rettv, &arg, &evalarg, &funcexe) == FAIL)
49734977
{
49744978
failed = TRUE;

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,8 @@ static char *(features[]) =
755755

756756
static int included_patches[] =
757757
{ /* Add new patch number below this line */
758+
/**/
759+
3404,
758760
/**/
759761
3403,
760762
/**/

0 commit comments

Comments
 (0)