Mercurial > vim
diff src/vim9execute.c @ 20255:aac52c32a91f v8.2.0683
patch 8.2.0683: Vim9: parsing type does not always work
Commit: https://github.com/vim/vim/commit/5adc55cb746893c6ddf7865ff654582902dee2e3
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat May 2 23:12:58 2020 +0200
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 02 May 2020 23:15:03 +0200 |
parents | e46e72aaff74 |
children | 683c2da4982b |
line wrap: on
line diff
--- a/src/vim9execute.c +++ b/src/vim9execute.c @@ -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