Remove redundant code in simplifyVarDecl:

TokenList::insertTokens adds the missing braces links when needed. The function does not add links to '<>', though, hence the TODO.
This commit is contained in:
Edoardo Prezioso 2012-11-05 00:09:14 +01:00
parent 4d38dd4f2c
commit 7293fcfa9b
1 changed files with 1 additions and 17 deletions

View File

@ -5076,24 +5076,8 @@ void Tokenizer::simplifyVarDecl(bool only_k_r_fpar)
if (tok2->str() == ",") { if (tok2->str() == ",") {
tok2->str(";"); tok2->str(";");
//TODO: should we have to add also template '<>' links?
list.insertTokens(tok2, type0, typelen); list.insertTokens(tok2, type0, typelen);
std::stack<Token *> link1;
std::stack<Token *> link2;
while (((typelen--) > 0) && (NULL != (tok2 = tok2->next()))) {
if (tok2->str() == "(")
link1.push(tok2);
else if (tok2->str() == ")" && !link1.empty()) {
Token::createMutualLinks(tok2, link1.top());
link1.pop();
}
else if (tok2->str() == "[")
link2.push(tok2);
else if (tok2->str() == "]" && !link2.empty()) {
Token::createMutualLinks(tok2, link2.top());
link2.pop();
}
}
} }
else { else {