Tokenizer:: Use 'link' instead of 'parens' variable.

This commit is contained in:
Edoardo Prezioso 2012-01-30 12:21:08 +01:00
parent 9df6088ddd
commit a93af0dba6
1 changed files with 8 additions and 14 deletions

View File

@ -1040,24 +1040,18 @@ void Tokenizer::simplifyTypedef()
// check for template // check for template
if (tok->strAt(offset) == "<") { if (tok->strAt(offset) == "<") {
unsigned int level = 0; unsigned int level = 0;
unsigned int paren = 0;
typeEnd = tok->tokAt(offset + 1); typeEnd = tok->tokAt(offset + 1);
for (; typeEnd ; typeEnd = typeEnd->next()) { for (; typeEnd ; typeEnd = typeEnd->next()) {
if (typeEnd->str() == ">") { if (typeEnd->str() == ">") {
if (!paren) {
if (!level) if (!level)
break; break;
--level; --level;
}
} else if (typeEnd->str() == "<") { } else if (typeEnd->str() == "<") {
if (!paren)
++level; ++level;
} else if (typeEnd->str() == "(") } else if (typeEnd->str() == "(" || typeEnd->str() == "[")
++paren; typeEnd = typeEnd->link();
else if (typeEnd->str() == ")") { else if (typeEnd->str() == ")" || typeEnd->str() == "]") {
if (!paren)
break; break;
--paren;
} }
} }