0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

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

@@ -743,6 +743,23 @@ generate_PUSHFUNC(cctx_T *cctx, char_u *name, type_T *type)
return OK;
}
/*
* Generate an ISN_AUTOLOAD instruction.
*/
int
generate_AUTOLOAD(cctx_T *cctx, char_u *name, type_T *type)
{
isn_T *isn;
RETURN_OK_IF_SKIP(cctx);
if ((isn = generate_instr_type(cctx, ISN_AUTOLOAD, type)) == NULL)
return FAIL;
isn->isn_arg.string = vim_strsave(name);
if (isn->isn_arg.string == NULL)
return FAIL;
return OK;
}
/*
* Generate an ISN_GETITEM instruction with "index".
* "with_op" is TRUE for "+=" and other operators, the stack has the current
@@ -1929,6 +1946,7 @@ delete_instr(isn_T *isn)
{
switch (isn->isn_type)
{
case ISN_AUTOLOAD:
case ISN_DEF:
case ISN_EXEC:
case ISN_EXECRANGE: