summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-12-05 17:11:12 +0100
committerBram Moolenaar <Bram@vim.org>2020-12-05 17:11:12 +0100
commitd0fe620cbbf5f5e00446efa89893036265c5c302 (patch)
tree284d0046b8738f9ab05bdf2bf2c44d1a0a1db676
parentc0913d023b8bb728e9832727fe1657dbddf685d0 (diff)
downloadvim-git-d0fe620cbbf5f5e00446efa89893036265c5c302.tar.gz
patch 8.2.2094: when an expression fails getting next command may be wrongv8.2.2094
Problem: When an expression fails getting the next command may be wrong. Solution: Do not check for a next command after :eval fails. (closes #7415)
-rw-r--r--src/eval.c5
-rw-r--r--src/testdir/test_vim9_cmd.vim13
-rw-r--r--src/version.c2
3 files changed, 19 insertions, 1 deletions
diff --git a/src/eval.c b/src/eval.c
index 223251090..47aaaad23 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -2156,7 +2156,10 @@ eval0(
&& called_emsg == called_emsg_before
&& (flags & EVAL_CONSTANT) == 0)
semsg(_(e_invexpr2), arg);
- ret = FAIL;
+
+ // Some of the expression may not have been consumed. Do not check for
+ // a next command to avoid more errors.
+ return FAIL;
}
if (eap != NULL)
diff --git a/src/testdir/test_vim9_cmd.vim b/src/testdir/test_vim9_cmd.vim
index 162d79508..37fc559bf 100644
--- a/src/testdir/test_vim9_cmd.vim
+++ b/src/testdir/test_vim9_cmd.vim
@@ -558,6 +558,19 @@ def Test_eval_command()
->Increment()
assert_equal(111 + 3 + 4 + 5, g:val)
unlet g:val
+
+ var lines =<< trim END
+ vim9script
+ g:caught = 'no'
+ try
+ eval 123 || 0
+ catch
+ g:caught = 'yes'
+ endtry
+ assert_equal('yes', g:caught)
+ unlet g:caught
+ END
+ CheckScriptSuccess(lines)
enddef
def Test_map_command()
diff --git a/src/version.c b/src/version.c
index b28638b44..a0bf9363c 100644
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 2094,
+/**/
2093,
/**/
2092,