New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

return の右項で例外が発生すると try/catch で補足されない。 #1135

Closed
mattn opened this Issue Dec 21, 2017 · 3 comments

Comments

Projects
None yet
1 participant
@mattn
Member

mattn commented Dec 21, 2017

function! s:foo()
  try
    return [] == 0
  catch
    return 0
  endtry
endfunction

echo s:foo()

https://wandbox.org/permlink/LuKXEV6oxhI9PTmv

@mattn

This comment has been minimized.

Show comment
Hide comment
@mattn

mattn Dec 22, 2017

Member
diff --git a/src/userfunc.c b/src/userfunc.c
index 580df0bf8..931683d7c 100644
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -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.

テスト足します。

https://travis-ci.org/mattn/vim/builds/319991138

Member

mattn commented Dec 22, 2017

diff --git a/src/userfunc.c b/src/userfunc.c
index 580df0bf8..931683d7c 100644
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -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.

テスト足します。

https://travis-ci.org/mattn/vim/builds/319991138

@mattn

This comment has been minimized.

Show comment
Hide comment
@mattn
Member

mattn commented Dec 22, 2017

@mattn mattn self-assigned this Dec 22, 2017

rhysd added a commit to rhysd/vital.vim that referenced this issue Dec 22, 2017

rhysd added a commit to rhysd/vital.vim that referenced this issue Dec 22, 2017

rhysd added a commit to rhysd/vital.vim that referenced this issue Dec 22, 2017

@mattn

This comment has been minimized.

Show comment
Hide comment
@mattn
Member

mattn commented Dec 23, 2017

@mattn mattn closed this Dec 23, 2017

@mattn mattn added the xlose/fixed label Dec 23, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment