1
0
forked from aniani/vim

patch 8.2.2094: when an expression fails getting next command may be wrong

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)
This commit is contained in:
Bram Moolenaar
2020-12-05 17:11:12 +01:00
parent c0913d023b
commit d0fe620cbb
3 changed files with 19 additions and 1 deletions

View File

@@ -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)

View File

@@ -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()

View File

@@ -750,6 +750,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
2094,
/**/
2093,
/**/