Adjustment for implementation of Token::insertToken() (#1194)

Three attributes are reset in this member function even if their values
are stored in the same token object.
Move a corresponding sanity check so that less assignments could be
performed eventually.
Link: https://trac.cppcheck.net/ticket/8532
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
This commit is contained in:
Markus Elfring 2018-04-28 17:17:40 +02:00 committed by Daniel Marjamäki
parent ca8e19c96d
commit 521e3495b7
1 changed files with 4 additions and 3 deletions

View File

@ -909,11 +909,12 @@ void Token::insertToken(const std::string &tokenStr, const std::string &original
newToken->str(tokenStr);
if (!originalNameStr.empty())
newToken->originalName(originalNameStr);
newToken->_linenr = _linenr;
newToken->_fileIndex = _fileIndex;
newToken->_progressValue = _progressValue;
if (newToken != this) {
newToken->_linenr = _linenr;
newToken->_fileIndex = _fileIndex;
newToken->_progressValue = _progressValue;
if (prepend) {
/*if (this->previous())*/ {
newToken->previous(this->previous());