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; continue;
if (tok->strAt(3) == "}") { if (tok->strAt(3) == "}") {
tok->deleteNext(3); // remove '%var% { }' tok->deleteNext(3); // remove '%var% { }'
if (tok->next()) { // '%empty% namespace %anytoken%'? if (!tok->previous()) {
if (!tok->previous()) { // remove 'namespace' or replace it with ';' if isolated
tok->deleteThis(); // remove 'namespace' tok->deleteThis();
goback = true; goback = true;
} else { // '%any% namespace %any%' } else { // '%any% namespace %any%'
tok = tok->previous(); // goto previous token tok = tok->previous(); // goto previous token
tok->deleteNext(); // remove next token: 'namespace' tok->deleteNext(); // remove next token: 'namespace'
} }
} else // '%empty% namespace %empty%'?
tok->str(";"); // change 'namespace' to ';'
} else { } else {
tok = tok->tokAt(2); tok = tok->tokAt(2);
} }