aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSami Shalayel <sami.shalayel@qt.io>2025-11-24 14:36:43 +0100
committerSami Shalayel <sami.shalayel@qt.io>2025-12-04 21:01:20 +0100
commita464f3d27ba7f6f27b9508516329026bbc828e8a (patch)
treeb3d38f1f09deb161b9cc2510c2360f7bc083159c /src
parenta52068b965f953f9158a23323ea4c9cdaf92b162 (diff)
qqmljsimporter::setImportPath: do nothing if import path are unchanged
Move a check from callers of setImportPath to setImportPath and do nothing if the import paths are unchanged. Task-number: QTBUG-141707 Change-Id: I3dfa6bc3927a12c323c85b340aa88ef1049f6a76 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/qmlcompiler/qqmljsimporter.cpp3
-rw-r--r--src/qmlcompiler/qqmljslinter.cpp7
2 files changed, 5 insertions, 5 deletions
diff --git a/src/qmlcompiler/qqmljsimporter.cpp b/src/qmlcompiler/qqmljsimporter.cpp
index 55c3967a92..1df7f67269 100644
--- a/src/qmlcompiler/qqmljsimporter.cpp
+++ b/src/qmlcompiler/qqmljsimporter.cpp
@@ -981,6 +981,9 @@ QQmlJSImporter::ImportedTypes QQmlJSImporter::importDirectory(
void QQmlJSImporter::setImportPaths(const QStringList &importPaths)
{
+ if (m_importPaths == importPaths)
+ return;
+
m_importPaths = importPaths;
// We have to get rid off all cache elements directly referencing modules, since changing
diff --git a/src/qmlcompiler/qqmljslinter.cpp b/src/qmlcompiler/qqmljslinter.cpp
index 6cc2cfa02b..b3c66dca2e 100644
--- a/src/qmlcompiler/qqmljslinter.cpp
+++ b/src/qmlcompiler/qqmljslinter.cpp
@@ -610,8 +610,7 @@ QQmlJSLinter::lintFile(const QString &filename, const QString *fileContents, con
if (isJavaScript)
return success;
- if (m_importer.importPaths() != qmlImportPaths)
- m_importer.setImportPaths(qmlImportPaths);
+ m_importer.setImportPaths(qmlImportPaths);
std::optional<QQmlJSResourceFileMapper> mapper;
if (!resourceFiles.isEmpty())
@@ -775,9 +774,7 @@ QQmlJSLinter::LintResult QQmlJSLinter::lintModule(
// We can't lint properly if a module has already been pre-cached
m_importer.clearCache();
-
- if (m_importer.importPaths() != qmlImportPaths)
- m_importer.setImportPaths(qmlImportPaths);
+ m_importer.setImportPaths(qmlImportPaths);
QQmlJSResourceFileMapper mapper(resourceFiles);
if (!resourceFiles.isEmpty())