mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 9.0.0869: bogus error when string used after :elseif
Problem: Bogus error when string used after :elseif. Solution: Do not consider a double quote the start of a comment. (closes #11534)
This commit is contained in:
parent
1140b51e83
commit
28c56d5013
@ -1173,7 +1173,8 @@ ex_else(exarg_T *eap)
|
|||||||
{
|
{
|
||||||
// When skipping we ignore most errors, but a missing expression is
|
// When skipping we ignore most errors, but a missing expression is
|
||||||
// wrong, perhaps it should have been "else".
|
// wrong, perhaps it should have been "else".
|
||||||
if (skip && ends_excmd(*eap->arg))
|
// A double quote here is the start of a string, not a comment.
|
||||||
|
if (skip && *eap->arg != '"' && ends_excmd(*eap->arg))
|
||||||
semsg(_(e_invalid_expression_str), eap->arg);
|
semsg(_(e_invalid_expression_str), eap->arg);
|
||||||
else
|
else
|
||||||
result = eval_to_bool(eap->arg, &error, eap, skip, FALSE);
|
result = eval_to_bool(eap->arg, &error, eap, skip, FALSE);
|
||||||
|
@ -192,6 +192,16 @@ func Test_if_while()
|
|||||||
call assert_equal('ab3j3b2c2b1f1h1km', g:Xpath)
|
call assert_equal('ab3j3b2c2b1f1h1km', g:Xpath)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
" Check double quote after skipped "elseif" does not give error E15
|
||||||
|
func Test_skipped_elseif()
|
||||||
|
if "foo" ==? "foo"
|
||||||
|
let result = "first"
|
||||||
|
elseif "foo" ==? "foo"
|
||||||
|
let result = "second"
|
||||||
|
endif
|
||||||
|
call assert_equal('first', result)
|
||||||
|
endfunc
|
||||||
|
|
||||||
"-------------------------------------------------------------------------------
|
"-------------------------------------------------------------------------------
|
||||||
" Test 4: :return {{{1
|
" Test 4: :return {{{1
|
||||||
"-------------------------------------------------------------------------------
|
"-------------------------------------------------------------------------------
|
||||||
|
@ -695,6 +695,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
869,
|
||||||
/**/
|
/**/
|
||||||
868,
|
868,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user