0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -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

@@ -398,6 +398,9 @@ check_ufunc_arg_types(ufunc_T *ufunc, int argcount, int off, ectx_T *ectx)
if (argv[i].v_type == VAR_SPECIAL
&& argv[i].vval.v_number == VVAL_NONE)
continue;
// only pass values to user functions, never types
if (check_typval_is_value(&argv[i]) == FAIL)
return FAIL;
if (i < ufunc->uf_args.ga_len && ufunc->uf_arg_types != NULL)
type = ufunc->uf_arg_types[i];
@@ -4462,6 +4465,12 @@ exec_instructions(ectx_T *ectx)
garray_T *trystack = &ectx->ec_trystack;
trycmd_T *trycmd = NULL;
///////////////////////////////////////////////////
// TODO: If FAIL, line number in output not correct
///////////////////////////////////////////////////
if (check_typval_is_value(STACK_TV_BOT(-1)) == FAIL)
goto theend;
if (trystack->ga_len > 0)
trycmd = ((trycmd_T *)trystack->ga_data)
+ trystack->ga_len - 1;