From bb198aed5eee7369f4bdc2e6e8e3f398fd1b967a Mon Sep 17 00:00:00 2001 From: Reijo Tomperi Date: Sun, 21 Dec 2008 14:27:07 +0000 Subject: [PATCH] Fixed bug, varid was not assigned properly when bool use = false; was splitted into two statements in simplify code. --- tokenize.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tokenize.cpp b/tokenize.cpp index 1c7b6a680..bcdb7c68e 100644 --- a/tokenize.cpp +++ b/tokenize.cpp @@ -216,9 +216,10 @@ void Tokenizer::InsertTokens(TOKEN *dest, TOKEN *src, unsigned int n) while (n > 0) { dest->insertToken( src->aaaa() ); - dest->next()->fileIndex( src->fileIndex() ); - dest->next()->linenr( src->linenr() ); dest = dest->next(); + dest->fileIndex( src->fileIndex() ); + dest->linenr( src->linenr() ); + dest->varId( src->varId() ); src = src->next(); n--; } @@ -1200,7 +1201,6 @@ bool Tokenizer::simplifyKnownVariables() // parse the block of code.. int indentlevel = 0; - for ( TOKEN *tok2 = tok; tok2; tok2 = tok2->next() ) { @@ -1218,6 +1218,9 @@ bool Tokenizer::simplifyKnownVariables() TOKEN::Match(tok2, "%var% = %bool% ;")) { unsigned int varid = tok2->varId(); + if( varid == 0 ) + continue; + for ( TOKEN *tok3 = tok2->next(); tok3; tok3 = tok3->next() ) { // Perhaps it's a loop => bail out