Merge #8954 from janlazo/vim-8.0.1423

This commit is contained in:
Justin M. Keyes 2018-10-10 11:20:43 +02:00 committed by GitHub
commit 8c7c8f5962
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 9 deletions

View File

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

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