]> granicus.if.org Git - vim/commitdiff
patch 8.2.0267: no check for a following cmd when calling a function fails v8.2.0267
authorBram Moolenaar <Bram@vim.org>
Sun, 16 Feb 2020 18:42:23 +0000 (19:42 +0100)
committerBram Moolenaar <Bram@vim.org>
Sun, 16 Feb 2020 18:42:23 +0000 (19:42 +0100)
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)

src/testdir/test_user_func.vim
src/userfunc.c
src/version.c

index d10a1108489ec6c2c41791b2380c42836d3d6a3d..872b87343dc167b5cec4d1f4ebc6807e7a623f8d 100644 (file)
@@ -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
index 1c25a626850679467f7ca4361f065d6f5df41790..d1d497d690fcd3250138efb9dafb1504ee469d9f 100644 (file)
@@ -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))
index 67e23d52c417ad717ac11372df2a47ec2f801503..73a70cdf2ce7dbf2df988b6cee139070cd1be7d9 100644 (file)
@@ -742,6 +742,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    267,
 /**/
     266,
 /**/