vim-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 vim/vim#2483)
fabaf753e2
This commit is contained in:
Jan Edmund Lazo 2018-09-03 22:31:04 -04:00
parent f4b2b66661
commit c2e7f39528
2 changed files with 16 additions and 0 deletions

View File

@ -21800,6 +21800,9 @@ void 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 File

@ -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