diff options
author | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2016-06-07 20:02:51 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2016-06-14 08:00:34 +0000 |
commit | 5046012e07a5eba917893c8b77015ff8f54500b7 (patch) | |
tree | 70b79bd67eecabcbe432d1bdca7184bb33cad197 /src/qml/qml/qqmltypeloader.cpp | |
parent | e0423305637bdb2236c3ee59ff0c7cf09992a655 (diff) |
Cleanup: generalize type reference collection code
For loading compilation units from disk we'll have to scan the unit for type
references, in order to correctly load dependencies. In preparation for that
this patch template'izes the loops so that they can work on the Qml IR as well
as on the CompiledData::Object structures.
Change-Id: I32e4e3277e16c5a2d1bf6baf24456c9837c189ff
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/qml/qqmltypeloader.cpp')
-rw-r--r-- | src/qml/qml/qqmltypeloader.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp index 3cbbaf4129..847e138c5a 100644 --- a/src/qml/qml/qqmltypeloader.cpp +++ b/src/qml/qml/qqmltypeloader.cpp @@ -2133,6 +2133,7 @@ void QQmlTypeData::done() compile(); m_document.reset(); + m_typeReferences.clear(); m_implicitImport = 0; } @@ -2200,7 +2201,7 @@ void QQmlTypeData::initializeFromCachedUnit(const QQmlPrivate::CachedQmlUnit *un void QQmlTypeData::continueLoadFromIR() { - m_document->collectTypeReferences(); + m_typeReferences.collectFromObjects(m_document->objects.constBegin(), m_document->objects.constEnd()); m_importCache.setBaseUrl(finalUrl(), finalUrlString()); // For remote URLs, we don't delay the loading of the implicit import @@ -2357,7 +2358,7 @@ void QQmlTypeData::resolveTypes() } } - for (QV4::CompiledData::TypeReferenceMap::ConstIterator unresolvedRef = m_document->typeReferences.constBegin(), end = m_document->typeReferences.constEnd(); + for (QV4::CompiledData::TypeReferenceMap::ConstIterator unresolvedRef = m_typeReferences.constBegin(), end = m_typeReferences.constEnd(); unresolvedRef != end; ++unresolvedRef) { TypeReference ref; // resolved reference |