Permalink
Browse files

patch 8.0.1423: error in return not caught by try/catch

Problem:    Error in return not caught by try/catch.
Solution:   Call update_force_abort(). (Yasuhiro Matsomoto, closes #2483)
  • Loading branch information...
brammool committed Dec 23, 2017
1 parent 45a0000 commit fabaf753e26df5a89a854673d14c15a1fa6b321a
Showing with 24 additions and 2 deletions.
  1. +1 −0 src/Makefile
  2. +1 −0 src/testdir/Make_all.mak
  3. +4 −2 src/testdir/test_eval.in
  4. +13 −0 src/testdir/test_eval_stuff.vim
  5. +3 −0 src/userfunc.c
  6. +2 −0 src/version.c
View
@@ -2147,6 +2147,7 @@ test_arglist \
test_edit \
test_erasebackword \
test_escaped_glob \
test_eval_stuff \
test_ex_undo \
test_ex_z \
test_exec_while_if \
View
@@ -94,6 +94,7 @@ NEW_TESTS = test_arabic.res \
test_edit.res \
test_erasebackword.res \
test_escaped_glob.res \
test_eval_stuff.res \
test_exec_while_if.res \
test_exists.res \
test_exists_autocmd.res \
View
@@ -1,5 +1,7 @@
Test for various eval features. vim: set ft=vim :
NOTE: Do not add more here, use new style test test_eval_stuff.vim
Note: system clipboard is saved, changed and restored.
clipboard contents
@@ -134,10 +136,10 @@ if has('clipboard')
let _clipreg = ['*', getreg('*'), getregtype('*')]
let _clipopt = &cb
let &cb='unnamed'
5y
7y
AR *
tabdo :windo :echo "hi"
6y
8y
AR *
let &cb=_clipopt
call call('setreg', _clipreg)
@@ -0,0 +1,13 @@
" Tests for various eval things.
function s:foo() abort
try
return [] == 0
catch
return 1
endtry
endfunction
func Test_catch_return_with_error()
call assert_equal(1, s:foo())
endfunc
View
@@ -2972,6 +2972,9 @@ ex_return(exarg_T *eap)
/* It's safer to return also on error. */
else if (!eap->skip)
{
/* In return statement, cause_abort should be force_abort. */
update_force_abort();
/*
* Return unless the expression evaluation has been cancelled due to an
* aborting error, an interrupt, or an exception.
View
@@ -771,6 +771,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1423,
/**/
1422,
/**/

0 comments on commit fabaf75

Please sign in to comment.