Simplification. Code 'else if ..' is simplified to 'else { if ..'

This commit is contained in:
Daniel Marjamäki 2014-03-28 18:21:56 +01:00
parent a16d631813
commit 502ba95383
1 changed files with 2 additions and 4 deletions

View File

@ -2546,10 +2546,8 @@ void CheckOther::checkDuplicateIf()
const Token *tok1 = scope->classEnd;
// check all the else if (...) statements
while ((Token::simpleMatch(tok1, "} else if (") &&
Token::simpleMatch(tok1->linkAt(3), ") {")) ||
(Token::simpleMatch(tok1, "} else { if (") &&
Token::simpleMatch(tok1->linkAt(4), ") {"))) {
while (Token::simpleMatch(tok1, "} else { if (") &&
Token::simpleMatch(tok1->linkAt(4), ") {")) {
int conditionIndex=(tok1->strAt(3)=="(") ? 3 : 4;
// get the expression from the token stream
expression = tok1->tokAt(conditionIndex+1)->stringifyList(tok1->linkAt(conditionIndex));