0
0
mirror of https://github.com/vim/vim.git synced 2025-11-15 23:14:06 -05:00

patch 8.2.3796: the funcexe_T struct members are not named consistently

Problem:    The funcexe_T struct members are not named consistently.
Solution:   Prefix "fe_" to all the members.
This commit is contained in:
Bram Moolenaar
2021-12-13 14:26:44 +00:00
parent 739f13a55b
commit 851f86b951
8 changed files with 87 additions and 84 deletions

View File

@@ -256,7 +256,7 @@ eval_expr_typval(typval_T *expr, typval_T *argv, int argc, typval_T *rettv)
if (s == NULL || *s == NUL) if (s == NULL || *s == NUL)
return FAIL; return FAIL;
CLEAR_FIELD(funcexe); CLEAR_FIELD(funcexe);
funcexe.evaluate = TRUE; funcexe.fe_evaluate = TRUE;
if (call_func(s, -1, rettv, argc, argv, &funcexe) == FAIL) if (call_func(s, -1, rettv, argc, argv, &funcexe) == FAIL)
return FAIL; return FAIL;
} }
@@ -280,8 +280,8 @@ eval_expr_typval(typval_T *expr, typval_T *argv, int argc, typval_T *rettv)
if (s == NULL || *s == NUL) if (s == NULL || *s == NUL)
return FAIL; return FAIL;
CLEAR_FIELD(funcexe); CLEAR_FIELD(funcexe);
funcexe.evaluate = TRUE; funcexe.fe_evaluate = TRUE;
funcexe.partial = partial; funcexe.fe_partial = partial;
if (call_func(s, -1, rettv, argc, argv, &funcexe) == FAIL) if (call_func(s, -1, rettv, argc, argv, &funcexe) == FAIL)
return FAIL; return FAIL;
} }
@@ -644,9 +644,9 @@ call_vim_function(
rettv->v_type = VAR_UNKNOWN; // clear_tv() uses this rettv->v_type = VAR_UNKNOWN; // clear_tv() uses this
CLEAR_FIELD(funcexe); CLEAR_FIELD(funcexe);
funcexe.firstline = curwin->w_cursor.lnum; funcexe.fe_firstline = curwin->w_cursor.lnum;
funcexe.lastline = curwin->w_cursor.lnum; funcexe.fe_lastline = curwin->w_cursor.lnum;
funcexe.evaluate = TRUE; funcexe.fe_evaluate = TRUE;
ret = call_func(func, -1, rettv, argc, argv, &funcexe); ret = call_func(func, -1, rettv, argc, argv, &funcexe);
if (ret == FAIL) if (ret == FAIL)
clear_tv(rettv); clear_tv(rettv);
@@ -2009,12 +2009,12 @@ eval_func(
// Invoke the function. // Invoke the function.
CLEAR_FIELD(funcexe); CLEAR_FIELD(funcexe);
funcexe.firstline = curwin->w_cursor.lnum; funcexe.fe_firstline = curwin->w_cursor.lnum;
funcexe.lastline = curwin->w_cursor.lnum; funcexe.fe_lastline = curwin->w_cursor.lnum;
funcexe.evaluate = evaluate; funcexe.fe_evaluate = evaluate;
funcexe.partial = partial; funcexe.fe_partial = partial;
funcexe.basetv = basetv; funcexe.fe_basetv = basetv;
funcexe.check_type = type; funcexe.fe_check_type = type;
funcexe.fe_found_var = found_var; funcexe.fe_found_var = found_var;
ret = get_func_tv(s, len, rettv, arg, evalarg, &funcexe); ret = get_func_tv(s, len, rettv, arg, evalarg, &funcexe);
} }
@@ -3805,12 +3805,12 @@ call_func_rettv(
s = (char_u *)""; s = (char_u *)"";
CLEAR_FIELD(funcexe); CLEAR_FIELD(funcexe);
funcexe.firstline = curwin->w_cursor.lnum; funcexe.fe_firstline = curwin->w_cursor.lnum;
funcexe.lastline = curwin->w_cursor.lnum; funcexe.fe_lastline = curwin->w_cursor.lnum;
funcexe.evaluate = evaluate; funcexe.fe_evaluate = evaluate;
funcexe.partial = pt; funcexe.fe_partial = pt;
funcexe.selfdict = selfdict; funcexe.fe_selfdict = selfdict;
funcexe.basetv = basetv; funcexe.fe_basetv = basetv;
ret = get_func_tv(s, -1, rettv, arg, evalarg, &funcexe); ret = get_func_tv(s, -1, rettv, arg, evalarg, &funcexe);
theend: theend:

View File

@@ -1935,9 +1935,9 @@ item_compare2(const void *s1, const void *s2)
rettv.v_type = VAR_UNKNOWN; // clear_tv() uses this rettv.v_type = VAR_UNKNOWN; // clear_tv() uses this
CLEAR_FIELD(funcexe); CLEAR_FIELD(funcexe);
funcexe.evaluate = TRUE; funcexe.fe_evaluate = TRUE;
funcexe.partial = partial; funcexe.fe_partial = partial;
funcexe.selfdict = sortinfo->item_compare_selfdict; funcexe.fe_selfdict = sortinfo->item_compare_selfdict;
res = call_func(func_name, -1, &rettv, 2, argv, &funcexe); res = call_func(func_name, -1, &rettv, 2, argv, &funcexe);
clear_tv(&argv[0]); clear_tv(&argv[0]);
clear_tv(&argv[1]); clear_tv(&argv[1]);
@@ -3203,9 +3203,9 @@ f_reduce(typval_T *argvars, typval_T *rettv)
return; return;
} }
vim_memset(&funcexe, 0, sizeof(funcexe)); CLEAR_FIELD(funcexe);
funcexe.evaluate = TRUE; funcexe.fe_evaluate = TRUE;
funcexe.partial = partial; funcexe.fe_partial = partial;
if (argvars[0].v_type == VAR_LIST) if (argvars[0].v_type == VAR_LIST)
{ {

View File

@@ -2033,8 +2033,8 @@ vim_regsub_both(
argv[0].vval.v_list = &matchList.sl_list; argv[0].vval.v_list = &matchList.sl_list;
matchList.sl_list.lv_len = 0; matchList.sl_list.lv_len = 0;
CLEAR_FIELD(funcexe); CLEAR_FIELD(funcexe);
funcexe.argv_func = fill_submatch_list; funcexe.fe_argv_func = fill_submatch_list;
funcexe.evaluate = TRUE; funcexe.fe_evaluate = TRUE;
if (expr->v_type == VAR_FUNC) if (expr->v_type == VAR_FUNC)
{ {
s = expr->vval.v_string; s = expr->vval.v_string;
@@ -2045,7 +2045,7 @@ vim_regsub_both(
partial_T *partial = expr->vval.v_partial; partial_T *partial = expr->vval.v_partial;
s = partial_name(partial); s = partial_name(partial);
funcexe.partial = partial; funcexe.fe_partial = partial;
call_func(s, -1, &rettv, 1, argv, &funcexe); call_func(s, -1, &rettv, 1, argv, &funcexe);
} }
if (matchList.sl_list.lv_len > 0) if (matchList.sl_list.lv_len > 0)

View File

@@ -1992,15 +1992,15 @@ typedef struct
// called_func_argcount) // called_func_argcount)
// //
typedef struct { typedef struct {
int (* argv_func)(int, typval_T *, int, int); int (* fe_argv_func)(int, typval_T *, int, int);
linenr_T firstline; // first line of range linenr_T fe_firstline; // first line of range
linenr_T lastline; // last line of range linenr_T fe_lastline; // last line of range
int *doesrange; // if not NULL: return: function handled range int *fe_doesrange; // if not NULL: return: function handled range
int evaluate; // actually evaluate expressions int fe_evaluate; // actually evaluate expressions
partial_T *partial; // for extra arguments partial_T *fe_partial; // for extra arguments
dict_T *selfdict; // Dictionary for "self" dict_T *fe_selfdict; // Dictionary for "self"
typval_T *basetv; // base for base->method() typval_T *fe_basetv; // base for base->method()
type_T *check_type; // type from funcref or NULL type_T *fe_check_type; // type from funcref or NULL
int fe_found_var; // if the function is not found then give an int fe_found_var; // if the function is not found then give an
// error that a variable is not callable. // error that a variable is not callable.
} funcexe_T; } funcexe_T;

View File

@@ -4334,9 +4334,9 @@ handle_call_command(term_T *term, channel_T *channel, listitem_T *item)
argvars[0].vval.v_number = term->tl_buffer->b_fnum; argvars[0].vval.v_number = term->tl_buffer->b_fnum;
argvars[1] = item->li_next->li_tv; argvars[1] = item->li_next->li_tv;
CLEAR_FIELD(funcexe); CLEAR_FIELD(funcexe);
funcexe.firstline = 1L; funcexe.fe_firstline = 1L;
funcexe.lastline = 1L; funcexe.fe_lastline = 1L;
funcexe.evaluate = TRUE; funcexe.fe_evaluate = TRUE;
if (call_func(func, -1, &rettv, 2, argvars, &funcexe) == OK) if (call_func(func, -1, &rettv, 2, argvars, &funcexe) == OK)
{ {
clear_tv(&rettv); clear_tv(&rettv);

View File

@@ -1696,8 +1696,8 @@ get_func_tv(
* Get the arguments. * Get the arguments.
*/ */
argp = *arg; argp = *arg;
while (argcount < MAX_FUNC_ARGS - (funcexe->partial == NULL ? 0 while (argcount < MAX_FUNC_ARGS - (funcexe->fe_partial == NULL ? 0
: funcexe->partial->pt_argc)) : funcexe->fe_partial->pt_argc))
{ {
// skip the '(' or ',' and possibly line breaks // skip the '(' or ',' and possibly line breaks
argp = skipwhite_and_linebreak(argp + 1, evalarg); argp = skipwhite_and_linebreak(argp + 1, evalarg);
@@ -2500,7 +2500,7 @@ call_user_func(
if (do_profiling == PROF_YES) if (do_profiling == PROF_YES)
profile_may_start_func(&profile_info, fp, caller); profile_may_start_func(&profile_info, fp, caller);
#endif #endif
call_def_function(fp, argcount, argvars, funcexe->partial, rettv); call_def_function(fp, argcount, argvars, funcexe->fe_partial, rettv);
funcdepth_decrement(); funcdepth_decrement();
#ifdef FEAT_PROFILE #ifdef FEAT_PROFILE
if (do_profiling == PROF_YES && (fp->uf_profiling if (do_profiling == PROF_YES && (fp->uf_profiling
@@ -2575,9 +2575,9 @@ call_user_func(
if ((fp->uf_flags & FC_NOARGS) == 0) if ((fp->uf_flags & FC_NOARGS) == 0)
{ {
add_nr_var(&fc->l_avars, &fc->fixvar[fixvar_idx++].var, "firstline", add_nr_var(&fc->l_avars, &fc->fixvar[fixvar_idx++].var, "firstline",
(varnumber_T)funcexe->firstline); (varnumber_T)funcexe->fe_firstline);
add_nr_var(&fc->l_avars, &fc->fixvar[fixvar_idx++].var, "lastline", add_nr_var(&fc->l_avars, &fc->fixvar[fixvar_idx++].var, "lastline",
(varnumber_T)funcexe->lastline); (varnumber_T)funcexe->fe_lastline);
} }
for (i = 0; i < argcount || i < fp->uf_args.ga_len; ++i) for (i = 0; i < argcount || i < fp->uf_args.ga_len; ++i)
{ {
@@ -2870,8 +2870,8 @@ call_user_func_check(
{ {
int error; int error;
if (fp->uf_flags & FC_RANGE && funcexe->doesrange != NULL) if (fp->uf_flags & FC_RANGE && funcexe->fe_doesrange != NULL)
*funcexe->doesrange = TRUE; *funcexe->fe_doesrange = TRUE;
error = check_user_func_argcount(fp, argcount); error = check_user_func_argcount(fp, argcount);
if (error != FCERR_UNKNOWN) if (error != FCERR_UNKNOWN)
return error; return error;
@@ -3126,11 +3126,11 @@ func_call(
funcexe_T funcexe; funcexe_T funcexe;
CLEAR_FIELD(funcexe); CLEAR_FIELD(funcexe);
funcexe.firstline = curwin->w_cursor.lnum; funcexe.fe_firstline = curwin->w_cursor.lnum;
funcexe.lastline = curwin->w_cursor.lnum; funcexe.fe_lastline = curwin->w_cursor.lnum;
funcexe.evaluate = TRUE; funcexe.fe_evaluate = TRUE;
funcexe.partial = partial; funcexe.fe_partial = partial;
funcexe.selfdict = selfdict; funcexe.fe_selfdict = selfdict;
r = call_func(name, -1, rettv, argc, argv, &funcexe); r = call_func(name, -1, rettv, argc, argv, &funcexe);
} }
@@ -3168,8 +3168,8 @@ call_callback(
if (callback->cb_name == NULL || *callback->cb_name == NUL) if (callback->cb_name == NULL || *callback->cb_name == NUL)
return FAIL; return FAIL;
CLEAR_FIELD(funcexe); CLEAR_FIELD(funcexe);
funcexe.evaluate = TRUE; funcexe.fe_evaluate = TRUE;
funcexe.partial = callback->cb_partial; funcexe.fe_partial = callback->cb_partial;
++callback_depth; ++callback_depth;
ret = call_func(callback->cb_name, len, rettv, argcount, argvars, &funcexe); ret = call_func(callback->cb_name, len, rettv, argcount, argvars, &funcexe);
--callback_depth; --callback_depth;
@@ -3265,12 +3265,12 @@ call_func(
char_u *name = NULL; char_u *name = NULL;
int argcount = argcount_in; int argcount = argcount_in;
typval_T *argvars = argvars_in; typval_T *argvars = argvars_in;
dict_T *selfdict = funcexe->selfdict; dict_T *selfdict = funcexe->fe_selfdict;
typval_T argv[MAX_FUNC_ARGS + 1]; // used when "partial" or typval_T argv[MAX_FUNC_ARGS + 1]; // used when "partial" or
// "funcexe->basetv" is not NULL // "funcexe->fe_basetv" is not NULL
int argv_clear = 0; int argv_clear = 0;
int argv_base = 0; int argv_base = 0;
partial_T *partial = funcexe->partial; partial_T *partial = funcexe->fe_partial;
type_T check_type; type_T check_type;
// Initialize rettv so that it is safe for caller to invoke clear_tv(rettv) // Initialize rettv so that it is safe for caller to invoke clear_tv(rettv)
@@ -3290,8 +3290,8 @@ call_func(
fname = fname_trans_sid(name, fname_buf, &tofree, &error); fname = fname_trans_sid(name, fname_buf, &tofree, &error);
} }
if (funcexe->doesrange != NULL) if (funcexe->fe_doesrange != NULL)
*funcexe->doesrange = FALSE; *funcexe->fe_doesrange = FALSE;
if (partial != NULL) if (partial != NULL)
{ {
@@ -3316,28 +3316,29 @@ call_func(
argvars = argv; argvars = argv;
argcount = partial->pt_argc + argcount_in; argcount = partial->pt_argc + argcount_in;
if (funcexe->check_type != NULL if (funcexe->fe_check_type != NULL
&& funcexe->check_type->tt_argcount != -1) && funcexe->fe_check_type->tt_argcount != -1)
{ {
// Now funcexe->check_type is missing the added arguments, make // Now funcexe->fe_check_type is missing the added arguments,
// a copy of the type with the correction. // make a copy of the type with the correction.
check_type = *funcexe->check_type; check_type = *funcexe->fe_check_type;
funcexe->check_type = &check_type; funcexe->fe_check_type = &check_type;
check_type.tt_argcount += partial->pt_argc; check_type.tt_argcount += partial->pt_argc;
check_type.tt_min_argcount += partial->pt_argc; check_type.tt_min_argcount += partial->pt_argc;
} }
} }
} }
if (error == FCERR_NONE && funcexe->check_type != NULL && funcexe->evaluate) if (error == FCERR_NONE && funcexe->fe_check_type != NULL
&& funcexe->fe_evaluate)
{ {
// Check that the argument types are OK for the types of the funcref. // Check that the argument types are OK for the types of the funcref.
if (check_argument_types(funcexe->check_type, argvars, argcount, if (check_argument_types(funcexe->fe_check_type, argvars, argcount,
(name != NULL) ? name : funcname) == FAIL) (name != NULL) ? name : funcname) == FAIL)
error = FCERR_OTHER; error = FCERR_OTHER;
} }
if (error == FCERR_NONE && funcexe->evaluate) if (error == FCERR_NONE && funcexe->fe_evaluate)
{ {
char_u *rfname = fname; char_u *rfname = fname;
int is_global = FALSE; int is_global = FALSE;
@@ -3398,16 +3399,16 @@ call_func(
#endif #endif
else if (fp != NULL) else if (fp != NULL)
{ {
if (funcexe->argv_func != NULL) if (funcexe->fe_argv_func != NULL)
// postponed filling in the arguments, do it now // postponed filling in the arguments, do it now
argcount = funcexe->argv_func(argcount, argvars, argv_clear, argcount = funcexe->fe_argv_func(argcount, argvars,
fp->uf_args.ga_len); argv_clear, fp->uf_args.ga_len);
if (funcexe->basetv != NULL) if (funcexe->fe_basetv != NULL)
{ {
// Method call: base->Method() // Method call: base->Method()
mch_memmove(&argv[1], argvars, sizeof(typval_T) * argcount); mch_memmove(&argv[1], argvars, sizeof(typval_T) * argcount);
argv[0] = *funcexe->basetv; argv[0] = *funcexe->fe_basetv;
argcount++; argcount++;
argvars = argv; argvars = argv;
argv_base = 1; argv_base = 1;
@@ -3417,14 +3418,14 @@ call_func(
funcexe, selfdict); funcexe, selfdict);
} }
} }
else if (funcexe->basetv != NULL) else if (funcexe->fe_basetv != NULL)
{ {
/* /*
* expr->method(): Find the method name in the table, call its * expr->method(): Find the method name in the table, call its
* implementation with the base as one of the arguments. * implementation with the base as one of the arguments.
*/ */
error = call_internal_method(fname, argcount, argvars, rettv, error = call_internal_method(fname, argcount, argvars, rettv,
funcexe->basetv); funcexe->fe_basetv);
} }
else else
{ {
@@ -5098,13 +5099,13 @@ ex_call(exarg_T *eap)
arg = startarg; arg = startarg;
CLEAR_FIELD(funcexe); CLEAR_FIELD(funcexe);
funcexe.firstline = eap->line1; funcexe.fe_firstline = eap->line1;
funcexe.lastline = eap->line2; funcexe.fe_lastline = eap->line2;
funcexe.doesrange = &doesrange; funcexe.fe_doesrange = &doesrange;
funcexe.evaluate = !eap->skip; funcexe.fe_evaluate = !eap->skip;
funcexe.partial = partial; funcexe.fe_partial = partial;
funcexe.selfdict = fudi.fd_dict; funcexe.fe_selfdict = fudi.fd_dict;
funcexe.check_type = type; funcexe.fe_check_type = type;
funcexe.fe_found_var = found_var; funcexe.fe_found_var = found_var;
rettv.v_type = VAR_UNKNOWN; // clear_tv() uses this rettv.v_type = VAR_UNKNOWN; // clear_tv() uses this
if (get_func_tv(name, -1, &rettv, &arg, &evalarg, &funcexe) == FAIL) if (get_func_tv(name, -1, &rettv, &arg, &evalarg, &funcexe) == FAIL)

View File

@@ -749,6 +749,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
3796,
/**/ /**/
3795, 3795,
/**/ /**/

View File

@@ -876,13 +876,13 @@ call_ufunc(
if (call_prepare(argcount, argvars, ectx) == FAIL) if (call_prepare(argcount, argvars, ectx) == FAIL)
return FAIL; return FAIL;
CLEAR_FIELD(funcexe); CLEAR_FIELD(funcexe);
funcexe.evaluate = TRUE; funcexe.fe_evaluate = TRUE;
funcexe.selfdict = selfdict != NULL ? selfdict : dict_stack_get_dict(); funcexe.fe_selfdict = selfdict != NULL ? selfdict : dict_stack_get_dict();
// Call the user function. Result goes in last position on the stack. // Call the user function. Result goes in last position on the stack.
// TODO: add selfdict if there is one // TODO: add selfdict if there is one
error = call_user_func_check(ufunc, argcount, argvars, error = call_user_func_check(ufunc, argcount, argvars,
STACK_TV_BOT(-1), &funcexe, funcexe.selfdict); STACK_TV_BOT(-1), &funcexe, funcexe.fe_selfdict);
// Clear the arguments. // Clear the arguments.
for (idx = 0; idx < argcount; ++idx) for (idx = 0; idx < argcount; ++idx)