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