C++: Reduce calls to translationUnit->tokenCount()

Change-Id: I59527ded34873286072be51c6a141dffcbf93406
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
This commit is contained in:
hjk
2013-04-15 15:56:44 +02:00
parent ad9081e3d8
commit 90b4f5c95e

View File

@@ -6440,10 +6440,11 @@ void Parser::rewind(unsigned cursor)
fprintf(stderr, "! rewinding from token %d to token %d\n", _tokenIndex, cursor);
#endif
if (cursor < _translationUnit->tokenCount())
const int n = _translationUnit->tokenCount();
if (cursor < n)
_tokenIndex = cursor;
else
_tokenIndex = _translationUnit->tokenCount() - 1;
_tokenIndex = n - 1;
}
void Parser::warning(unsigned index, const char *format, ...)