vim-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 vim/vim#10068)

fa010cdfb1

Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
zeertzjq
2022-11-13 07:17:57 +08:00
parent 47ad4c8701
commit 2cb0860117

View File

@@ -899,7 +899,13 @@ void ex_else(exarg_T *eap)
if (eap->cmdidx == CMD_elseif) {
bool error;
result = eval_to_bool(eap->arg, &error, &eap->nextcmd, 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_invexpr2), eap->arg);
} else {
result = eval_to_bool(eap->arg, &error, &eap->nextcmd, skip);
}
// When throwing error exceptions, we want to throw always the first
// of several errors in a row. This is what actually happens when