Tokenize: minimize createLinks() calls.

No functional change.
This commit is contained in:
Slava Semushin 2009-08-23 07:38:00 +07:00
parent ec050d2563
commit 703fd45f78
1 changed files with 4 additions and 8 deletions

View File

@ -1137,8 +1137,6 @@ bool Tokenizer::createLinks()
void Tokenizer::simplifyTokenList() void Tokenizer::simplifyTokenList()
{ {
createLinks();
simplifyNamespaces(); simplifyNamespaces();
// Combine wide strings // Combine wide strings
@ -1846,6 +1844,7 @@ bool Tokenizer::simplifyIfAddBraces()
if (tempToken) if (tempToken)
{ {
tempToken->insertToken("}"); tempToken->insertToken("}");
Token::createMutualLinks(tok, tempToken->next());
ret = true; ret = true;
} }
} }
@ -1933,6 +1932,8 @@ bool Tokenizer::simplifyConditionOperator()
} }
tok = tok->next(); tok = tok->next();
} }
Token::createMutualLinks(tok->tokAt(-10), tok->tokAt(-8));
} }
} }
return ret; return ret;
@ -2656,8 +2657,6 @@ bool Tokenizer::simplifyIfAssign()
bool Tokenizer::simplifyIfNot() bool Tokenizer::simplifyIfNot()
{ {
// Make sure we have working links
createLinks();
bool ret = false; bool ret = false;
for (Token *tok = _tokens; tok; tok = tok->next()) for (Token *tok = _tokens; tok; tok = tok->next())
{ {
@ -2721,8 +2720,6 @@ bool Tokenizer::simplifyIfNot()
bool Tokenizer::simplifyIfNotNull() bool Tokenizer::simplifyIfNotNull()
{ {
// Make sure we have working links
createLinks();
bool ret = false; bool ret = false;
for (Token *tok = _tokens; tok; tok = tok->next()) for (Token *tok = _tokens; tok; tok = tok->next())
{ {
@ -2787,7 +2784,6 @@ bool Tokenizer::simplifyNot()
bool Tokenizer::simplifyKnownVariables() bool Tokenizer::simplifyKnownVariables()
{ {
createLinks();
bool ret = false; bool ret = false;
for (Token *tok = _tokens; tok; tok = tok->next()) for (Token *tok = _tokens; tok; tok = tok->next())
{ {
@ -2969,6 +2965,7 @@ bool Tokenizer::elseif()
tok->insertToken("{"); tok->insertToken("{");
tok2->insertToken("}"); tok2->insertToken("}");
ret = true; ret = true;
Token::createMutualLinks(tok->next(), tok2->next());
break; break;
} }
} }
@ -3379,7 +3376,6 @@ void Tokenizer::syntaxError(const Token *tok, char c)
bool Tokenizer::simplifyComma() bool Tokenizer::simplifyComma()
{ {
bool ret = false; bool ret = false;
createLinks();
for (Token *tok = _tokens; tok; tok = tok->next()) for (Token *tok = _tokens; tok; tok = tok->next())
{ {
if (Token::simpleMatch(tok, "for (")) if (Token::simpleMatch(tok, "for ("))