vim-patch:9.1.1013: Vim9: Regression caused by patch v9.1.0646

Problem:  Vim9: Regression caused by patch v9.1.0646
Solution: Translate the function name before invoking it in call()
          (Yegappan Lakshmanan)

fixes: vim/vim#16430
closes: vim/vim#16445

6289f91591

N/A patch:
vim-patch:8.2.4176: Vim9: cannot use imported function with call()

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
This commit is contained in:
zeertzjq
2025-01-16 09:27:08 +08:00
parent 718e165360
commit f8680d0097
5 changed files with 18 additions and 8 deletions

View File

@@ -129,6 +129,7 @@ EXTERN const char e_missingparen[] INIT(= N_("E107: Missing parentheses: %s"));
EXTERN const char e_empty_buffer[] INIT(= N_("E749: Empty buffer"));
EXTERN const char e_nobufnr[] INIT(= N_("E86: Buffer %" PRId64 " does not exist"));
EXTERN const char e_unknown_function_str[] INIT(= N_("E117: Unknown function: %s"));
EXTERN const char e_str_not_inside_function[] INIT(= N_("E193: %s not inside a function"));
EXTERN const char e_invalpat[] INIT(= N_("E682: Invalid search pattern or delimiter"));

View File

@@ -575,22 +575,29 @@ static void f_call(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
if (func == NULL || *func == NUL) {
return; // type error, empty name or null function
}
char *p = func;
char *tofree = trans_function_name(&p, false, TFN_INT|TFN_QUIET, NULL, NULL);
if (tofree == NULL) {
emsg_funcname(e_unknown_function_str, func);
return;
}
func = tofree;
dict_T *selfdict = NULL;
if (argvars[2].v_type != VAR_UNKNOWN) {
if (tv_check_for_dict_arg(argvars, 2) == FAIL) {
if (owned) {
func_unref(func);
}
return;
goto done;
}
selfdict = argvars[2].vval.v_dict;
}
func_call(func, &argvars[1], partial, selfdict, rettv);
done:
if (owned) {
func_unref(func);
}
xfree(tofree);
}
/// "changenr()" function

View File

@@ -78,7 +78,6 @@ static funccall_T *current_funccal = NULL;
// item in it is still being used.
static funccall_T *previous_funccal = NULL;
static const char *e_unknown_function_str = N_("E117: Unknown function: %s");
static const char *e_funcexts = N_("E122: Function %s already exists, add ! to replace it");
static const char *e_funcdict = N_("E717: Dictionary entry already exists");
static const char *e_funcref = N_("E718: Funcref required");