mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.2.4675: no error for missing expression after :elseif
Problem: No error for missing expression after :elseif. (Ernie Rael) Solution: Check for missing expression. (closes #10068)
This commit is contained in:
parent
c4cb544cd5
commit
fa010cdfb1
@ -1146,7 +1146,12 @@ ex_else(exarg_T *eap)
|
||||
|
||||
if (eap->cmdidx == CMD_elseif)
|
||||
{
|
||||
result = eval_to_bool(eap->arg, &error, eap, skip);
|
||||
// When skipping we ignore most errors, but a missing expression is
|
||||
// wrong, perhaps it should have been "else".
|
||||
if (skip && ends_excmd(*eap->arg))
|
||||
semsg(_(e_invalid_expression_str), eap->arg);
|
||||
else
|
||||
result = eval_to_bool(eap->arg, &error, eap, skip);
|
||||
|
||||
// When throwing error exceptions, we want to throw always the first
|
||||
// of several errors in a row. This is what actually happens when
|
||||
|
@ -1605,6 +1605,16 @@ def Test_if_elseif_else_fails()
|
||||
endif
|
||||
END
|
||||
v9.CheckDefFailure(lines, 'E488:')
|
||||
|
||||
lines =<< trim END
|
||||
var cond = true
|
||||
if cond
|
||||
echo 'true'
|
||||
elseif
|
||||
echo 'false'
|
||||
endif
|
||||
END
|
||||
v9.CheckDefAndScriptFailure(lines, ['E1143:', 'E15:'], 4)
|
||||
enddef
|
||||
|
||||
let g:bool_true = v:true
|
||||
|
@ -750,6 +750,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
4675,
|
||||
/**/
|
||||
4674,
|
||||
/**/
|
||||
|
Loading…
x
Reference in New Issue
Block a user