From ed3dbbab45125ea74daa31d5c08411d3e5dac03b Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 14 May 2009 14:30:08 +0200 Subject: 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 --- tools/linguist/shared/profileevaluator.cpp | 6 ++++-- 1 file 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; } -- cgit v0.12