Simplification. Code 'else if ..' is simplified to 'else { if ..'
This commit is contained in:
parent
a16d631813
commit
502ba95383
|
@ -2546,10 +2546,8 @@ void CheckOther::checkDuplicateIf()
|
||||||
const Token *tok1 = scope->classEnd;
|
const Token *tok1 = scope->classEnd;
|
||||||
|
|
||||||
// check all the else if (...) statements
|
// check all the else if (...) statements
|
||||||
while ((Token::simpleMatch(tok1, "} else if (") &&
|
while (Token::simpleMatch(tok1, "} else { if (") &&
|
||||||
Token::simpleMatch(tok1->linkAt(3), ") {")) ||
|
Token::simpleMatch(tok1->linkAt(4), ") {")) {
|
||||||
(Token::simpleMatch(tok1, "} else { if (") &&
|
|
||||||
Token::simpleMatch(tok1->linkAt(4), ") {"))) {
|
|
||||||
int conditionIndex=(tok1->strAt(3)=="(") ? 3 : 4;
|
int conditionIndex=(tok1->strAt(3)=="(") ? 3 : 4;
|
||||||
// get the expression from the token stream
|
// get the expression from the token stream
|
||||||
expression = tok1->tokAt(conditionIndex+1)->stringifyList(tok1->linkAt(conditionIndex));
|
expression = tok1->tokAt(conditionIndex+1)->stringifyList(tok1->linkAt(conditionIndex));
|
||||||
|
|
Loading…
Reference in New Issue