summaryrefslogtreecommitdiff
path: root/src/vim9compile.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-09-03 21:35:53 +0100
committerBram Moolenaar <Bram@vim.org>2022-09-03 21:35:53 +0100
commit1d84f7608f1e41dad03b8cc7925895437775f7c0 (patch)
treecc276825566021a35b96f93e178e5f2ac621a84b /src/vim9compile.c
parent06d32a0c177e4166ff0491668cd459464bc2ef45 (diff)
downloadvim-git-1d84f7608f1e41dad03b8cc7925895437775f7c0.tar.gz
patch 9.0.0370: cleaning up afterwards can make a function messyv9.0.0370
Problem: Cleaning up afterwards can make a function messy. Solution: Add the :defer command.
Diffstat (limited to 'src/vim9compile.c')
-rw-r--r--src/vim9compile.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/vim9compile.c b/src/vim9compile.c
index a785ba98d..02cbb25df 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -2373,7 +2373,7 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
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 @@ compile_def_function(
// 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 @@ compile_def_function(
line = compile_eval(p, &cctx);
break;
+ case CMD_defer:
+ line = compile_defer(p, &cctx);
+ break;
+
case CMD_echo:
case CMD_echon:
case CMD_echoconsole: