Fixed bug, varid was not assigned properly when bool use = false; was splitted into two statements in simplify code.

This commit is contained in:
Reijo Tomperi 2008-12-21 14:27:07 +00:00
parent b7db651ee2
commit bb198aed5e
1 changed files with 6 additions and 3 deletions

View File

@ -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