make defined() support testing definedness of variables

follow suit with qmake ...

Change-Id: I9b8a7b64df812c4c5a5ee25eaf931629feca0689
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-31 13:51:18 +02:00
parent c865baa2be
commit d77f76374a

View File

@@ -951,10 +951,14 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateConditionalFunction(
return ReturnFalse; return ReturnFalse;
} }
if (args.count() > 1) { if (args.count() > 1) {
if (args[1] == QLatin1String("test")) if (args[1] == QLatin1String("test")) {
return returnBool(m_functionDefs.testFunctions.contains(args[0])); return returnBool(m_functionDefs.testFunctions.contains(args[0]));
else if (args[1] == QLatin1String("replace")) } else if (args[1] == QLatin1String("replace")) {
return returnBool(m_functionDefs.replaceFunctions.contains(args[0])); return returnBool(m_functionDefs.replaceFunctions.contains(args[0]));
} else if (args[1] == QLatin1String("var")) {
ProValueMap::Iterator it;
return returnBool(findValues(args[0], &it));
}
evalError(fL1S("defined(function, type): unexpected type [%1].") evalError(fL1S("defined(function, type): unexpected type [%1].")
.arg(args.at(1).toQString(m_tmp1))); .arg(args.at(1).toQString(m_tmp1)));
return ReturnFalse; return ReturnFalse;