changeset 29010:36ef8d453ade v8.2.5027

patch 8.2.5027: error for missing :endif when an exception was thrown Commit: https://github.com/vim/vim/commit/bf79a4e48d09a5ae08645592885d54230fed30b8 Author: Bram Moolenaar <Bram@vim.org> Date: Fri May 27 13:52:08 2022 +0100 patch 8.2.5027: error for missing :endif when an exception was thrown Problem: Error for missing :endif when an exception was thrown. (Dani Dickstein) Solution: Do not give an error when aborting. (closes #10490)
author Bram Moolenaar <Bram@vim.org>
date Fri, 27 May 2022 15:00:04 +0200
parents 04e5f52e0f72
children 922c555e7aad
files src/ex_docmd.c src/testdir/test_trycatch.vim src/version.c
diffstat 3 files changed, 21 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -1204,7 +1204,8 @@ do_cmdline(
 	 * In Vim9 script do not give a second error, executing aborts after
 	 * the first one.
 	 */
-	if (!got_int && !did_throw && !(did_emsg && in_vim9script())
+	if (!got_int && !did_throw && !aborting()
+		&& !(did_emsg && in_vim9script())
 		&& ((getline_equal(fgetline, cookie, getsourceline)
 			&& !source_finished(fgetline, cookie))
 		    || (getline_equal(fgetline, cookie, get_func_line)
--- a/src/testdir/test_trycatch.vim
+++ b/src/testdir/test_trycatch.vim
@@ -2247,6 +2247,23 @@ func Test_user_command_throw_in_function
   unlet g:caught
 endfunc
 
+" Test that after reporting an uncaught exception there is no error for a
+" missing :endif
+func Test_after_exception_no_endif_error()
+  function Throw()
+    throw "Failure"
+  endfunction
+
+  function Foo()
+    if 1
+      call Throw()
+    endif
+  endfunction
+  call assert_fails('call Foo()', ['E605:', 'E605:'])
+  delfunc Throw
+  delfunc Foo
+endfunc
+
 " Test for using throw in a called function with following endtry    {{{1
 func Test_user_command_function_call_with_endtry()
   let lines =<< trim END
--- a/src/version.c
+++ b/src/version.c
@@ -735,6 +735,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    5027,
+/**/
     5026,
 /**/
     5025,