refactor: remove FC_DEAD

It's for Vim9 script only.
This commit is contained in:
zeertzjq
2023-04-15 21:05:55 +08:00
parent c5ec823a14
commit 9770dcf96d
3 changed files with 10 additions and 11 deletions

View File

@@ -2015,12 +2015,11 @@ static void list_functions(regmatch_T *regmatch)
if (!HASHITEM_EMPTY(hi)) { if (!HASHITEM_EMPTY(hi)) {
ufunc_T *fp = HI2UF(hi); ufunc_T *fp = HI2UF(hi);
todo--; todo--;
if ((fp->uf_flags & FC_DEAD) == 0 if (regmatch == NULL
&& (regmatch == NULL ? (!message_filtered(fp->uf_name)
? (!message_filtered(fp->uf_name) && !func_name_refcount(fp->uf_name))
&& !func_name_refcount(fp->uf_name)) : (!isdigit((uint8_t)(*fp->uf_name))
: (!isdigit((uint8_t)(*fp->uf_name)) && vim_regexec(regmatch, fp->uf_name, 0))) {
&& vim_regexec(regmatch, fp->uf_name, 0)))) {
list_func_head(fp, false, false); list_func_head(fp, false, false);
if (changed != func_hashtab.ht_changed) { if (changed != func_hashtab.ht_changed) {
emsg(_("E454: function list was modified")); emsg(_("E454: function list was modified"));

View File

@@ -28,10 +28,10 @@ struct funccal_entry;
#define FC_DELETED 0x10 // :delfunction used while uf_refcount > 0 #define FC_DELETED 0x10 // :delfunction used while uf_refcount > 0
#define FC_REMOVED 0x20 // function redefined while uf_refcount > 0 #define FC_REMOVED 0x20 // function redefined while uf_refcount > 0
#define FC_SANDBOX 0x40 // function defined in the sandbox #define FC_SANDBOX 0x40 // function defined in the sandbox
#define FC_DEAD 0x80 // function kept only for reference to dfunc // #define FC_DEAD 0x80 // function kept only for reference to dfunc
#define FC_EXPORT 0x100 // "export def Func()" // #define FC_EXPORT 0x100 // "export def Func()"
#define FC_NOARGS 0x200 // no a: variables in lambda #define FC_NOARGS 0x200 // no a: variables in lambda
#define FC_VIM9 0x400 // defined in vim9 script file // #define FC_VIM9 0x400 // defined in vim9 script file
#define FC_LUAREF 0x800 // luaref callback #define FC_LUAREF 0x800 // luaref callback
/// Structure used by trans_function_name() /// Structure used by trans_function_name()

View File

@@ -2368,8 +2368,8 @@ static list_T *get_script_local_funcs(scid_T sid)
// looking for functions with script ID "sid". // looking for functions with script ID "sid".
HASHTAB_ITER(functbl, hi, { HASHTAB_ITER(functbl, hi, {
const ufunc_T *const fp = HI2UF(hi); const ufunc_T *const fp = HI2UF(hi);
// Add active functions with script id == "sid" // Add functions with script id == "sid"
if (!(fp->uf_flags & FC_DEAD) && (fp->uf_script_ctx.sc_sid == sid)) { if (fp->uf_script_ctx.sc_sid == sid) {
const char *const name = fp->uf_name_exp != NULL ? fp->uf_name_exp : fp->uf_name; const char *const name = fp->uf_name_exp != NULL ? fp->uf_name_exp : fp->uf_name;
tv_list_append_string(l, name, -1); tv_list_append_string(l, name, -1);
} }