Skip to content

Commit

Permalink
patch 8.2.3404: Vim9: no error for white space before "("
Browse files Browse the repository at this point in the history
Problem:    Vim9: no error for white space before "(".
Solution:   Give an error, like in a compiled function.
  • Loading branch information
brammool committed Sep 5, 2021
1 parent 2ddb89f commit 01dd6c3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/testdir/test_vim9_func.vim
Expand Up @@ -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
Expand Down
8 changes: 6 additions & 2 deletions src/userfunc.c
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -755,6 +755,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
3404,
/**/
3403,
/**/
Expand Down

0 comments on commit 01dd6c3

Please sign in to comment.