qmltyperegistrar: Do not add extensions to local anonymous types

If we generate a local anonymous type, then that's the local part of a
QML_FOREIGN local/foreign couple. Any QML.Extended in there belong to
the foreign type.

Change-Id: Ic1706045eff03dd7b1b553240596ffc21818c8bd
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
Ulf Hermann 2021-02-02 08:35:06 +01:00
parent 19cdf0aa9e
commit c892b26f06
2 changed files with 3 additions and 10 deletions

View File

@ -112,15 +112,8 @@ void QmlTypesClassDescription::collectLocalAnonymous(
const auto classInfos = classDef->value(QLatin1String("classInfos")).toArray();
for (const QJsonValue &classInfo : classInfos) {
const QJsonObject obj = classInfo.toObject();
const QString name = obj[QStringLiteral("name")].toString();
const QString value = obj[QStringLiteral("value")].toString();
if (name == QStringLiteral("DefaultProperty")) {
defaultProp = obj[QLatin1String("value")].toString();
} else if (name == QStringLiteral("QML.Extended")) {
extensionType = value;
collectRelated(value, types, foreign, defaultRevision);
}
if (obj[QStringLiteral("name")].toString() == QStringLiteral("DefaultProperty"))
defaultProp = obj[obj[QStringLiteral("value")].toString()].toString();
}
collectInterfaces(classDef);

View File

@ -88,7 +88,7 @@ void tst_qmltyperegistrar::superAndForeignTypes()
QVERIFY(qmltypesData.contains("Property { name: \"height\"; type: \"int\"; read: \"height\"; write: \"setHeight\" }"));
QVERIFY(qmltypesData.contains("Property { name: \"width\"; type: \"int\"; read: \"width\"; write: \"setWidth\" }"));
QVERIFY(qmltypesData.contains("Method { name: \"sizeToString\"; type: \"QString\" }"));
QVERIFY(qmltypesData.contains("extension: \"SizeValueType\""));
QCOMPARE(qmltypesData.count("extension: \"SizeValueType\""), 1);
}
void tst_qmltyperegistrar::accessSemantics()