mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 8.2.2576: Vim9: defining a :func function checks for white space
Problem: Vim9: defining a :func function checks for white space after a comma in the arguments. Solution: Only check for white space in a :def function. (closes #7930)
This commit is contained in:
@@ -1136,6 +1136,23 @@ def Test_arg_type_wrong()
|
|||||||
CheckScriptFailure(['def Func5(items)', 'echo "a"'], 'E1077:')
|
CheckScriptFailure(['def Func5(items)', 'echo "a"'], 'E1077:')
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
|
def Test_white_space_after_comma()
|
||||||
|
var lines =<< trim END
|
||||||
|
vim9script
|
||||||
|
def Func(a: number,b: number)
|
||||||
|
enddef
|
||||||
|
END
|
||||||
|
CheckScriptFailure(lines, 'E1069:')
|
||||||
|
|
||||||
|
# OK in legacy function
|
||||||
|
lines =<< trim END
|
||||||
|
vim9script
|
||||||
|
func Func(a,b)
|
||||||
|
endfunc
|
||||||
|
END
|
||||||
|
CheckScriptSuccess(lines)
|
||||||
|
enddef
|
||||||
|
|
||||||
def Test_vim9script_call()
|
def Test_vim9script_call()
|
||||||
var lines =<< trim END
|
var lines =<< trim END
|
||||||
vim9script
|
vim9script
|
||||||
|
@@ -310,7 +310,8 @@ get_function_args(
|
|||||||
++p;
|
++p;
|
||||||
// Don't give this error when skipping, it makes the "->" not
|
// Don't give this error when skipping, it makes the "->" not
|
||||||
// found in "{k,v -> x}" and give a confusing error.
|
// found in "{k,v -> x}" and give a confusing error.
|
||||||
if (!skip && in_vim9script()
|
// Allow missing space after comma in legacy functions.
|
||||||
|
if (!skip && argtypes != NULL
|
||||||
&& !IS_WHITE_OR_NUL(*p) && *p != endchar)
|
&& !IS_WHITE_OR_NUL(*p) && *p != endchar)
|
||||||
{
|
{
|
||||||
semsg(_(e_white_space_required_after_str_str), ",", p - 1);
|
semsg(_(e_white_space_required_after_str_str), ",", p - 1);
|
||||||
|
@@ -750,6 +750,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 */
|
||||||
|
/**/
|
||||||
|
2576,
|
||||||
/**/
|
/**/
|
||||||
2575,
|
2575,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user