don't ignore parsing errors in eval() and on the command line

to optimally support cumulative mode, the parser will happily return a
bytecode object even when parsing failed, so errors must be treated
later.

Change-Id: I1a5c0ca9bf46a93d7359f590f0dd0ddc96baba0a
Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
This commit is contained in:
Oswald Buddenhagen
2012-07-27 19:56:28 +02:00
parent 160e608f5a
commit bb063b35f4
2 changed files with 16 additions and 10 deletions

View File

@@ -1012,15 +1012,19 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateConditionalFunction(
case T_REQUIRES: case T_REQUIRES:
#endif #endif
case T_EVAL: { case T_EVAL: {
VisitReturn ret = ReturnFalse;
ProFile *pro = m_parser->parsedProBlock(fL1S("(eval)"), ProFile *pro = m_parser->parsedProBlock(fL1S("(eval)"),
args.join(statics.field_sep)); args.join(statics.field_sep));
if (!pro) if (pro) {
return ReturnFalse; if (m_cumulative || pro->isOk()) {
m_locationStack.push(m_current); m_locationStack.push(m_current);
visitProBlock(pro, pro->tokPtr()); visitProBlock(pro, pro->tokPtr());
m_current = m_locationStack.pop(); ret = ReturnTrue; // This return value is not too useful, but that's qmake
pro->deref(); m_current = m_locationStack.pop();
return ReturnTrue; // This return value is not too useful, but that's qmake }
pro->deref();
}
return ret;
} }
case T_BREAK: case T_BREAK:
if (m_skipLevel) if (m_skipLevel)

View File

@@ -1128,9 +1128,11 @@ void QMakeEvaluator::visitCmdLine(const QString &cmds)
{ {
if (!cmds.isEmpty()) { if (!cmds.isEmpty()) {
if (ProFile *pro = m_parser->parsedProBlock(fL1S("(command line)"), cmds)) { if (ProFile *pro = m_parser->parsedProBlock(fL1S("(command line)"), cmds)) {
m_locationStack.push(m_current); if (pro->isOk()) {
visitProBlock(pro, pro->tokPtr()); m_locationStack.push(m_current);
m_current = m_locationStack.pop(); visitProBlock(pro, pro->tokPtr());
m_current = m_locationStack.pop();
}
pro->deref(); pro->deref();
} }
} }