patch 9.0.0370: cleaning up afterwards can make a function messy
Problem: Cleaning up afterwards can make a function messy.
Solution: Add the :defer command.
diff --git a/src/vim9compile.c b/src/vim9compile.c
index a785ba9..02cbb25 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -2373,7 +2373,7 @@
r = generate_PUSHBLOB(cctx, blob_alloc());
break;
case VAR_FUNC:
- r = generate_PUSHFUNC(cctx, NULL, &t_func_void);
+ r = generate_PUSHFUNC(cctx, NULL, &t_func_void, TRUE);
break;
case VAR_LIST:
r = generate_NEWLIST(cctx, 0, FALSE);
@@ -2748,6 +2748,7 @@
// Was compiled in this mode before: Free old instructions.
delete_def_function_contents(dfunc, FALSE);
ga_clear_strings(&dfunc->df_var_names);
+ dfunc->df_defer_var_idx = 0;
}
else
{
@@ -3249,6 +3250,10 @@
line = compile_eval(p, &cctx);
break;
+ case CMD_defer:
+ line = compile_defer(p, &cctx);
+ break;
+
case CMD_echo:
case CMD_echon:
case CMD_echoconsole: