Commit 98fe30e2 authored by Oswald Buddenhagen's avatar Oswald Buddenhagen
Browse files

permit returning from files



this allows skipping an entire feature file if a condition is not
fulfilled, without putting the whole body inside a conditional.

Change-Id: I84fe9c94dda58c794fb52c3f163b40563b0db30a
Reviewed-by: default avatarJoerg Bornemann <joerg.bornemann@digia.com>
Reviewed-by: default avatarOswald Buddenhagen <oswald.buddenhagen@digia.com>
(cherry picked from qtbase/525eb337670f61078383c20ad9be274dcf2d0928)
parent aafd267b
......@@ -1022,7 +1022,6 @@ void QMakeParser::finalizeCall(ushort *&tokPtr, ushort *uc, ushort *ptr, int arg
m_tmp.setRawData((QChar *)uc + 4, nlen);
const QString *defName;
ushort defType;
uchar nest;
if (m_tmp == statics.strfor) {
if (m_invert || m_operator == OrOperator) {
// '|' could actually work reasonably, but qmake does nonsense here.
......@@ -1099,13 +1098,20 @@ void QMakeParser::finalizeCall(ushort *&tokPtr, ushort *uc, ushort *ptr, int arg
parseError(fL1S("%1(function) requires one literal argument.").arg(*defName));
return;
} else if (m_tmp == statics.strreturn) {
if (argc > 1) {
parseError(fL1S("return() requires zero or one argument."));
bogusTest(tokPtr);
return;
if (m_blockstack.top().nest & NestFunction) {
if (argc > 1) {
parseError(fL1S("return() requires zero or one argument."));
bogusTest(tokPtr);
return;
}
} else {
if (*uce != TokFuncTerminator) {
parseError(fL1S("Top-level return() requires zero arguments."));
bogusTest(tokPtr);
return;
}
}
defType = TokReturn;
nest = NestFunction;
goto ctrlstm2;
} else if (m_tmp == statics.strnext) {
defType = TokNext;
......@@ -1118,15 +1124,14 @@ void QMakeParser::finalizeCall(ushort *&tokPtr, ushort *uc, ushort *ptr, int arg
bogusTest(tokPtr);
return;
}
nest = NestLoop;
ctrlstm2:
if (m_invert) {
parseError(fL1S("Unexpected NOT operator in front of %1().").arg(m_tmp));
if (!(m_blockstack.top().nest & NestLoop)) {
parseError(fL1S("Unexpected %1().").arg(m_tmp));
bogusTest(tokPtr);
return;
}
if (!(m_blockstack.top().nest & nest)) {
parseError(fL1S("Unexpected %1().").arg(m_tmp));
ctrlstm2:
if (m_invert) {
parseError(fL1S("Unexpected NOT operator in front of %1().").arg(m_tmp));
bogusTest(tokPtr);
return;
}
......
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