Commit 68b1b828 authored by Oswald Buddenhagen's avatar Oswald Buddenhagen
Browse files

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.
parent 51f5ee95
...@@ -869,6 +869,9 @@ bool ProFileEvaluator::Private::visitProValue(ProValue *value) ...@@ -869,6 +869,9 @@ bool ProFileEvaluator::Private::visitProValue(ProValue *value)
bool ProFileEvaluator::Private::visitProFunction(ProFunction *func) 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) { if (!m_sts.updateCondition || m_sts.condition == ConditionFalse) {
QString text = func->text(); QString text = func->text();
int lparen = text.indexOf(QLatin1Char('(')); int lparen = text.indexOf(QLatin1Char('('));
...@@ -878,10 +881,9 @@ bool ProFileEvaluator::Private::visitProFunction(ProFunction *func) ...@@ -878,10 +881,9 @@ bool ProFileEvaluator::Private::visitProFunction(ProFunction *func)
QString funcName = text.left(lparen); QString funcName = text.left(lparen);
m_lineNo = func->lineNumber(); m_lineNo = func->lineNumber();
bool result = evaluateConditionalFunction(funcName.trimmed(), arguments); bool result = evaluateConditionalFunction(funcName.trimmed(), arguments);
if (!m_skipLevel && (result ^ m_invertNext)) if (!m_skipLevel && (result ^ invertThis))
m_sts.condition = ConditionTrue; m_sts.condition = ConditionTrue;
} }
m_invertNext = false;
return true; return true;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment