QmlCompiler: Add C++ name also for types with no export candidates

Even if the type is only exported in a newer version of the module, we
still need to know about it in an earlier version, in order to resolve
base types.

Pick-to: 6.3
Change-Id: Ibc7940308e3c4aaebf9871a159e1d85f43cd7693
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
Ulf Hermann 2022-01-21 12:30:20 +01:00
parent 3a46d09c54
commit 24e5b9090b
3 changed files with 12 additions and 2 deletions

View File

@ -360,8 +360,12 @@ void QQmlJSImporter::processImport(const QQmlJSScope::Import &importDescription,
seenExports[qmlName].append(valExport);
}
if (bestExport.isValid())
types->cppNames.insert(cppName, { val.scope, bestExport.revision() });
types->cppNames.insert(
cppName, {
val.scope,
bestExport.isValid() ? bestExport.revision() : QTypeRevision::zero()
}
);
};
if (!importDescription.prefix().isEmpty())

View File

@ -0,0 +1,5 @@
import QtQuick 2.0
QtObject {
property QtObject i: Image {}
}

View File

@ -998,6 +998,7 @@ void TestQmllint::cleanQmlCode_data()
QTest::newRow("QObject.hasOwnProperty") << QStringLiteral("qobjectHasOwnProperty.qml");
QTest::newRow("cppPropertyChangeHandlers")
<< QStringLiteral("goodCppPropertyChangeHandlers.qml");
QTest::newRow("unexportedCppBase") << QStringLiteral("unexportedCppBase.qml");
}
void TestQmllint::cleanQmlCode()