mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge #8954 from janlazo/vim-8.0.1423
This commit is contained in:
commit
8c7c8f5962
@ -21797,15 +21797,15 @@ void ex_return(exarg_T *eap)
|
||||
} else {
|
||||
tv_clear(&rettv);
|
||||
}
|
||||
}
|
||||
/* It's safer to return also on error. */
|
||||
else if (!eap->skip) {
|
||||
/*
|
||||
* Return unless the expression evaluation has been cancelled due to an
|
||||
* aborting error, an interrupt, or an exception.
|
||||
*/
|
||||
if (!aborting())
|
||||
returning = do_return(eap, FALSE, TRUE, NULL);
|
||||
} else if (!eap->skip) { // It's safer to return also on error.
|
||||
// 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.
|
||||
if (!aborting()) {
|
||||
returning = do_return(eap, false, true, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/* When skipping or the return gets pending, advance to the next command
|
||||
|
13
src/nvim/testdir/test_eval_stuff.vim
Normal file
13
src/nvim/testdir/test_eval_stuff.vim
Normal 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
|
Loading…
Reference in New Issue
Block a user