summaryrefslogtreecommitdiff
path: root/src/vim9execute.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-12-02 16:38:52 +0000
committerBram Moolenaar <Bram@vim.org>2021-12-02 16:38:52 +0000
commit69c76171f1a78b829196f72d7010fbe1d9ad2944 (patch)
tree290a6d42ad5354271b42c128bf81e37217a79f16 /src/vim9execute.c
parentf8bc0ce2671d7f7f73760f665b52e4f00a1bbcac (diff)
downloadvim-git-69c76171f1a78b829196f72d7010fbe1d9ad2944.tar.gz
patch 8.2.3720: Vim9: Internal error when invoking closure in legacy contextv8.2.3720
Problem: Vim9: Internal error when invoking closure in legacy context. Solution: Give a more appropriate error message. (closes #9251)
Diffstat (limited to 'src/vim9execute.c')
-rw-r--r--src/vim9execute.c8
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)