Merge pull request #363 from Dmitry-Me/dontRunTheAtLoopWhenNotNeeded

Get rid of tokAt() and strAt() in trivial cases.
This commit is contained in:
Daniel Marjamäki 2014-07-14 09:54:35 +02:00
commit e057e962e8
2 changed files with 5 additions and 2 deletions

View File

@ -40,7 +40,7 @@ void CheckAssert::assertWithSideEffects()
const Token *endTok = tok ? tok->next()->link() : nullptr;
while (tok && endTok) {
for (const Token* tmp = tok->tokAt(1); tmp != endTok; tmp = tmp->next()) {
for (const Token* tmp = tok->next(); tmp != endTok; tmp = tmp->next()) {
checkVariableAssignment(tmp, true);
if (tmp->isName() && tmp->type() == Token::eFunction) {

View File

@ -104,7 +104,10 @@ public:
}
const std::string& name() const {
return classDef->next()->isName() ? classDef->strAt(1) : emptyString;
const Token* next = classDef->next();
if (next->isName())
return next->str();
return emptyString;
}
const Token *initBaseInfo(const Token *tok, const Token *tok1);