forked from qt-creator/qt-creator
QmlJs: circular dependencies handling
Task-number: QTCREATORBUG-16585 Change-Id: Ia1e01f1314cd4022d59dc768752baaa367fe250a Reviewed-by: Robert Loehning <robert.loehning@qt.io> Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
This commit is contained in:
@@ -458,19 +458,27 @@ QString PluginDumper::buildQmltypesPath(const QString &name) const
|
|||||||
void PluginDumper::loadDependencies(const QStringList &dependencies,
|
void PluginDumper::loadDependencies(const QStringList &dependencies,
|
||||||
QStringList &errors,
|
QStringList &errors,
|
||||||
QStringList &warnings,
|
QStringList &warnings,
|
||||||
QList<FakeMetaObject::ConstPtr> &objects) const
|
QList<FakeMetaObject::ConstPtr> &objects,
|
||||||
|
QSet<QString> *visited) const
|
||||||
{
|
{
|
||||||
|
if (dependencies.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
QScopedPointer<QSet<QString>> visitedPtr(visited ? visited : new QSet<QString>());
|
||||||
|
|
||||||
QStringList dependenciesPaths;
|
QStringList dependenciesPaths;
|
||||||
QString path;
|
QString path;
|
||||||
for (const QString &name: dependencies) {
|
for (const QString &name: dependencies) {
|
||||||
path = buildQmltypesPath(name);
|
path = buildQmltypesPath(name);
|
||||||
if (!path.isNull())
|
if (!path.isNull())
|
||||||
dependenciesPaths << path;
|
dependenciesPaths << path;
|
||||||
|
visitedPtr->insert(name);
|
||||||
}
|
}
|
||||||
QStringList newDependencies;
|
QStringList newDependencies;
|
||||||
loadQmlTypeDescription(dependenciesPaths, errors, warnings, objects, 0, &newDependencies);
|
loadQmlTypeDescription(dependenciesPaths, errors, warnings, objects, 0, &newDependencies);
|
||||||
|
newDependencies = (newDependencies.toSet() - *visitedPtr).toList();
|
||||||
if (!newDependencies.isEmpty())
|
if (!newDependencies.isEmpty())
|
||||||
loadDependencies(newDependencies, errors, warnings, objects);
|
loadDependencies(newDependencies, errors, warnings, objects, visitedPtr.take());
|
||||||
}
|
}
|
||||||
|
|
||||||
void PluginDumper::loadQmltypesFile(const QStringList &qmltypesFilePaths,
|
void PluginDumper::loadQmltypesFile(const QStringList &qmltypesFilePaths,
|
||||||
|
@@ -83,7 +83,8 @@ private:
|
|||||||
void loadDependencies(const QStringList &dependencies,
|
void loadDependencies(const QStringList &dependencies,
|
||||||
QStringList &errors,
|
QStringList &errors,
|
||||||
QStringList &warnings,
|
QStringList &warnings,
|
||||||
QList<LanguageUtils::FakeMetaObject::ConstPtr> &objects) const;
|
QList<LanguageUtils::FakeMetaObject::ConstPtr> &objects,
|
||||||
|
QSet<QString> *visited=0) const;
|
||||||
void loadQmltypesFile(const QStringList &qmltypesFilePaths,
|
void loadQmltypesFile(const QStringList &qmltypesFilePaths,
|
||||||
const QString &libraryPath,
|
const QString &libraryPath,
|
||||||
QmlJS::LibraryInfo libraryInfo);
|
QmlJS::LibraryInfo libraryInfo);
|
||||||
|
Reference in New Issue
Block a user