forked from qt-creator/qt-creator
give load()/include() with target and infile()/$$fromfile() a clean environment
follow suit to qmake ... Change-Id: If9aa8b14e8b54768faef9151727bdb29fa1ed64b Reviewed-by: Daniel Teske <daniel.teske@nokia.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
This commit is contained in:
@@ -416,8 +416,7 @@ ProStringList QMakeEvaluator::evaluateExpandFunction(
|
||||
QHash<ProString, ProStringList> vars;
|
||||
QString fn = resolvePath(m_option->expandEnvVars(args.at(0).toQString(m_tmp1)));
|
||||
fn.detach();
|
||||
if (evaluateFileInto(fn, QMakeHandler::EvalAuxFile,
|
||||
&vars, &m_functionDefs, EvalProOnly))
|
||||
if (evaluateFileInto(fn, QMakeHandler::EvalAuxFile, &vars, EvalProOnly))
|
||||
ret = vars.value(map(args.at(1)));
|
||||
}
|
||||
break;
|
||||
@@ -704,8 +703,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateConditionalFunction(
|
||||
QHash<ProString, ProStringList> vars;
|
||||
QString fn = resolvePath(m_option->expandEnvVars(args.at(0).toQString(m_tmp1)));
|
||||
fn.detach();
|
||||
if (!evaluateFileInto(fn, QMakeHandler::EvalAuxFile,
|
||||
&vars, &m_functionDefs, EvalProOnly))
|
||||
if (!evaluateFileInto(fn, QMakeHandler::EvalAuxFile, &vars, EvalProOnly))
|
||||
return ReturnFalse;
|
||||
if (args.count() == 2)
|
||||
return returnBool(vars.contains(args.at(1)));
|
||||
@@ -995,7 +993,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateConditionalFunction(
|
||||
} else {
|
||||
QHash<ProString, ProStringList> symbols;
|
||||
if ((ok = evaluateFileInto(fn, QMakeHandler::EvalAuxFile,
|
||||
&symbols, 0, EvalWithSetup))) {
|
||||
&symbols, EvalWithSetup))) {
|
||||
QHash<ProString, ProStringList> newMap;
|
||||
for (QHash<ProString, ProStringList>::ConstIterator
|
||||
it = m_valuemapStack.top().constBegin(),
|
||||
|
||||
@@ -882,7 +882,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProFile(
|
||||
qmake_cache = resolvePath(qmake_cache);
|
||||
QHash<ProString, ProStringList> cache_valuemap;
|
||||
if (evaluateFileInto(qmake_cache, QMakeHandler::EvalConfigFile,
|
||||
&cache_valuemap, 0, EvalProOnly)) {
|
||||
&cache_valuemap, EvalProOnly)) {
|
||||
if (m_option->qmakespec.isEmpty()) {
|
||||
const ProStringList &vals = cache_valuemap.value(ProString("QMAKESPEC"));
|
||||
if (!vals.isEmpty())
|
||||
@@ -1963,22 +1963,17 @@ bool QMakeEvaluator::evaluateFeatureFile(const QString &fileName)
|
||||
|
||||
bool QMakeEvaluator::evaluateFileInto(
|
||||
const QString &fileName, QMakeHandler::EvalFileType type,
|
||||
QHash<ProString, ProStringList> *values, ProFunctionDefs *funcs, EvalIntoMode mode)
|
||||
QHash<ProString, ProStringList> *values, EvalIntoMode mode)
|
||||
{
|
||||
QMakeEvaluator visitor(m_option, m_parser, m_handler);
|
||||
#ifdef PROEVALUATOR_CUMULATIVE
|
||||
visitor.m_cumulative = false;
|
||||
#endif
|
||||
visitor.m_outputDir = m_outputDir;
|
||||
// visitor.m_valuemapStack.top() = *values;
|
||||
if (funcs)
|
||||
visitor.m_functionDefs = *funcs;
|
||||
if (!visitor.evaluateFile(fileName, type,
|
||||
(mode == EvalWithSetup) ? LoadAll : LoadProOnly))
|
||||
return false;
|
||||
*values = visitor.m_valuemapStack.top();
|
||||
// if (funcs)
|
||||
// *funcs = visitor.m_functionDefs;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -133,8 +133,8 @@ public:
|
||||
bool evaluateFeatureFile(const QString &fileName);
|
||||
enum EvalIntoMode { EvalProOnly, EvalWithSetup };
|
||||
bool evaluateFileInto(const QString &fileName, QMakeHandler::EvalFileType type,
|
||||
QHash<ProString, ProStringList> *values, ProFunctionDefs *defs,
|
||||
EvalIntoMode mode); // values are output-only, defs are input-only
|
||||
QHash<ProString, ProStringList> *values, // output-only
|
||||
EvalIntoMode mode);
|
||||
void evalError(const QString &msg) const;
|
||||
|
||||
QList<ProStringList> prepareFunctionArgs(const ushort *&tokPtr);
|
||||
|
||||
Reference in New Issue
Block a user