Tokenizer::simplifyEmptyNamespaces: remove useless condition.

Token::deleteThis handles the !tok->next situation well.
This commit is contained in:
Edoardo Prezioso 2012-09-03 14:22:31 +02:00
parent e49cb27f3a
commit 804fbe3f8f
1 changed files with 8 additions and 10 deletions

View File

@ -3629,16 +3629,14 @@ void Tokenizer::simplifyEmptyNamespaces()
continue;
if (tok->strAt(3) == "}") {
tok->deleteNext(3); // remove '%var% { }'
if (tok->next()) { // '%empty% namespace %anytoken%'?
if (!tok->previous()) {
tok->deleteThis(); // remove 'namespace'
goback = true;
} else { // '%any% namespace %any%'
tok = tok->previous(); // goto previous token
tok->deleteNext(); // remove next token: 'namespace'
}
} else // '%empty% namespace %empty%'?
tok->str(";"); // change 'namespace' to ';'
if (!tok->previous()) {
// remove 'namespace' or replace it with ';' if isolated
tok->deleteThis();
goback = true;
} else { // '%any% namespace %any%'
tok = tok->previous(); // goto previous token
tok->deleteNext(); // remove next token: 'namespace'
}
} else {
tok = tok->tokAt(2);
}