diff src/vim9compile.c @ 27571:55f0ac079829 v8.2.4312

patch 8.2.4312: no error for using :vim9script in a :def function Commit: https://github.com/vim/vim/commit/107f7325f615a1ffa5b49521e316b44e117b0a04 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Feb 6 17:30:41 2022 +0000 patch 8.2.4312: no error for using :vim9script in a :def function Problem: No error for using :vim9script in a :def function. Solution: Give an error when compiling.
author Bram Moolenaar <Bram@vim.org>
date Sun, 06 Feb 2022 18:45:03 +0100
parents 1aff400b819e
children 9f70df0b2967
line wrap: on
line diff
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -3138,6 +3138,10 @@ compile_def_function(
 			line = compile_script(line, &cctx);
 		    break;
 
+	    case CMD_vim9script:
+		    emsg(_(e_vim9script_can_only_be_used_in_script));
+		    goto erret;
+
 	    case CMD_global:
 		    if (check_global_and_subst(ea.cmd, p) == FAIL)
 			goto erret;