0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.2.0725: Vim9: cannot call a function declared later in Vim9 script

Problem:    Vim9: cannot call a function declared later in Vim9 script.
Solution:   Make two passes through the script file.
This commit is contained in:
Bram Moolenaar
2020-05-09 22:50:08 +02:00
parent 396f3138ca
commit 09689a0284
13 changed files with 229 additions and 35 deletions

View File

@@ -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);