summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-02-16 19:42:23 +0100
committerBram Moolenaar <Bram@vim.org>2020-02-16 19:42:23 +0100
commite51bb17dd0d51384375830ee2a1df30c08121443 (patch)
treec1b74d99983bdc6405a2a02eabd7bfe76cb72004
parenta28be85ccde03ee0a0dc984dfd7396c50713b593 (diff)
patch 8.2.0267: no check for a following cmd when calling a function failsv8.2.0267
Problem: No check for a following command when calling a function fails. Solution: Also check for a following command when inside a try block. (closes #5642)
-rw-r--r--src/testdir/test_user_func.vim4
-rw-r--r--src/userfunc.c3
-rw-r--r--src/version.c2
3 files changed, 8 insertions, 1 deletions
diff --git a/src/testdir/test_user_func.vim b/src/testdir/test_user_func.vim
index d10a110848..872b87343d 100644
--- a/src/testdir/test_user_func.vim
+++ b/src/testdir/test_user_func.vim
@@ -162,3 +162,7 @@ endfunc
func Test_user_method()
eval 'bar'->s:addFoo()->assert_equal('barfoo')
endfunc
+
+func Test_failed_call_in_try()
+ try | call UnknownFunc() | catch | endtry
+endfunc
diff --git a/src/userfunc.c b/src/userfunc.c
index 1c25a62685..d1d497d690 100644
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -3554,7 +3554,8 @@ ex_call(exarg_T *eap)
if (eap->skip)
--emsg_skip;
- if (!failed)
+ // When inside :try we need to check for following "| catch".
+ if (!failed || eap->cstack->cs_trylevel > 0)
{
// Check for trailing illegal characters and a following command.
if (!ends_excmd(*arg))
diff --git a/src/version.c b/src/version.c
index 67e23d52c4..73a70cdf2c 100644
--- a/src/version.c
+++ b/src/version.c
@@ -743,6 +743,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 267,
+/**/
266,
/**/
265,