diff options
Diffstat (limited to 'src/vim9execute.c')
-rw-r--r-- | src/vim9execute.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/vim9execute.c b/src/vim9execute.c index 4b2763b1f..bd7f71e68 100644 --- a/src/vim9execute.c +++ b/src/vim9execute.c @@ -2733,7 +2733,13 @@ exec_instructions(ectx_T *ectx) if (outer == NULL) { SOURCING_LNUM = iptr->isn_lnum; - iemsg("LOADOUTER depth more than scope levels"); + if (ectx->ec_frame_idx == ectx->ec_initial_frame_idx + || ectx->ec_outer_ref == NULL) + // Possibly :def function called from legacy + // context. + emsg(_(e_closure_called_from_invalid_context)); + else + iemsg("LOADOUTER depth more than scope levels"); goto theend; } tv = ((typval_T *)outer->out_stack->ga_data) |