diff src/ex_docmd.c @ 24555:83877a1b66fd v8.2.2817

patch 8.2.2817: Vim9: script sourcing continues after an error Commit: https://github.com/vim/vim/commit/227c58a486d2459e7bf6ed2c917ede7e324e3570 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Apr 28 20:40:44 2021 +0200 patch 8.2.2817: Vim9: script sourcing continues after an error Problem: Vim9: script sourcing continues after an error. Solution: Make an error in any command in "vim9script" abort sourcing.
author Bram Moolenaar <Bram@vim.org>
date Wed, 28 Apr 2021 20:45:03 +0200
parents b3bd27751e09
children 661d15592d3c
line wrap: on
line diff
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -1175,7 +1175,8 @@ do_cmdline(
      */
     while (!((got_int
 #ifdef FEAT_EVAL
-		    || (did_emsg && force_abort) || did_throw
+		    || (did_emsg && (force_abort || in_vim9script()))
+		    || did_throw
 #endif
 	     )
 #ifdef FEAT_EVAL
@@ -1209,8 +1210,10 @@ do_cmdline(
 	/*
 	 * If a sourced file or executed function ran to its end, report the
 	 * unclosed conditional.
+	 * In Vim9 script do not give a second error, executing aborts after
+	 * the first one.
 	 */
-	if (!got_int && !did_throw
+	if (!got_int && !did_throw && !(did_emsg && in_vim9script())
 		&& ((getline_equal(fgetline, cookie, getsourceline)
 			&& !source_finished(fgetline, cookie))
 		    || (getline_equal(fgetline, cookie, get_func_line)