Mercurial > vim
diff src/vim9.h @ 30065:6cf788ab844c v9.0.0370
patch 9.0.0370: cleaning up afterwards can make a function messy
Commit: https://github.com/vim/vim/commit/1d84f7608f1e41dad03b8cc7925895437775f7c0
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Sep 3 21:35:53 2022 +0100
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 03 Sep 2022 22:45:03 +0200 |
parents | d269dd3cd31d |
children | 6575d0bf6061 |
line wrap: on
line diff
--- 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