mirror of
https://github.com/vim/vim.git
synced 2025-11-16 23:24:03 -05:00
patch 9.1.1788: Vim9: can declare a void variable
Problem: Vim9: can declare a void variable (Ernie Rael) Solution: Disallow such variable declaration (Yegappan Lakshmanan) fixes: #13773 closes: #18382 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
a7680a1a69
commit
7376fa3fd8
@@ -997,7 +997,7 @@ valid_declaration_type(type_T *type)
|
||||
{
|
||||
char *tofree = NULL;
|
||||
char *name = type_name(type, &tofree);
|
||||
semsg(_(e_invalid_type_for_object_variable_str), name);
|
||||
semsg(_(e_invalid_type_in_variable_declaration_str), name);
|
||||
vim_free(tofree);
|
||||
return FALSE;
|
||||
}
|
||||
@@ -1629,7 +1629,7 @@ parse_type_member(
|
||||
*arg = skipwhite(*arg + 1);
|
||||
|
||||
member_type = parse_type(arg, type_gap, ufunc, cctx, give_error);
|
||||
if (member_type == NULL)
|
||||
if (member_type == NULL || !valid_declaration_type(member_type))
|
||||
return NULL;
|
||||
|
||||
*arg = skipwhite(*arg);
|
||||
@@ -1699,7 +1699,7 @@ parse_type_func(
|
||||
}
|
||||
|
||||
type = parse_type(&p, type_gap, ufunc, cctx, give_error);
|
||||
if (type == NULL)
|
||||
if (type == NULL || !valid_declaration_type(type))
|
||||
return NULL;
|
||||
if ((flags & TTFLAG_VARARGS) != 0 && type->tt_type != VAR_LIST)
|
||||
{
|
||||
@@ -1831,7 +1831,7 @@ parse_type_tuple(
|
||||
}
|
||||
|
||||
type = parse_type(&p, type_gap, ufunc, cctx, give_error);
|
||||
if (type == NULL)
|
||||
if (type == NULL || !valid_declaration_type(type))
|
||||
goto on_err;
|
||||
|
||||
if ((flags & TTFLAG_VARARGS) != 0 && type->tt_type != VAR_LIST)
|
||||
|
||||
Reference in New Issue
Block a user