Skip to content

Commit fed6bda

Browse files
committed
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().
1 parent 0daafaa commit fed6bda

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

src/vim9cmds.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1705,6 +1705,27 @@ get_defer_var_idx(cctx_T *cctx)
17051705
return dfunc->df_defer_var_idx;
17061706
}
17071707

1708+
/*
1709+
* Get the local variable index for deferred function calls.
1710+
* Reserve it when not done already.
1711+
* Returns zero for failure.
1712+
*/
1713+
int
1714+
get_defer_var_idx(cctx_T *cctx)
1715+
{
1716+
dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data)
1717+
+ cctx->ctx_ufunc->uf_dfunc_idx;
1718+
if (dfunc->df_defer_var_idx == 0)
1719+
{
1720+
lvar_T *lvar = reserve_local(cctx, (char_u *)"@defer@", 7,
1721+
TRUE, &t_list_any);
1722+
if (lvar == NULL)
1723+
return 0;
1724+
dfunc->df_defer_var_idx = lvar->lv_idx + 1;
1725+
}
1726+
return dfunc->df_defer_var_idx;
1727+
}
1728+
17081729
/*
17091730
* Compile "defer func(arg)".
17101731
*/

0 commit comments

Comments
 (0)