summaryrefslogtreecommitdiff
path: root/src/vim9execute.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-05-25 22:36:50 +0200
committerBram Moolenaar <Bram@vim.org>2020-05-25 22:36:50 +0200
commit25e0f5863e9010a75a1ff0d04e8f886403968755 (patch)
treebcb0891919dbc85578b8483487f2ef89ede0f93c /src/vim9execute.c
parent2eec37926db6d31beb36f162ac00357a30c093c8 (diff)
downloadvim-git-25e0f5863e9010a75a1ff0d04e8f886403968755.tar.gz
patch 8.2.0823: Vim9: script reload test is disabledv8.2.0823
Problem: Vim9: script reload test is disabled. Solution: Compile a function in the context of the script where it was defined. Set execution stack for compiled function. Add a test that an error is reported for the right file/function.
Diffstat (limited to 'src/vim9execute.c')
-rw-r--r--src/vim9execute.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/vim9execute.c b/src/vim9execute.c
index f6aa14065..1a87476dc 100644
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -230,7 +230,7 @@ call_dfunc(int cdf_idx, int argcount_arg, ectx_T *ectx)
// Set execution state to the start of the called function.
ectx->ec_dfunc_idx = cdf_idx;
ectx->ec_instr = dfunc->df_instr;
- estack_push_ufunc(ETYPE_UFUNC, dfunc->df_ufunc, 1);
+ estack_push_ufunc(dfunc->df_ufunc, 1);
// Decide where to start execution, handles optional arguments.
init_instr_idx(ufunc, argcount, ectx);
@@ -656,6 +656,7 @@ call_def_function(
int defcount = ufunc->uf_args.ga_len - argc;
int save_sc_version = current_sctx.sc_version;
int breakcheck_count = 0;
+ int called_emsg_before = called_emsg;
// Get pointer to item in the stack.
#define STACK_TV(idx) (((typval_T *)ectx.ec_stack.ga_data) + idx)
@@ -673,7 +674,13 @@ call_def_function(
if (ufunc->uf_dfunc_idx == UF_NOT_COMPILED
|| (ufunc->uf_dfunc_idx == UF_TO_BE_COMPILED
&& compile_def_function(ufunc, FALSE, NULL) == FAIL))
+ {
+ if (called_emsg == called_emsg_before)
+ semsg(_("E1091: Function is not compiled: %s"),
+ ufunc->uf_name_exp == NULL
+ ? ufunc->uf_name : ufunc->uf_name_exp);
return FAIL;
+ }
{
// Check the function was really compiled.