mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
patch 8.2.0683: Vim9: parsing type does not always work
Problem: Vim9: parsing type does not always work. Solution: Handle func type without return value. Test more closures. Fix type check offset. Fix garbage collection.
This commit is contained in:
@@ -2437,11 +2437,12 @@ ex_disassemble(exarg_T *eap)
|
||||
break;
|
||||
case ISN_FUNCREF:
|
||||
{
|
||||
funcref_T *funcref = &iptr->isn_arg.funcref;
|
||||
dfunc_T *df = ((dfunc_T *)def_functions.ga_data)
|
||||
+ iptr->isn_arg.funcref.fr_func;
|
||||
+ funcref->fr_func;
|
||||
|
||||
smsg("%4d FUNCREF %s $%d", current, df->df_ufunc->uf_name,
|
||||
iptr->isn_arg.funcref.fr_var_idx + df->df_varcount);
|
||||
funcref->fr_var_idx + dfunc->df_varcount);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -2675,5 +2676,25 @@ check_not_string(typval_T *tv)
|
||||
return OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Mark items in a def function as used.
|
||||
*/
|
||||
int
|
||||
set_ref_in_dfunc(ufunc_T *ufunc, int copyID)
|
||||
{
|
||||
dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data) + ufunc->uf_dfunc_idx;
|
||||
int abort = FALSE;
|
||||
|
||||
if (dfunc->df_funcstack != NULL)
|
||||
{
|
||||
typval_T *stack = dfunc->df_funcstack->fs_ga.ga_data;
|
||||
int idx;
|
||||
|
||||
for (idx = 0; idx < dfunc->df_funcstack->fs_ga.ga_len; ++idx)
|
||||
abort = abort || set_ref_in_item(stack + idx, copyID, NULL, NULL);
|
||||
}
|
||||
return abort;
|
||||
}
|
||||
|
||||
|
||||
#endif // FEAT_EVAL
|
||||
|
Reference in New Issue
Block a user