mirror of
https://github.com/vim/vim.git
synced 2025-10-23 08:44:20 -04:00
patch 8.2.0276: Vim9: not allowing space before ")" in function call
Problem: Vim9: not allowing space before ")" in function call is too restrictive. (Ben Jackson) Solution: Skip space before the ")". Adjust other space checks.
This commit is contained in:
@@ -9,6 +9,14 @@ func CheckDefFailure(line, error)
|
|||||||
call delete('Xdef')
|
call delete('Xdef')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
" Check that "line" inside ":def" results in an "error" message when executed.
|
||||||
|
func CheckDefExecFailure(line, error)
|
||||||
|
call writefile(['def! Func()', a:line, 'enddef'], 'Xdef')
|
||||||
|
so Xdef
|
||||||
|
call assert_fails('call Func()', a:error, a:line)
|
||||||
|
call delete('Xdef')
|
||||||
|
endfunc
|
||||||
|
|
||||||
func CheckDefFailureList(lines, error)
|
func CheckDefFailureList(lines, error)
|
||||||
call writefile(['def! Func()'] + a:lines + ['enddef'], 'Xdef')
|
call writefile(['def! Func()'] + a:lines + ['enddef'], 'Xdef')
|
||||||
call assert_fails('so Xdef', a:error, string(a:lines))
|
call assert_fails('so Xdef', a:error, string(a:lines))
|
||||||
@@ -725,9 +733,17 @@ func CallMe(arg)
|
|||||||
return a:arg
|
return a:arg
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func CallMe2(one, two)
|
||||||
|
return a:one .. a:two
|
||||||
|
endfunc
|
||||||
|
|
||||||
def Test_expr7_trailing()
|
def Test_expr7_trailing()
|
||||||
" user function call
|
" user function call
|
||||||
assert_equal(123, CallMe(123))
|
assert_equal(123, CallMe(123))
|
||||||
|
assert_equal(123, CallMe( 123))
|
||||||
|
assert_equal(123, CallMe(123 ))
|
||||||
|
assert_equal('yesno', CallMe2('yes', 'no'))
|
||||||
|
assert_equal('yesno', CallMe2( 'yes', 'no' ))
|
||||||
assert_equal('nothing', CallMe('nothing'))
|
assert_equal('nothing', CallMe('nothing'))
|
||||||
|
|
||||||
" partial call
|
" partial call
|
||||||
@@ -761,4 +777,8 @@ endfunc
|
|||||||
func Test_expr_fails()
|
func Test_expr_fails()
|
||||||
call CheckDefFailure("let x = '1'is2", 'E488:')
|
call CheckDefFailure("let x = '1'is2", 'E488:')
|
||||||
call CheckDefFailure("let x = '1'isnot2", 'E488:')
|
call CheckDefFailure("let x = '1'isnot2", 'E488:')
|
||||||
|
|
||||||
|
call CheckDefExecFailure("CallMe ('yes')", 'E492:')
|
||||||
|
call CheckDefFailure("CallMe2('yes','no')", 'E1069:')
|
||||||
|
call CheckDefFailure("CallMe2('yes' , 'no')", 'E1068:')
|
||||||
endfunc
|
endfunc
|
||||||
|
@@ -738,6 +738,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
276,
|
||||||
/**/
|
/**/
|
||||||
275,
|
275,
|
||||||
/**/
|
/**/
|
||||||
|
@@ -1658,9 +1658,21 @@ compile_arguments(char_u **arg, cctx_T *cctx, int *argcount)
|
|||||||
if (compile_expr1(&p, cctx) == FAIL)
|
if (compile_expr1(&p, cctx) == FAIL)
|
||||||
return FAIL;
|
return FAIL;
|
||||||
++*argcount;
|
++*argcount;
|
||||||
|
|
||||||
|
if (*p != ',' && *skipwhite(p) == ',')
|
||||||
|
{
|
||||||
|
emsg(_("E1068: No white space allowed before ,"));
|
||||||
|
p = skipwhite(p);
|
||||||
|
}
|
||||||
if (*p == ',')
|
if (*p == ',')
|
||||||
p = skipwhite(p + 1);
|
{
|
||||||
|
++p;
|
||||||
|
if (!VIM_ISWHITE(*p))
|
||||||
|
emsg(_("E1069: white space required after ,"));
|
||||||
|
}
|
||||||
|
p = skipwhite(p);
|
||||||
}
|
}
|
||||||
|
p = skipwhite(p);
|
||||||
if (*p != ')')
|
if (*p != ')')
|
||||||
{
|
{
|
||||||
emsg(_(e_missing_close));
|
emsg(_(e_missing_close));
|
||||||
|
Reference in New Issue
Block a user