forked from qt-creator/qt-creator
don't skip unconditional scopes
This commit is contained in:
@@ -229,6 +229,7 @@ public:
|
|||||||
QStringList varVal;
|
QStringList varVal;
|
||||||
} m_sts;
|
} m_sts;
|
||||||
bool m_invertNext; // Short-lived, so not in State
|
bool m_invertNext; // Short-lived, so not in State
|
||||||
|
bool m_hadCondition; // Nested calls set it on return, so no need for it to be in State
|
||||||
int m_skipLevel;
|
int m_skipLevel;
|
||||||
bool m_cumulative;
|
bool m_cumulative;
|
||||||
QStack<QString> m_oldPathStack; // To restore the current path to the path
|
QStack<QString> m_oldPathStack; // To restore the current path to the path
|
||||||
@@ -938,12 +939,15 @@ ProItem::ProItemReturn ProFileEvaluator::Private::visitBeginProBlock(ProBlock *b
|
|||||||
m_definingFunc.clear();
|
m_definingFunc.clear();
|
||||||
return ProItem::ReturnSkip;
|
return ProItem::ReturnSkip;
|
||||||
} else if (!(block->blockKind() & ProBlock::FunctionBodyKind)) {
|
} else if (!(block->blockKind() & ProBlock::FunctionBodyKind)) {
|
||||||
if (!m_sts.condition)
|
if (!m_sts.condition) {
|
||||||
|
if (m_skipLevel || m_hadCondition)
|
||||||
++m_skipLevel;
|
++m_skipLevel;
|
||||||
else
|
} else {
|
||||||
Q_ASSERT(!m_skipLevel);
|
Q_ASSERT(!m_skipLevel);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
m_hadCondition = false;
|
||||||
if (!m_skipLevel) {
|
if (!m_skipLevel) {
|
||||||
if (m_sts.condition) {
|
if (m_sts.condition) {
|
||||||
m_sts.prevCondition = true;
|
m_sts.prevCondition = true;
|
||||||
@@ -1095,6 +1099,7 @@ void ProFileEvaluator::Private::visitProOperator(ProOperator *oper)
|
|||||||
void ProFileEvaluator::Private::visitProCondition(ProCondition *cond)
|
void ProFileEvaluator::Private::visitProCondition(ProCondition *cond)
|
||||||
{
|
{
|
||||||
if (!m_skipLevel) {
|
if (!m_skipLevel) {
|
||||||
|
m_hadCondition = true;
|
||||||
if (!cond->text().compare(QLatin1String("else"), Qt::CaseInsensitive)) {
|
if (!cond->text().compare(QLatin1String("else"), Qt::CaseInsensitive)) {
|
||||||
m_sts.condition = !m_sts.prevCondition;
|
m_sts.condition = !m_sts.prevCondition;
|
||||||
} else {
|
} else {
|
||||||
@@ -1274,8 +1279,10 @@ ProItem::ProItemReturn ProFileEvaluator::Private::visitProFunction(ProFunction *
|
|||||||
// Make sure that called subblocks don't inherit & destroy the state
|
// Make sure that called subblocks don't inherit & destroy the state
|
||||||
bool invertThis = m_invertNext;
|
bool invertThis = m_invertNext;
|
||||||
m_invertNext = false;
|
m_invertNext = false;
|
||||||
if (!m_skipLevel)
|
if (!m_skipLevel) {
|
||||||
|
m_hadCondition = true;
|
||||||
m_sts.prevCondition = false;
|
m_sts.prevCondition = false;
|
||||||
|
}
|
||||||
if (m_cumulative || !m_sts.condition) {
|
if (m_cumulative || !m_sts.condition) {
|
||||||
QString text = func->text();
|
QString text = func->text();
|
||||||
int lparen = text.indexOf(QLatin1Char('('));
|
int lparen = text.indexOf(QLatin1Char('('));
|
||||||
|
|||||||
Reference in New Issue
Block a user