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: #16430
closes: #16445
Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/evalfunc.c b/src/evalfunc.c
index d81480b..ef30792 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -3739,7 +3739,6 @@
char_u *func;
partial_T *partial = NULL;
dict_T *selfdict = NULL;
- char_u *dot;
char_u *tofree = NULL;
if (in_vim9script()
@@ -3765,36 +3764,26 @@
if (func == NULL || *func == NUL)
return; // type error, empty name or null function
- dot = vim_strchr(func, '.');
- if (dot != NULL)
+ char_u *p = func;
+ tofree = trans_function_name(&p, NULL, FALSE, TFN_INT|TFN_QUIET);
+ if (tofree == NULL)
{
- imported_T *import = find_imported(func, dot - func, TRUE);
-
- if (import != NULL && SCRIPT_ID_VALID(import->imp_sid))
- {
- scriptitem_T *si = SCRIPT_ITEM(import->imp_sid);
-
- if (si->sn_autoload_prefix != NULL)
- {
- // Turn "import.Func" into "scriptname#Func".
- tofree = concat_str(si->sn_autoload_prefix, dot + 1);
- if (tofree == NULL)
- return;
- func = tofree;
- }
- }
+ emsg_funcname(e_unknown_function_str, func);
+ return;
}
+ func = tofree;
if (argvars[2].v_type != VAR_UNKNOWN)
{
if (check_for_dict_arg(argvars, 2) == FAIL)
- return;
+ goto done;
selfdict = argvars[2].vval.v_dict;
}
(void)func_call(func, &argvars[1], partial, selfdict, rettv);
+done:
vim_free(tofree);
}