# HG changeset patch # User Bram Moolenaar # Date 1662311704 -7200 # Node ID a5417ca098afdf637e1e68125e0a79387ec65f14 # Parent ebed259f919f95c745bdd0396d246cd27a3c9319 patch 9.0.0380: deleting files in tests is a hassle Commit: https://github.com/vim/vim/commit/fed6bdae6f5f15d842d2e33eda6d3ffbc5b258a7 Author: Bram Moolenaar Date: Sun Sep 4 18:10:11 2022 +0100 patch 9.0.0380: deleting files in tests is a hassle Problem: Deleting files in tests is a hassle. Solution: Use the new 'D' flag of writefile(). diff --git a/src/vim9cmds.c b/src/vim9cmds.c --- a/src/vim9cmds.c +++ b/src/vim9cmds.c @@ -1706,6 +1706,27 @@ get_defer_var_idx(cctx_T *cctx) } /* + * Get the local variable index for deferred function calls. + * Reserve it when not done already. + * Returns zero for failure. + */ + int +get_defer_var_idx(cctx_T *cctx) +{ + dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data) + + cctx->ctx_ufunc->uf_dfunc_idx; + if (dfunc->df_defer_var_idx == 0) + { + lvar_T *lvar = reserve_local(cctx, (char_u *)"@defer@", 7, + TRUE, &t_list_any); + if (lvar == NULL) + return 0; + dfunc->df_defer_var_idx = lvar->lv_idx + 1; + } + return dfunc->df_defer_var_idx; +} + +/* * Compile "defer func(arg)". */ char_u *