aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmltyperegistrar/qmltypesclassdescription.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qmltyperegistrar/qmltypesclassdescription.cpp')
-rw-r--r--src/qmltyperegistrar/qmltypesclassdescription.cpp23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/qmltyperegistrar/qmltypesclassdescription.cpp b/src/qmltyperegistrar/qmltypesclassdescription.cpp
index 7756fda9e4..9aadd75acc 100644
--- a/src/qmltyperegistrar/qmltypesclassdescription.cpp
+++ b/src/qmltyperegistrar/qmltypesclassdescription.cpp
@@ -62,6 +62,7 @@ void QmlTypesClassDescription::collect(const QJsonObject *classDef,
const QVector<QJsonObject> &foreign,
CollectMode mode)
{
+ const QJsonObject *origClassDef = classDef; // if we find QML.Foreign, classDef changes.
if (file.isEmpty() && classDef->value(QLatin1String("registerable")).toBool())
file = classDef->value(QLatin1String("inputFile")).toString();
const auto classInfos = classDef->value(QLatin1String("classInfos")).toArray();
@@ -130,21 +131,33 @@ void QmlTypesClassDescription::collect(const QJsonObject *classDef,
collectExtraVersions(classDef, QString::fromLatin1("signals"), revisions);
}
- const auto supers = classDef->value(QLatin1String("superClasses")).toArray();
- if (!supers.isEmpty()) {
- const QJsonObject superObject = supers.first().toObject();
+ auto supers = classDef->value(QLatin1String("superClasses")).toArray();
+ if (classDef != origClassDef) {
+ const QJsonArray origSupers = origClassDef->value(QLatin1String("superClasses")).toArray();
+ for (const QJsonValue &origSuper : origSupers)
+ supers.append(origSuper);
+ }
+
+ for (const QJsonValue &superValue : qAsConst(supers)) {
+ const QJsonObject superObject = superValue.toObject();
if (superObject[QLatin1String("access")].toString() == QLatin1String("public")) {
const QString superName = superObject[QLatin1String("name")].toString();
- if (mode == TopLevel && superClass.isEmpty())
- superClass = superName;
if (const QJsonObject *other = findType(types, superName))
collect(other, types, foreign, mode == TopLevel ? SuperClass : AttachedType);
else if (const QJsonObject *other = findType(foreign, superName))
collect(other, types, foreign, mode == TopLevel ? SuperClass : AttachedType);
+ else // If we cannot locate a type for it, there is no point in recording the superClass
+ continue;
+
+ if (mode == TopLevel && superClass.isEmpty())
+ superClass = superName;
}
}
+ if (mode != TopLevel)
+ return;
+
if (addedInRevision == -1) {
revisions.append(0);
addedInRevision = 0;