Commit 81f6001f authored by Oswald Buddenhagen's avatar Oswald Buddenhagen
Browse files

move include recursion check to evaluateFile() where it belongs

parent f4cc46d5
......@@ -2614,24 +2614,17 @@ QStringList ProFileEvaluator::Private::values(const QString &variableName, const
return values(variableName, m_filevaluemap[pro], pro);
}
// virtual
ProFile *ProFileEvaluator::parsedProFile(const QString &fileName)
{
QFileInfo fi(fileName);
if (fi.exists()) {
QString fn = QDir::cleanPath(fi.absoluteFilePath());
foreach (const ProFile *pf, d->m_profileStack)
if (pf->fileName() == fn) {
errorMessage(d->format("circular inclusion of %1").arg(fn));
return 0;
}
ProFile *pro = new ProFile(fn);
ProFile *pro = new ProFile(fileName);
if (d->read(pro))
return pro;
delete pro;
}
return 0;
}
// virtual
void ProFileEvaluator::releaseParsedProFile(ProFile *proFile)
{
delete proFile;
......@@ -2639,7 +2632,16 @@ void ProFileEvaluator::releaseParsedProFile(ProFile *proFile)
bool ProFileEvaluator::Private::evaluateFile(const QString &fileName)
{
ProFile *pro = q->parsedProFile(fileName);
QFileInfo fi(fileName);
if (!fi.exists())
return false;
QString fn = QDir::cleanPath(fi.absoluteFilePath());
foreach (const ProFile *pf, m_profileStack)
if (pf->fileName() == fn) {
q->errorMessage(format("circular inclusion of %1").arg(fn));
return false;
}
ProFile *pro = q->parsedProFile(fn);
if (pro) {
bool ok = (pro->Accept(this) == ProItem::ReturnTrue);
q->releaseParsedProFile(pro);
......
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