Mercurial > vim
changeset 26534:28745eec1dda v8.2.3796
patch 8.2.3796: the funcexe_T struct members are not named consistently
Commit: https://github.com/vim/vim/commit/851f86b951cdd67ad9cf3149e46169d1375c8d82
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Dec 13 14:26:44 2021 +0000
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 13 Dec 2021 15:30:03 +0100 |
parents | 88b2affbddd9 |
children | ce0b2d5b39af |
files | src/eval.c src/list.c src/regexp.c src/structs.h src/terminal.c src/userfunc.c src/version.c src/vim9execute.c |
diffstat | 8 files changed, 88 insertions(+), 85 deletions(-) [+] |
line wrap: on
line diff
--- a/src/eval.c +++ b/src/eval.c @@ -256,7 +256,7 @@ eval_expr_typval(typval_T *expr, typval_ if (s == NULL || *s == NUL) return FAIL; CLEAR_FIELD(funcexe); - funcexe.evaluate = TRUE; + funcexe.fe_evaluate = TRUE; if (call_func(s, -1, rettv, argc, argv, &funcexe) == FAIL) return FAIL; } @@ -280,8 +280,8 @@ eval_expr_typval(typval_T *expr, typval_ if (s == NULL || *s == NUL) return FAIL; CLEAR_FIELD(funcexe); - funcexe.evaluate = TRUE; - funcexe.partial = partial; + funcexe.fe_evaluate = TRUE; + funcexe.fe_partial = partial; if (call_func(s, -1, rettv, argc, argv, &funcexe) == FAIL) return FAIL; } @@ -644,9 +644,9 @@ call_vim_function( rettv->v_type = VAR_UNKNOWN; // clear_tv() uses this CLEAR_FIELD(funcexe); - funcexe.firstline = curwin->w_cursor.lnum; - funcexe.lastline = curwin->w_cursor.lnum; - funcexe.evaluate = TRUE; + funcexe.fe_firstline = curwin->w_cursor.lnum; + funcexe.fe_lastline = curwin->w_cursor.lnum; + funcexe.fe_evaluate = TRUE; ret = call_func(func, -1, rettv, argc, argv, &funcexe); if (ret == FAIL) clear_tv(rettv); @@ -2009,12 +2009,12 @@ eval_func( // Invoke the function. CLEAR_FIELD(funcexe); - funcexe.firstline = curwin->w_cursor.lnum; - funcexe.lastline = curwin->w_cursor.lnum; - funcexe.evaluate = evaluate; - funcexe.partial = partial; - funcexe.basetv = basetv; - funcexe.check_type = type; + funcexe.fe_firstline = curwin->w_cursor.lnum; + funcexe.fe_lastline = curwin->w_cursor.lnum; + funcexe.fe_evaluate = evaluate; + funcexe.fe_partial = partial; + funcexe.fe_basetv = basetv; + funcexe.fe_check_type = type; funcexe.fe_found_var = found_var; ret = get_func_tv(s, len, rettv, arg, evalarg, &funcexe); } @@ -3805,12 +3805,12 @@ call_func_rettv( s = (char_u *)""; CLEAR_FIELD(funcexe); - funcexe.firstline = curwin->w_cursor.lnum; - funcexe.lastline = curwin->w_cursor.lnum; - funcexe.evaluate = evaluate; - funcexe.partial = pt; - funcexe.selfdict = selfdict; - funcexe.basetv = basetv; + funcexe.fe_firstline = curwin->w_cursor.lnum; + funcexe.fe_lastline = curwin->w_cursor.lnum; + funcexe.fe_evaluate = evaluate; + funcexe.fe_partial = pt; + funcexe.fe_selfdict = selfdict; + funcexe.fe_basetv = basetv; ret = get_func_tv(s, -1, rettv, arg, evalarg, &funcexe); theend:
--- a/src/list.c +++ b/src/list.c @@ -1935,9 +1935,9 @@ item_compare2(const void *s1, const void rettv.v_type = VAR_UNKNOWN; // clear_tv() uses this CLEAR_FIELD(funcexe); - funcexe.evaluate = TRUE; - funcexe.partial = partial; - funcexe.selfdict = sortinfo->item_compare_selfdict; + funcexe.fe_evaluate = TRUE; + funcexe.fe_partial = partial; + funcexe.fe_selfdict = sortinfo->item_compare_selfdict; res = call_func(func_name, -1, &rettv, 2, argv, &funcexe); clear_tv(&argv[0]); clear_tv(&argv[1]); @@ -3203,9 +3203,9 @@ f_reduce(typval_T *argvars, typval_T *re return; } - vim_memset(&funcexe, 0, sizeof(funcexe)); - funcexe.evaluate = TRUE; - funcexe.partial = partial; + CLEAR_FIELD(funcexe); + funcexe.fe_evaluate = TRUE; + funcexe.fe_partial = partial; if (argvars[0].v_type == VAR_LIST) {
--- a/src/regexp.c +++ b/src/regexp.c @@ -2033,8 +2033,8 @@ vim_regsub_both( argv[0].vval.v_list = &matchList.sl_list; matchList.sl_list.lv_len = 0; CLEAR_FIELD(funcexe); - funcexe.argv_func = fill_submatch_list; - funcexe.evaluate = TRUE; + funcexe.fe_argv_func = fill_submatch_list; + funcexe.fe_evaluate = TRUE; if (expr->v_type == VAR_FUNC) { s = expr->vval.v_string; @@ -2045,7 +2045,7 @@ vim_regsub_both( partial_T *partial = expr->vval.v_partial; s = partial_name(partial); - funcexe.partial = partial; + funcexe.fe_partial = partial; call_func(s, -1, &rettv, 1, argv, &funcexe); } if (matchList.sl_list.lv_len > 0)
--- a/src/structs.h +++ b/src/structs.h @@ -1992,15 +1992,15 @@ typedef struct // called_func_argcount) // typedef struct { - int (* argv_func)(int, typval_T *, int, int); - linenr_T firstline; // first line of range - linenr_T lastline; // last line of range - int *doesrange; // if not NULL: return: function handled range - int evaluate; // actually evaluate expressions - partial_T *partial; // for extra arguments - dict_T *selfdict; // Dictionary for "self" - typval_T *basetv; // base for base->method() - type_T *check_type; // type from funcref or NULL + int (* fe_argv_func)(int, typval_T *, int, int); + linenr_T fe_firstline; // first line of range + linenr_T fe_lastline; // last line of range + int *fe_doesrange; // if not NULL: return: function handled range + int fe_evaluate; // actually evaluate expressions + partial_T *fe_partial; // for extra arguments + dict_T *fe_selfdict; // Dictionary for "self" + typval_T *fe_basetv; // base for base->method() + type_T *fe_check_type; // type from funcref or NULL int fe_found_var; // if the function is not found then give an // error that a variable is not callable. } funcexe_T;
--- a/src/terminal.c +++ b/src/terminal.c @@ -4334,9 +4334,9 @@ handle_call_command(term_T *term, channe argvars[0].vval.v_number = term->tl_buffer->b_fnum; argvars[1] = item->li_next->li_tv; CLEAR_FIELD(funcexe); - funcexe.firstline = 1L; - funcexe.lastline = 1L; - funcexe.evaluate = TRUE; + funcexe.fe_firstline = 1L; + funcexe.fe_lastline = 1L; + funcexe.fe_evaluate = TRUE; if (call_func(func, -1, &rettv, 2, argvars, &funcexe) == OK) { clear_tv(&rettv);
--- a/src/userfunc.c +++ b/src/userfunc.c @@ -1696,8 +1696,8 @@ get_func_tv( * Get the arguments. */ argp = *arg; - while (argcount < MAX_FUNC_ARGS - (funcexe->partial == NULL ? 0 - : funcexe->partial->pt_argc)) + while (argcount < MAX_FUNC_ARGS - (funcexe->fe_partial == NULL ? 0 + : funcexe->fe_partial->pt_argc)) { // skip the '(' or ',' and possibly line breaks argp = skipwhite_and_linebreak(argp + 1, evalarg); @@ -2500,7 +2500,7 @@ call_user_func( if (do_profiling == PROF_YES) profile_may_start_func(&profile_info, fp, caller); #endif - call_def_function(fp, argcount, argvars, funcexe->partial, rettv); + call_def_function(fp, argcount, argvars, funcexe->fe_partial, rettv); funcdepth_decrement(); #ifdef FEAT_PROFILE if (do_profiling == PROF_YES && (fp->uf_profiling @@ -2575,9 +2575,9 @@ call_user_func( if ((fp->uf_flags & FC_NOARGS) == 0) { 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", - (varnumber_T)funcexe->lastline); + (varnumber_T)funcexe->fe_lastline); } for (i = 0; i < argcount || i < fp->uf_args.ga_len; ++i) { @@ -2870,8 +2870,8 @@ call_user_func_check( { int error; - if (fp->uf_flags & FC_RANGE && funcexe->doesrange != NULL) - *funcexe->doesrange = TRUE; + if (fp->uf_flags & FC_RANGE && funcexe->fe_doesrange != NULL) + *funcexe->fe_doesrange = TRUE; error = check_user_func_argcount(fp, argcount); if (error != FCERR_UNKNOWN) return error; @@ -3126,11 +3126,11 @@ func_call( funcexe_T funcexe; CLEAR_FIELD(funcexe); - funcexe.firstline = curwin->w_cursor.lnum; - funcexe.lastline = curwin->w_cursor.lnum; - funcexe.evaluate = TRUE; - funcexe.partial = partial; - funcexe.selfdict = selfdict; + funcexe.fe_firstline = curwin->w_cursor.lnum; + funcexe.fe_lastline = curwin->w_cursor.lnum; + funcexe.fe_evaluate = TRUE; + funcexe.fe_partial = partial; + funcexe.fe_selfdict = selfdict; r = call_func(name, -1, rettv, argc, argv, &funcexe); } @@ -3168,8 +3168,8 @@ call_callback( if (callback->cb_name == NULL || *callback->cb_name == NUL) return FAIL; CLEAR_FIELD(funcexe); - funcexe.evaluate = TRUE; - funcexe.partial = callback->cb_partial; + funcexe.fe_evaluate = TRUE; + funcexe.fe_partial = callback->cb_partial; ++callback_depth; ret = call_func(callback->cb_name, len, rettv, argcount, argvars, &funcexe); --callback_depth; @@ -3265,12 +3265,12 @@ call_func( char_u *name = NULL; int argcount = argcount_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 - // "funcexe->basetv" is not NULL + // "funcexe->fe_basetv" is not NULL int argv_clear = 0; int argv_base = 0; - partial_T *partial = funcexe->partial; + partial_T *partial = funcexe->fe_partial; type_T check_type; // 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); } - if (funcexe->doesrange != NULL) - *funcexe->doesrange = FALSE; + if (funcexe->fe_doesrange != NULL) + *funcexe->fe_doesrange = FALSE; if (partial != NULL) { @@ -3316,28 +3316,29 @@ call_func( argvars = argv; argcount = partial->pt_argc + argcount_in; - if (funcexe->check_type != NULL - && funcexe->check_type->tt_argcount != -1) + if (funcexe->fe_check_type != NULL + && funcexe->fe_check_type->tt_argcount != -1) { - // Now funcexe->check_type is missing the added arguments, make - // a copy of the type with the correction. - check_type = *funcexe->check_type; - funcexe->check_type = &check_type; + // Now funcexe->fe_check_type is missing the added arguments, + // make a copy of the type with the correction. + check_type = *funcexe->fe_check_type; + funcexe->fe_check_type = &check_type; check_type.tt_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. - if (check_argument_types(funcexe->check_type, argvars, argcount, + if (check_argument_types(funcexe->fe_check_type, argvars, argcount, (name != NULL) ? name : funcname) == FAIL) error = FCERR_OTHER; } - if (error == FCERR_NONE && funcexe->evaluate) + if (error == FCERR_NONE && funcexe->fe_evaluate) { char_u *rfname = fname; int is_global = FALSE; @@ -3398,16 +3399,16 @@ call_func( #endif else if (fp != NULL) { - if (funcexe->argv_func != NULL) + if (funcexe->fe_argv_func != NULL) // postponed filling in the arguments, do it now - argcount = funcexe->argv_func(argcount, argvars, argv_clear, - fp->uf_args.ga_len); - - if (funcexe->basetv != NULL) + argcount = funcexe->fe_argv_func(argcount, argvars, + argv_clear, fp->uf_args.ga_len); + + if (funcexe->fe_basetv != NULL) { // Method call: base->Method() mch_memmove(&argv[1], argvars, sizeof(typval_T) * argcount); - argv[0] = *funcexe->basetv; + argv[0] = *funcexe->fe_basetv; argcount++; argvars = argv; argv_base = 1; @@ -3417,14 +3418,14 @@ call_func( funcexe, selfdict); } } - else if (funcexe->basetv != NULL) + else if (funcexe->fe_basetv != NULL) { /* * expr->method(): Find the method name in the table, call its * implementation with the base as one of the arguments. */ error = call_internal_method(fname, argcount, argvars, rettv, - funcexe->basetv); + funcexe->fe_basetv); } else { @@ -5098,13 +5099,13 @@ ex_call(exarg_T *eap) arg = startarg; CLEAR_FIELD(funcexe); - funcexe.firstline = eap->line1; - funcexe.lastline = eap->line2; - funcexe.doesrange = &doesrange; - funcexe.evaluate = !eap->skip; - funcexe.partial = partial; - funcexe.selfdict = fudi.fd_dict; - funcexe.check_type = type; + funcexe.fe_firstline = eap->line1; + funcexe.fe_lastline = eap->line2; + funcexe.fe_doesrange = &doesrange; + funcexe.fe_evaluate = !eap->skip; + funcexe.fe_partial = partial; + funcexe.fe_selfdict = fudi.fd_dict; + funcexe.fe_check_type = type; funcexe.fe_found_var = found_var; rettv.v_type = VAR_UNKNOWN; // clear_tv() uses this if (get_func_tv(name, -1, &rettv, &arg, &evalarg, &funcexe) == FAIL)
--- a/src/version.c +++ b/src/version.c @@ -750,6 +750,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 3796, +/**/ 3795, /**/ 3794,
--- a/src/vim9execute.c +++ b/src/vim9execute.c @@ -876,13 +876,13 @@ call_ufunc( if (call_prepare(argcount, argvars, ectx) == FAIL) return FAIL; CLEAR_FIELD(funcexe); - funcexe.evaluate = TRUE; - funcexe.selfdict = selfdict != NULL ? selfdict : dict_stack_get_dict(); + funcexe.fe_evaluate = TRUE; + funcexe.fe_selfdict = selfdict != NULL ? selfdict : dict_stack_get_dict(); // Call the user function. Result goes in last position on the stack. // TODO: add selfdict if there is one 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. for (idx = 0; idx < argcount; ++idx)