summaryrefslogtreecommitdiff
path: root/src/vim9execute.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-05-09 22:50:08 +0200
committerBram Moolenaar <Bram@vim.org>2020-05-09 22:50:08 +0200
commit09689a02840be40fa7bb10b1921fb5bc5b2908f1 (patch)
tree4aced60f6702ce56232c9ee70bf977234e054c39 /src/vim9execute.c
parent396f3138ca83ce844679143861f544070683d479 (diff)
downloadvim-git-09689a02840be40fa7bb10b1921fb5bc5b2908f1.tar.gz
patch 8.2.0725: Vim9: cannot call a function declared later in Vim9 scriptv8.2.0725
Problem: Vim9: cannot call a function declared later in Vim9 script. Solution: Make two passes through the script file.
Diffstat (limited to 'src/vim9execute.c')
-rw-r--r--src/vim9execute.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/vim9execute.c b/src/vim9execute.c
index a505647df..bfa24928a 100644
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -669,6 +669,13 @@ call_def_function(
ga_init2(&ectx.ec_stack, sizeof(typval_T), 500);
if (ga_grow(&ectx.ec_stack, 20) == FAIL)
return FAIL;
+ {
+ // Check the function was compiled, it is postponed in ex_vim9script().
+ dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data)
+ + ufunc->uf_dfunc_idx;
+ if (dfunc->df_instr == NULL)
+ return FAIL;
+ }
ectx.ec_dfunc_idx = ufunc->uf_dfunc_idx;
ga_init2(&ectx.ec_trystack, sizeof(trycmd_T), 10);