aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2023-08-03 17:01:39 +0200
committerFabian Kosmale <fabian.kosmale@qt.io>2023-08-07 20:44:01 +0200
commit9bc8445766b0a4f8f3126f0a725d58426c2b2d39 (patch)
treed07f6a15e3a8a23371c2f05fb0de63242da9c3b5
parent2d0f45552e785c0ed504f2633da48281e8a52349 (diff)
QQmlJSScope: purge qualifiedname
It is only used by a test (which doesn't test any other functionality besides that we get the correct qualified name). QQmlJSImporter::setQualifiedNamesOn keeps its current name, but probably should be renamed. Change-Id: Ie36c342943b545be0de7bba53a2fbd6c6f0adc0d Reviewed-by: Semih Yavuz <semih.yavuz@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
-rw-r--r--src/qmlcompiler/qqmljsimporter.cpp6
-rw-r--r--src/qmlcompiler/qqmljsscope.cpp20
-rw-r--r--src/qmlcompiler/qqmljsscope_p.h8
-rw-r--r--tests/auto/qml/qqmljsscope/tst_qqmljsscope.cpp25
4 files changed, 0 insertions, 59 deletions
diff --git a/src/qmlcompiler/qqmljsimporter.cpp b/src/qmlcompiler/qqmljsimporter.cpp
index 5766bec6bb..23538a3365 100644
--- a/src/qmlcompiler/qqmljsimporter.cpp
+++ b/src/qmlcompiler/qqmljsimporter.cpp
@@ -867,15 +867,9 @@ void QQmlJSImporter::setQualifiedNamesOn(const Import &import)
for (auto &object : import.objects) {
if (object.exports.isEmpty())
continue;
- const QString qualifiedName = QQmlJSScope::qualifiedNameFrom(
- import.name, object.exports.first().type(),
- object.exports.first().revision(),
- object.exports.last().revision());
if (auto *factory = object.scope.factory()) {
- factory->setQualifiedName(qualifiedName);
factory->setModuleName(import.name);
} else {
- object.scope->setQualifiedName(qualifiedName);
object.scope->setModuleName(import.name);
}
}
diff --git a/src/qmlcompiler/qqmljsscope.cpp b/src/qmlcompiler/qqmljsscope.cpp
index 3d370f07d7..2fb165ac61 100644
--- a/src/qmlcompiler/qqmljsscope.cpp
+++ b/src/qmlcompiler/qqmljsscope.cpp
@@ -29,9 +29,6 @@ QT_BEGIN_NAMESPACE
Multiple QQmlJSScope objects might be created for the same conceptual type, except when reused
due to extensive caching. Two QQmlJSScope objects are considered equal when they are backed
by the same implementation, that is, they have the same internalName.
- The qualifiedName of the QQmlJSScope for a type imported from multiple modules will contain the
- name of one of the modules that imported it, which is not unique and might change depending
- on the caching in .
*/
using namespace Qt::StringLiterals;
@@ -983,22 +980,6 @@ bool QQmlJSScope::isNameDeferred(const QString &name) const
return isDeferred;
}
-QString QQmlJSScope::qualifiedNameFrom(const QString &moduleName, const QString &typeName,
- const QTypeRevision &firstRevision,
- const QTypeRevision &lastRevision)
-{
- QString qualifiedName =
- u"%1/%2 %3.%4"_s.arg(moduleName, typeName)
- .arg(firstRevision.hasMajorVersion() ? firstRevision.majorVersion() : 0)
- .arg(firstRevision.hasMinorVersion() ? firstRevision.minorVersion() : 0);
- if (firstRevision != lastRevision) {
- qualifiedName += u"-%1.%2"_s
- .arg(lastRevision.hasMajorVersion() ? lastRevision.majorVersion() : 0)
- .arg(lastRevision.hasMinorVersion() ? lastRevision.minorVersion() : 0);
- }
- return qualifiedName;
-}
-
void QQmlJSScope::setBaseTypeName(const QString &baseTypeName)
{
m_flags.setFlag(HasBaseTypeError, false);
@@ -1131,7 +1112,6 @@ bool QQmlJSScope::Export::isValid() const
void QDeferredFactory<QQmlJSScope>::populate(const QSharedPointer<QQmlJSScope> &scope) const
{
- scope->setQualifiedName(m_qualifiedName);
scope->setModuleName(m_moduleName);
QQmlJSTypeReader typeReader(m_importer, m_filePath);
typeReader(scope);
diff --git a/src/qmlcompiler/qqmljsscope_p.h b/src/qmlcompiler/qqmljsscope_p.h
index d45d73b0db..1be8ee0c24 100644
--- a/src/qmlcompiler/qqmljsscope_p.h
+++ b/src/qmlcompiler/qqmljsscope_p.h
@@ -274,11 +274,6 @@ public:
QQmlJSScope::ConstPtr baseType() const { return m_baseType.scope; }
QTypeRevision baseTypeRevision() const { return m_baseType.revision; }
- QString qualifiedName() const { return m_qualifiedName; }
- void setQualifiedName(const QString &qualifiedName) { m_qualifiedName = qualifiedName; };
- static QString qualifiedNameFrom(const QString &moduleName, const QString &typeName,
- const QTypeRevision &firstRevision,
- const QTypeRevision &lastRevision);
QString moduleName() const { return m_moduleName; }
void setModuleName(const QString &moduleName) { m_moduleName = moduleName; }
@@ -544,7 +539,6 @@ private:
QQmlJS::SourceLocation m_sourceLocation;
- QString m_qualifiedName;
QString m_moduleName;
std::optional<QString> m_inlineComponentName;
@@ -650,7 +644,6 @@ public:
m_isSingleton = isSingleton;
}
- void setQualifiedName(const QString &qualifiedName) { m_qualifiedName = qualifiedName; }
void setModuleName(const QString &moduleName) { m_moduleName = moduleName; }
private:
@@ -665,7 +658,6 @@ private:
QString m_filePath;
QQmlJSImporter *m_importer = nullptr;
bool m_isSingleton = false;
- QString m_qualifiedName;
QString m_moduleName;
};
diff --git a/tests/auto/qml/qqmljsscope/tst_qqmljsscope.cpp b/tests/auto/qml/qqmljsscope/tst_qqmljsscope.cpp
index 2a29dd4aa3..43c119b232 100644
--- a/tests/auto/qml/qqmljsscope/tst_qqmljsscope.cpp
+++ b/tests/auto/qml/qqmljsscope/tst_qqmljsscope.cpp
@@ -106,7 +106,6 @@ private Q_SLOTS:
void scriptIndices();
void extensions();
void emptyBlockBinding();
- void qualifiedName();
void resolvedNonUniqueScopes();
void compilationUnitsAreCompatible();
void attachedTypeResolution_data();
@@ -676,30 +675,6 @@ void tst_qqmljsscope::emptyBlockBinding()
QVERIFY(root->hasOwnPropertyBindings(u"y"_s));
}
-void tst_qqmljsscope::qualifiedName()
-{
- QQmlJSScope::ConstPtr root = run(u"qualifiedName.qml"_s);
- QVERIFY(root);
-
- auto qualifiedNameOf = [](const QQmlJSScope::ConstPtr &ptr) -> QString {
- if (ptr->baseType())
- return ptr->baseType()->qualifiedName();
- else
- return u""_s;
- };
-
- QCOMPARE(root->childScopes().size(), 4);
- QQmlJSScope::ConstPtr b = root->childScopes()[0];
- QQmlJSScope::ConstPtr d = root->childScopes()[1];
- QQmlJSScope::ConstPtr qualifiedA = root->childScopes()[2];
- QQmlJSScope::ConstPtr qualifiedB = root->childScopes()[3];
-
- QCOMPARE(qualifiedNameOf(b), "QualifiedNamesTests/B 5.0-6.0");
- QCOMPARE(qualifiedNameOf(d), "QualifiedNamesTests/D 6.0");
- QCOMPARE(qualifiedNameOf(qualifiedA), "QualifiedNamesTests/A 5.0");
- QCOMPARE(qualifiedNameOf(qualifiedB), "QualifiedNamesTests/B 5.0-6.0");
-}
-
void tst_qqmljsscope::resolvedNonUniqueScopes()
{
QQmlJSScope::ConstPtr root = run(u"resolvedNonUniqueScope.qml"_s);