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

patch 8.2.3720: Vim9: Internal error when invoking closure in legacy context

Problem:    Vim9: Internal error when invoking closure in legacy context.
Solution:   Give a more appropriate error message. (closes #9251)
This commit is contained in:
Bram Moolenaar
2021-12-02 16:38:52 +00:00
parent f8bc0ce267
commit 69c76171f1
4 changed files with 26 additions and 1 deletions

View File

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