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.
diff --git a/src/vim9compile.c b/src/vim9compile.c
index b23145e..8882bfe 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -879,12 +879,18 @@
     }
 
     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)