aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2021-03-01 10:06:41 +0100
committerUlf Hermann <ulf.hermann@qt.io>2021-03-01 19:57:02 +0100
commitb0fa92ddb6c7c2162571452beec680e0bdfc687c (patch)
tree44986f6725e18d658f19ea7a594301af1a286940
parent75fc3d1cd4347ae6226a2baa99b861de65b62a5e (diff)
QQmlImport: Don't cache localDirectoryPath
It's only used in one place. We can just calculate it there. Change-Id: If9d1c7e6a6fc012eeba8fff9ce24d3c4b149c914 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
-rw-r--r--src/qml/qml/qqmlimport.cpp9
-rw-r--r--src/qml/qml/qqmlimport_p.h1
2 files changed, 6 insertions, 4 deletions
diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp
index 6540c1f301..1ac2057b98 100644
--- a/src/qml/qml/qqmlimport.cpp
+++ b/src/qml/qml/qqmlimport.cpp
@@ -657,7 +657,6 @@ bool QQmlImportInstance::setQmldirContent(const QString &resolvedUrl,
{
Q_ASSERT(resolvedUrl.endsWith(Slash));
url = resolvedUrl;
- localDirectoryPath = QQmlFile::urlToLocalFileOrQrc(url);
qmlDirComponents = qmldir.components();
@@ -834,7 +833,12 @@ bool QQmlImportInstance::resolveType(QQmlTypeLoader *typeLoader, const QHashedSt
*type_return = returnType;
return returnType.isValid();
}
- } else if (!isLibrary && !localDirectoryPath.isEmpty()) {
+ } else if (!isLibrary) {
+ // the base path of the import if it's a local file
+ const QString localDirectoryPath = QQmlFile::urlToLocalFileOrQrc(url);
+ if (localDirectoryPath.isEmpty())
+ return false;
+
QString qmlUrl;
bool exists = false;
@@ -1570,7 +1574,6 @@ QQmlImportInstance *QQmlImportsPrivate::addImportToNamespace(
QQmlImportInstance *import = new QQmlImportInstance;
import->uri = uri;
import->url = url;
- import->localDirectoryPath = QQmlFile::urlToLocalFileOrQrc(url);
import->version = version;
import->isLibrary = (type == QV4::CompiledData::Import::ImportLibrary);
if (flags & QQmlImports::ImportImplicit) {
diff --git a/src/qml/qml/qqmlimport_p.h b/src/qml/qml/qqmlimport_p.h
index 2697832067..7a8e1f9dd4 100644
--- a/src/qml/qml/qqmlimport_p.h
+++ b/src/qml/qml/qqmlimport_p.h
@@ -79,7 +79,6 @@ struct QQmlImportInstance
{
QString uri; // e.g. QtQuick
QString url; // the base path of the import
- QString localDirectoryPath; // the base path of the import if it's a local file
QQmlType containingType; // points to the containing type for inline components
QTypeRevision version; // the version imported
bool isLibrary; // true means that this is not a file import