patch 8.2.4650: "import autoload" only works with using 'runtimepath'
Problem: "import autoload" only works with using 'runtimepath'.
Solution: Also support a relative and absolute file name.
diff --git a/src/vim9expr.c b/src/vim9expr.c
index 90d7c8c..6576fc8 100644
--- a/src/vim9expr.c
+++ b/src/vim9expr.c
@@ -313,6 +313,27 @@
vim_free(auto_name);
done = TRUE;
}
+ else if (si->sn_import_autoload && si->sn_state == SN_STATE_NOT_LOADED)
+ {
+ // "import autoload './dir/script.vim'" - load script first
+ res = generate_SOURCE(cctx, import->imp_sid);
+ if (res == OK)
+ {
+ // If a '(' follows it must be a function. Otherwise we don't
+ // know, it can be "script.Func".
+ if (cc == '(' || paren_follows_after_expr)
+ {
+ char_u sid_name[MAX_FUNC_NAME_LEN];
+
+ func_name_with_sid(exp_name, import->imp_sid, sid_name);
+ res = generate_PUSHFUNC(cctx, sid_name, &t_func_any);
+ }
+ else
+ res = generate_OLDSCRIPT(cctx, ISN_LOADEXPORT, exp_name,
+ import->imp_sid, &t_any);
+ }
+ done = TRUE;
+ }
else
{
idx = find_exported(import->imp_sid, exp_name, &ufunc, &type,