diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-09-03 21:35:53 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-09-03 21:35:53 +0100 |
commit | 1d84f7608f1e41dad03b8cc7925895437775f7c0 (patch) | |
tree | cc276825566021a35b96f93e178e5f2ac621a84b /src/vim9.h | |
parent | 06d32a0c177e4166ff0491668cd459464bc2ef45 (diff) | |
download | vim-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/vim9.h')
-rw-r--r-- | src/vim9.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/vim9.h b/src/vim9.h index b32dbeab4..22a3f3990 100644 --- a/src/vim9.h +++ b/src/vim9.h @@ -113,6 +113,7 @@ typedef enum { ISN_FUNCREF, // push a function ref to dfunc isn_arg.funcref ISN_NEWFUNC, // create a global function from a lambda function ISN_DEF, // list functions + ISN_DEFER, // :defer argument count is isn_arg.number // expression operations ISN_JUMP, // jump if condition is matched isn_arg.jump @@ -419,6 +420,12 @@ typedef struct { int dbg_break_lnum; // first line to break after } debug_T; +// arguments to ISN_DEFER +typedef struct { + int defer_var_idx; // local variable index for defer list + int defer_argcount; // number of arguments +} deferins_T; + /* * Instruction */ @@ -468,6 +475,7 @@ struct isn_S { tobool_T tobool; getitem_T getitem; debug_T debug; + deferins_T defer; } isn_arg; }; @@ -498,6 +506,9 @@ struct dfunc_S { int df_varcount; // number of local variables int df_has_closure; // one if a closure was created + int df_defer_var_idx; // index of local variable that has a list + // of deferred function calls; zero if not + // set }; // Number of entries used by stack frame for a function call. @@ -735,6 +746,15 @@ struct cctx_S { // lhs_name is not NULL }; +/* + * List of special functions for "compile_arguments()". + */ +typedef enum { + CA_NOT_SPECIAL, + CA_SEARCHPAIR, // {skip} in searchpair() and searchpairpos() + CA_SUBSTITUTE, // {sub} in substitute(), when prefixed with \= +} ca_special_T; + // flags for typval2type() #define TVTT_DO_MEMBER 1 #define TVTT_MORE_SPECIFIC 2 // get most specific type for member |