0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 9.0.2164: Vim9: can use type a func arg/return value

Problem:  Vim9: can use type a func arg/return value
Solution: Check if using type as function argument or return value

closes: #13675

Signed-off-by: Ernie Rael <errael@raelity.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Ernie Rael
2023-12-14 20:11:44 +01:00
committed by Christian Brabandt
parent 9a775b4a2a
commit b077b58809
10 changed files with 271 additions and 10 deletions

View File

@@ -1821,6 +1821,8 @@ generate_CALL(
type_T *actual;
actual = get_type_on_stack(cctx, argcount - i - 1);
if (check_type_is_value(actual) == FAIL)
return FAIL;
if (actual->tt_type == VAR_SPECIAL
&& i >= regular_args - ufunc->uf_def_args.ga_len)
{
@@ -1960,6 +1962,8 @@ check_func_args_from_type(
type_T *actual = get_type_on_stack(cctx, -1 - offset);
type_T *expected;
if (check_type_is_value(actual) == FAIL)
return FAIL;
if (varargs && i >= type->tt_argcount - 1)
{
expected = type->tt_args[type->tt_argcount - 1];