Patch 8.2.5027
Problem:    Error for missing :endif when an exception was thrown. (Dani
            Dickstein)
Solution:   Do not give an error when aborting. (closes #10490)
Files:      src/ex_docmd.c, src/testdir/test_trycatch.vim


*** ../vim-8.2.5026/src/ex_docmd.c      2022-05-26 22:24:39.222446935 +0100
--- src/ex_docmd.c      2022-05-27 13:47:40.066997068 +0100
***************
*** 1204,1210 ****
         * In Vim9 script do not give a second error, executing aborts after
         * the first one.
         */
!       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)
--- 1204,1211 ----
         * In Vim9 script do not give a second error, executing aborts after
         * the first one.
         */
!       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)
*** ../vim-8.2.5026/src/testdir/test_trycatch.vim       2021-11-21 
11:35:59.460938795 +0000
--- src/testdir/test_trycatch.vim       2022-05-27 13:47:02.067037919 +0100
***************
*** 2247,2252 ****
--- 2247,2269 ----
    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
*** ../vim-8.2.5026/src/version.c       2022-05-26 22:24:39.226446934 +0100
--- src/version.c       2022-05-27 13:23:49.980608015 +0100
***************
*** 736,737 ****
--- 736,739 ----
  {   /* Add new patch number below this line */
+ /**/
+     5027,
  /**/

-- 
Not too long ago, a keyboard was something to make music with...

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20220527125309.718A61C1AA3%40moolenaar.net.

Raspunde prin e-mail lui