diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-01-25 15:51:56 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-01-25 15:51:56 +0000 |
commit | 06b77229ca704d00c4f138ed0377556e54d5851f (patch) | |
tree | 6b24e9838841943803574a424599d687be2c05f1 /src/vim9instr.c | |
parent | dc5490e2cbc8c16022a23b449b48c1bd0083f366 (diff) |
patch 8.2.4216: Vim9: cannot use a function from an autoload import directlyv8.2.4216
Problem: Vim9: cannot use a function from an autoload import directly.
Solution: Add the AUTOLOAD instruction to figure out at runtime.
(closes #9620)
Diffstat (limited to 'src/vim9instr.c')
-rw-r--r-- | src/vim9instr.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/vim9instr.c b/src/vim9instr.c index b6e28b0b94..d000c4acd6 100644 --- a/src/vim9instr.c +++ b/src/vim9instr.c @@ -744,6 +744,23 @@ generate_PUSHFUNC(cctx_T *cctx, char_u *name, type_T *type) } /* + * 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 * value below the list with values. @@ -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: |