summaryrefslogtreecommitdiff
path: root/src/vim9execute.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-01-12 19:54:00 +0000
committerBram Moolenaar <Bram@vim.org>2022-01-12 19:54:00 +0000
commitd041f4208b0a2149e9d41f6443aa1c14c076a411 (patch)
tree2fed762d017d9bae0177f03d021964b321db35f5 /src/vim9execute.c
parent53c296112edd8471eb63afbca03f96bad164c813 (diff)
downloadvim-git-d041f4208b0a2149e9d41f6443aa1c14c076a411.tar.gz
patch 8.2.4072: Vim9: compiling function fails when autoload is not loadedv8.2.4072
Problem: Vim9: compiling function fails when autoload script is not loaded yet. Solution: Depend on runtime loading.
Diffstat (limited to 'src/vim9execute.c')
-rw-r--r--src/vim9execute.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/vim9execute.c b/src/vim9execute.c
index 311baca01..ba810680c 100644
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -2227,6 +2227,16 @@ exec_instructions(ectx_T *ectx)
}
di = find_var_in_ht(ht, 0, iptr->isn_arg.string, TRUE);
+ if (di == NULL && ht == get_globvar_ht())
+ {
+ // may need to load autoload script
+ if (script_autoload(iptr->isn_arg.string, FALSE))
+ di = find_var_in_ht(ht, 0,
+ iptr->isn_arg.string, TRUE);
+ if (did_emsg)
+ goto on_error;
+ }
+
if (di == NULL)
{
SOURCING_LNUM = iptr->isn_lnum;