1
0
forked from aniani/vim

patch 8.2.4216: Vim9: cannot use a function from an autoload import directly

Problem:    Vim9: cannot use a function from an autoload import directly.
Solution:   Add the AUTOLOAD instruction to figure out at runtime.
            (closes #9620)
This commit is contained in:
Bram Moolenaar
2022-01-25 15:51:56 +00:00
parent dc5490e2cb
commit 06b77229ca
8 changed files with 196 additions and 75 deletions

View File

@@ -307,11 +307,12 @@ compile_load_scriptvar(
char_u *auto_name = concat_str(si->sn_autoload_prefix, exp_name);
// autoload script must be loaded later, access by the autoload
// name.
// name. If a '(' follows it must be a function. Otherwise we
// don't know, it can be "script.Func".
if (cc == '(' || paren_follows_after_expr)
res = generate_PUSHFUNC(cctx, auto_name, &t_func_any);
else
res = generate_LOAD(cctx, ISN_LOADG, 0, auto_name, &t_any);
res = generate_AUTOLOAD(cctx, auto_name, &t_any);
vim_free(auto_name);
done = TRUE;
}