summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2009-05-14 12:30:08 (GMT)
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2009-07-20 12:30:34 (GMT)
commited3dbbab45125ea74daa31d5c08411d3e5dac03b (patch)
treeb3122b5675f34bf493cee0048b41dbf3e0f7ac83
parenta76c1d097f14e93517f27debde806da4fd7498b9 (diff)
downloadQt-ed3dbbab45125ea74daa31d5c08411d3e5dac03b.zip
Qt-ed3dbbab45125ea74daa31d5c08411d3e5dac03b.tar.gz
Qt-ed3dbbab45125ea74daa31d5c08411d3e5dac03b.tar.bz2
fix m_invertNext effect scoping
an evaluation function can be an include statement. the included code must neither inherit nor change the current inversion state. cherry-picked 68b1b828e6030b4fe26ca9ffc4ee7a0b4bfe8f4e from creator
-rw-r--r--tools/linguist/shared/profileevaluator.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/linguist/shared/profileevaluator.cpp b/tools/linguist/shared/profileevaluator.cpp
index d4c4df8..95f3b1a 100644
--- a/tools/linguist/shared/profileevaluator.cpp
+++ b/tools/linguist/shared/profileevaluator.cpp
@@ -849,6 +849,9 @@ bool ProFileEvaluator::Private::visitProValue(ProValue *value)
bool ProFileEvaluator::Private::visitProFunction(ProFunction *func)
{
+ // Make sure that called subblocks don't inherit & destroy the state
+ bool invertThis = m_invertNext;
+ m_invertNext = false;
if (!m_sts.updateCondition || m_sts.condition == ConditionFalse) {
QString text = func->text();
int lparen = text.indexOf(QLatin1Char('('));
@@ -858,10 +861,9 @@ bool ProFileEvaluator::Private::visitProFunction(ProFunction *func)
QString funcName = text.left(lparen);
m_lineNo = func->lineNumber();
bool result = evaluateConditionalFunction(funcName.trimmed(), arguments);
- if (!m_skipLevel && (result ^ m_invertNext))
+ if (!m_skipLevel && (result ^ invertThis))
m_sts.condition = ConditionTrue;
}
- m_invertNext = false;
return true;
}