From a45e31a42de7a6523588aba691f574644021a7a9 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Tue, 20 Oct 2020 11:31:40 +0200 Subject: QmlCompiler: Cache builtin types If we import the builtin types multiple times from different places, we want them to match. Change-Id: I3f2f0ec0d72fb4e178ee69517ecafa8260ebc35e Reviewed-by: Fabian Kosmale --- src/qmlcompiler/qqmljsimporter.cpp | 6 +++++- src/qmlcompiler/qqmljsimporter_p.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/qmlcompiler/qqmljsimporter.cpp b/src/qmlcompiler/qqmljsimporter.cpp index 96df18937e..c6640316fa 100644 --- a/src/qmlcompiler/qqmljsimporter.cpp +++ b/src/qmlcompiler/qqmljsimporter.cpp @@ -234,6 +234,9 @@ void QQmlJSImporter::processImport( */ QQmlJSImporter::ImportedTypes QQmlJSImporter::importBuiltins() { + if (!m_builtins.isEmpty()) + return m_builtins; + AvailableTypes types; for (auto const &dir : m_importPaths) { @@ -246,7 +249,8 @@ QQmlJSImporter::ImportedTypes QQmlJSImporter::importBuiltins() processImport(result, &types); } - return types.qmlNames; + m_builtins = types.qmlNames; + return m_builtins; } /*! diff --git a/src/qmlcompiler/qqmljsimporter_p.h b/src/qmlcompiler/qqmljsimporter_p.h index 3356997fd3..5ff2631b0a 100644 --- a/src/qmlcompiler/qqmljsimporter_p.h +++ b/src/qmlcompiler/qqmljsimporter_p.h @@ -105,6 +105,7 @@ private: QHash, Import> m_seenImports; QHash m_importedFiles; QList m_warnings; + ImportedTypes m_builtins; }; QT_END_NAMESPACE -- cgit v1.2.3