0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.2.3924: Vim9: no error if something follows :enddef

Problem:    Vim9: no error if something follows :enddef in a nested function.
Solution:   Give an error.  Move common code to a function.
This commit is contained in:
Bram Moolenaar
2021-12-28 17:55:26 +00:00
parent 4bf1006cae
commit 7473a84cf9
5 changed files with 56 additions and 22 deletions

View File

@@ -879,12 +879,18 @@ compile_nested_function(exarg_T *eap, cctx_T *cctx, char_u **line_to_free)
}
ufunc = define_function(eap, lambda_name, line_to_free);
if (ufunc == NULL)
{
r = eap->skip ? OK : FAIL;
goto theend;
}
if (eap->nextcmd != NULL)
{
semsg(_(e_text_found_after_str_str),
eap->cmdidx == CMD_def ? "enddef" : "endfunction", eap->nextcmd);
r = FAIL;
goto theend;
}
// copy over the block scope IDs before compiling
if (!is_global && cctx->ctx_ufunc->uf_block_depth > 0)