de-duplicate code

Change-Id: Ic056acf739659215241c1cab6a462b1ab591dc78
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
This commit is contained in:
Oswald Buddenhagen 2014-04-02 20:38:57 +02:00 committed by The Qt Project
parent a4ec90175c
commit fb143abbfb

View File

@ -1277,9 +1277,9 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
return ReturnFalse; return ReturnFalse;
} }
int cnt = values(map(args.at(0))).count(); int cnt = values(map(args.at(0))).count();
int val = args.at(1).toQString(m_tmp1).toInt();
if (args.count() == 3) { if (args.count() == 3) {
const ProString &comp = args.at(2); const ProString &comp = args.at(2);
const int val = args.at(1).toQString(m_tmp1).toInt();
if (comp == QLatin1String(">") || comp == QLatin1String("greaterThan")) { if (comp == QLatin1String(">") || comp == QLatin1String("greaterThan")) {
return returnBool(cnt > val); return returnBool(cnt > val);
} else if (comp == QLatin1String(">=")) { } else if (comp == QLatin1String(">=")) {
@ -1290,13 +1290,13 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
return returnBool(cnt <= val); return returnBool(cnt <= val);
} else if (comp == QLatin1String("equals") || comp == QLatin1String("isEqual") } else if (comp == QLatin1String("equals") || comp == QLatin1String("isEqual")
|| comp == QLatin1String("=") || comp == QLatin1String("==")) { || comp == QLatin1String("=") || comp == QLatin1String("==")) {
return returnBool(cnt == val); // fallthrough
} else { } else {
evalError(fL1S("Unexpected modifier to count(%2).").arg(comp.toQString(m_tmp1))); evalError(fL1S("Unexpected modifier to count(%2).").arg(comp.toQString(m_tmp1)));
return ReturnFalse; return ReturnFalse;
} }
} }
return returnBool(cnt == args.at(1).toQString(m_tmp1).toInt()); return returnBool(cnt == val);
} }
case T_GREATERTHAN: case T_GREATERTHAN:
case T_LESSTHAN: { case T_LESSTHAN: {