summaryrefslogtreecommitdiff
path: root/src/vim9compile.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-12-28 17:55:26 +0000
committerBram Moolenaar <Bram@vim.org>2021-12-28 17:55:26 +0000
commit7473a84cf935f64ddd4ea7fe7eee0f9c51c50b60 (patch)
tree19fbc65c6b7484971559c5be81745a780cf1143a /src/vim9compile.c
parent4bf1006cae7e87259ccd5219128c3dba75774441 (diff)
downloadvim-git-7473a84cf935f64ddd4ea7fe7eee0f9c51c50b60.tar.gz
patch 8.2.3924: Vim9: no error if something follows :enddefv8.2.3924
Problem: Vim9: no error if something follows :enddef in a nested function. Solution: Give an error. Move common code to a function.
Diffstat (limited to 'src/vim9compile.c')
-rw-r--r--src/vim9compile.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/vim9compile.c b/src/vim9compile.c
index b23145ebc..8882bfe10 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -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)