summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-12-23 17:26:11 +0100
committerBram Moolenaar <Bram@vim.org>2017-12-23 17:26:11 +0100
commitfabaf753e26df5a89a854673d14c15a1fa6b321a (patch)
tree511e8530aaaa84f9fc2bb08459f156deb2b528e7
parent45a0000d5c4a5ea934d5a16a2ab5bbcf307623ac (diff)
downloadvim-git-fabaf753e26df5a89a854673d14c15a1fa6b321a.tar.gz
patch 8.0.1423: error in return not caught by try/catchv8.0.1423
Problem: Error in return not caught by try/catch. Solution: Call update_force_abort(). (Yasuhiro Matsomoto, closes #2483)
-rw-r--r--src/Makefile1
-rw-r--r--src/testdir/Make_all.mak1
-rw-r--r--src/testdir/test_eval.in6
-rw-r--r--src/testdir/test_eval_stuff.vim13
-rw-r--r--src/userfunc.c3
-rw-r--r--src/version.c2
6 files changed, 24 insertions, 2 deletions
diff --git a/src/Makefile b/src/Makefile
index 123575245..beb0de340 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -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 \
diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak
index 932f2c43a..050882c5b 100644
--- a/src/testdir/Make_all.mak
+++ b/src/testdir/Make_all.mak
@@ -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 \
diff --git a/src/testdir/test_eval.in b/src/testdir/test_eval.in
index 84f26bafc..3b6144257 100644
--- a/src/testdir/test_eval.in
+++ b/src/testdir/test_eval.in
@@ -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)
diff --git a/src/testdir/test_eval_stuff.vim b/src/testdir/test_eval_stuff.vim
new file mode 100644
index 000000000..92e1ec533
--- /dev/null
+++ b/src/testdir/test_eval_stuff.vim
@@ -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
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.
diff --git a/src/version.c b/src/version.c
index 65d590506..6b3df0dbf 100644
--- a/src/version.c
+++ b/src/version.c
@@ -772,6 +772,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1423,
+/**/
1422,
/**/
1421,