Skip to content

Commit 74fac24

Browse files
committed
QmlCompiler: Do not recurse when looking for builtins.qmltypes
A builtins.qmltypes in some subdirectory is generally not something we want to use. Pick-to: 6.2 6.5 6.6 Change-Id: Ic774800048917f6b61e3343fcb7d12b00bcee9bd Reviewed-by: Fabian Kosmale <[email protected]>
1 parent 26acad7 commit 74fac24

File tree

3 files changed

+541
-1
lines changed

3 files changed

+541
-1
lines changed

src/qmlcompiler/qqmljsimporter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ QQmlJSImporter::AvailableTypes QQmlJSImporter::builtinImportHelper()
530530
QStringLiteral("jsroot.qmltypes") };
531531
const auto importBuiltins = [&](const QStringList &imports) {
532532
for (auto const &dir : imports) {
533-
QDirIterator it { dir, qmltypesFiles, QDir::NoFilter, QDirIterator::Subdirectories };
533+
QDirIterator it { dir, qmltypesFiles, QDir::NoFilter };
534534
while (it.hasNext() && !qmltypesFiles.isEmpty()) {
535535
readQmltypes(it.next(), &result.objects, &result.dependencies);
536536
qmltypesFiles.removeOne(it.fileName());

src/qmlcompiler/qqmljstyperesolver.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,32 +25,59 @@ QQmlJSTypeResolver::QQmlJSTypeResolver(QQmlJSImporter *importer)
2525
{
2626
const QQmlJSImporter::ImportedTypes &builtinTypes = m_imports;
2727
m_voidType = builtinTypes.type(u"void"_s).scope;
28+
Q_ASSERT(m_voidType);
2829
m_nullType = builtinTypes.type(u"std::nullptr_t"_s).scope;
30+
Q_ASSERT(m_nullType);
2931
m_realType = builtinTypes.type(u"double"_s).scope;
32+
Q_ASSERT(m_realType);
3033
m_floatType = builtinTypes.type(u"float"_s).scope;
34+
Q_ASSERT(m_floatType);
3135
m_int8Type = builtinTypes.type(u"qint8"_s).scope;
36+
Q_ASSERT(m_int8Type);
3237
m_uint8Type = builtinTypes.type(u"quint8"_s).scope;
38+
Q_ASSERT(m_uint8Type);
3339
m_int16Type = builtinTypes.type(u"short"_s).scope;
40+
Q_ASSERT(m_int16Type);
3441
m_uint16Type = builtinTypes.type(u"ushort"_s).scope;
42+
Q_ASSERT(m_uint16Type);
3543
m_int32Type = builtinTypes.type(u"int"_s).scope;
44+
Q_ASSERT(m_int32Type);
3645
m_uint32Type = builtinTypes.type(u"uint"_s).scope;
46+
Q_ASSERT(m_uint32Type);
3747
m_int64Type = builtinTypes.type(u"qlonglong"_s).scope;
48+
Q_ASSERT(m_int64Type);
3849
m_uint64Type = builtinTypes.type(u"qulonglong"_s).scope;
50+
Q_ASSERT(m_uint64Type);
3951
m_boolType = builtinTypes.type(u"bool"_s).scope;
52+
Q_ASSERT(m_boolType);
4053
m_stringType = builtinTypes.type(u"QString"_s).scope;
54+
Q_ASSERT(m_stringType);
4155
m_stringListType = builtinTypes.type(u"QStringList"_s).scope;
56+
Q_ASSERT(m_stringListType);
4257
m_byteArrayType = builtinTypes.type(u"QByteArray"_s).scope;
58+
Q_ASSERT(m_byteArrayType);
4359
m_urlType = builtinTypes.type(u"QUrl"_s).scope;
60+
Q_ASSERT(m_urlType);
4461
m_dateTimeType = builtinTypes.type(u"QDateTime"_s).scope;
62+
Q_ASSERT(m_dateTimeType);
4563
m_dateType = builtinTypes.type(u"QDate"_s).scope;
64+
Q_ASSERT(m_dateType);
4665
m_timeType = builtinTypes.type(u"QTime"_s).scope;
66+
Q_ASSERT(m_timeType);
4767
m_variantListType = builtinTypes.type(u"QVariantList"_s).scope;
68+
Q_ASSERT(m_variantListType);
4869
m_variantMapType = builtinTypes.type(u"QVariantMap"_s).scope;
70+
Q_ASSERT(m_variantMapType);
4971
m_varType = builtinTypes.type(u"QVariant"_s).scope;
72+
Q_ASSERT(m_varType);
5073
m_jsValueType = builtinTypes.type(u"QJSValue"_s).scope;
74+
Q_ASSERT(m_jsValueType);
5175
m_listPropertyType = builtinTypes.type(u"QQmlListProperty<QObject>"_s).scope;
76+
Q_ASSERT(m_listPropertyType);
5277
m_qObjectType = builtinTypes.type(u"QObject"_s).scope;
78+
Q_ASSERT(m_qObjectType);
5379
m_qObjectListType = builtinTypes.type(u"QObjectList"_s).scope;
80+
Q_ASSERT(m_qObjectListType);
5481

5582
QQmlJSScope::Ptr emptyType = QQmlJSScope::create();
5683
emptyType->setAccessSemantics(QQmlJSScope::AccessSemantics::None);

0 commit comments

Comments
 (0)