Patch 8.2.5027

8 views
Skip to first unread message

Bram Moolenaar

unread,
May 27, 2022, 8:53:14 AM5/27/22
to vim...@googlegroups.com

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 -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages