0
0
mirror of https://github.com/vim/vim.git synced 2025-09-26 04:04:07 -04:00

patch 8.2.3317: Vim9: No error for missing white space before return type

Problem:    Vim9: No error for missing white space before return type.
Solution:   Check for white space. (closes #8733)
This commit is contained in:
Bram Moolenaar
2021-08-08 19:07:37 +02:00
parent 80a070c361
commit 33ea9fd4d8
3 changed files with 31 additions and 1 deletions

View File

@@ -4066,8 +4066,15 @@ define_function(exarg_T *eap, char_u *name_arg)
if (eap->cmdidx == CMD_def)
{
// find the return type: :def Func(): type
if (*p == ':')
if (*skipwhite(p) == ':')
{
if (*p != ':')
{
semsg(_(e_no_white_space_allowed_before_colon_str), p);
p = skipwhite(p);
}
else if (!IS_WHITE_OR_NUL(p[1]))
semsg(_(e_white_space_required_after_str_str), ":", p);
ret_type = skipwhite(p + 1);
p = skip_type(ret_type, FALSE);
if (p > ret_type)