forked from qt-creator/qt-creator
qmake: Expose ARGC to qmake functions to be able to check argument count
ARGS already exists, but is a flattened list of the arguments, so both foo(bar, baz) and foo(bar baz) will give count(ARGS, 2), making it unreliable for validating arguments to qmake functions. Change-Id: I0bcc16614c64000169431327da48fd1a26708e67 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com> (cherry picked from qtbase/09205d573413da8a2ac3826198fe36bb2dc4349f) Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
committed by
Oswald Buddenhagen
parent
e7778e67a8
commit
4d75cb93a3
@@ -109,6 +109,7 @@ void QMakeEvaluator::initStatics()
|
|||||||
statics.strfalse = QLatin1String("false");
|
statics.strfalse = QLatin1String("false");
|
||||||
statics.strCONFIG = ProKey("CONFIG");
|
statics.strCONFIG = ProKey("CONFIG");
|
||||||
statics.strARGS = ProKey("ARGS");
|
statics.strARGS = ProKey("ARGS");
|
||||||
|
statics.strARGC = ProKey("ARGC");
|
||||||
statics.strDot = QLatin1String(".");
|
statics.strDot = QLatin1String(".");
|
||||||
statics.strDotDot = QLatin1String("..");
|
statics.strDotDot = QLatin1String("..");
|
||||||
statics.strever = QLatin1String("ever");
|
statics.strever = QLatin1String("ever");
|
||||||
@@ -1635,6 +1636,7 @@ ProStringList QMakeEvaluator::evaluateFunction(
|
|||||||
m_valuemapStack.top()[ProKey(QString::number(i+1))] = argumentsList[i];
|
m_valuemapStack.top()[ProKey(QString::number(i+1))] = argumentsList[i];
|
||||||
}
|
}
|
||||||
m_valuemapStack.top()[statics.strARGS] = args;
|
m_valuemapStack.top()[statics.strARGS] = args;
|
||||||
|
m_valuemapStack.top()[statics.strARGC] = ProStringList(ProString(QString::number(argumentsList.count())));
|
||||||
vr = visitProBlock(func.pro(), func.tokPtr());
|
vr = visitProBlock(func.pro(), func.tokPtr());
|
||||||
if (vr == ReturnReturn)
|
if (vr == ReturnReturn)
|
||||||
vr = ReturnTrue;
|
vr = ReturnTrue;
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ struct QMakeStatics {
|
|||||||
QString strfalse;
|
QString strfalse;
|
||||||
ProKey strCONFIG;
|
ProKey strCONFIG;
|
||||||
ProKey strARGS;
|
ProKey strARGS;
|
||||||
|
ProKey strARGC;
|
||||||
QString strDot;
|
QString strDot;
|
||||||
QString strDotDot;
|
QString strDotDot;
|
||||||
QString strever;
|
QString strever;
|
||||||
|
|||||||
Reference in New Issue
Block a user