From 13c2a73d3f3df2246eea579ecc51e1bf6de89f3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sat, 6 Nov 2010 11:38:58 +0100 Subject: [PATCH] Tokenizer::simplifyKnownVariables: Fixed TODO test case. --- lib/tokenize.cpp | 3 ++- test/testtokenize.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 2be550f5f..c7ee59a0a 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -5982,7 +5982,8 @@ bool Tokenizer::simplifyKnownVariables() } // Variable is used in calculation.. - if (Token::Match(tok3, "[=+-*/[] %varid% [=?+-*/;])]", varid) || + if (((tok3->previous()->varId() > 0) && Token::Match(tok3, "& %varid%", varid)) || + Token::Match(tok3, "[=+-*/[] %varid% [=?+-*/;])]", varid) || Token::Match(tok3, "[(=+-*/[] %varid% <<|>>", varid) || Token::Match(tok3, "<< %varid% [+-*/;])]", varid) || Token::Match(tok3, ">> %varid% [+-*/;])]", varid) || diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 3a7573303..540d28be7 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -1598,7 +1598,7 @@ private: "4:\n" "5: return u@1 & v@2 ;\n" "6: }\n"; - TODO_ASSERT_EQUALS(expected, tokenizeDebugListing(code, true)); + ASSERT_EQUALS(expected, tokenizeDebugListing(code, true)); } {