aboutsummaryrefslogtreecommitdiffstats
path: root/tools/qmllint
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2020-09-29 17:02:37 +0200
committerUlf Hermann <ulf.hermann@qt.io>2020-10-02 15:32:36 +0200
commitd9e98c7f6b6c3331a486cabfe6cd0c07f7bfffe9 (patch)
tree03d2746e406f96f65bf284b8275a6f0e35a85947 /tools/qmllint
parentccd348d4b7423a23b2326c2f42c74719083248ba (diff)
qmllint: Remove exportedQmlNames from import results
We don't need to expose them anymore. Change-Id: Ibb25f688459972f718f9a051fbb7265c7e5b5f92 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tools/qmllint')
-rw-r--r--tools/qmllint/checkidentifiers.cpp20
-rw-r--r--tools/qmllint/findwarnings.cpp22
2 files changed, 21 insertions, 21 deletions
diff --git a/tools/qmllint/checkidentifiers.cpp b/tools/qmllint/checkidentifiers.cpp
index 9a6495310d..eaf6f0e876 100644
--- a/tools/qmllint/checkidentifiers.cpp
+++ b/tools/qmllint/checkidentifiers.cpp
@@ -99,7 +99,7 @@ static bool walkViaParentAndAttachedScopes(ScopeTree::ConstPtr rootType,
return true;
if (type->isComposite()) {
- if (auto superType = allTypes.importedQmlNames.value(type->baseTypeName()))
+ if (auto superType = allTypes.qmlNames.value(type->baseTypeName()))
stack.push(superType);
} else {
if (auto superType = allTypes.cppNames.value(type->baseTypeName()))
@@ -204,7 +204,7 @@ bool CheckIdentifiers::checkMemberAccess(const QVector<ScopeTree::FieldMember> &
if (access.m_parentType.isEmpty() && scope->isComposite())
findNextScope(m_types.cppNames);
else
- findNextScope(m_types.importedQmlNames);
+ findNextScope(m_types.qmlNames);
continue;
}
@@ -240,7 +240,7 @@ bool CheckIdentifiers::checkMemberAccess(const QVector<ScopeTree::FieldMember> &
ScopeTree::ConstPtr rootType;
if (!access.m_parentType.isEmpty())
- rootType = m_types.importedQmlNames.value(access.m_parentType);
+ rootType = m_types.qmlNames.value(access.m_parentType);
else
rootType = scope;
@@ -253,7 +253,7 @@ bool CheckIdentifiers::checkMemberAccess(const QVector<ScopeTree::FieldMember> &
if (propType)
scope = propType;
else if (scope->isComposite())
- scope = m_types.importedQmlNames.value(typeIt->typeName());
+ scope = m_types.qmlNames.value(typeIt->typeName());
else
scope = m_types.cppNames.value(typeIt->typeName());
return true;
@@ -274,8 +274,8 @@ bool CheckIdentifiers::checkMemberAccess(const QVector<ScopeTree::FieldMember> &
if (access.m_name.front().isUpper() && scope->scopeType() == ScopeType::QMLScope) {
// may be an attached type
- const auto it = m_types.importedQmlNames.find(access.m_name);
- if (it != m_types.importedQmlNames.end() && !(*it)->attachedTypeName().isEmpty()) {
+ const auto it = m_types.qmlNames.find(access.m_name);
+ if (it != m_types.qmlNames.end() && !(*it)->attachedTypeName().isEmpty()) {
const auto attached = m_types.cppNames.find((*it)->attachedTypeName());
if (attached != m_types.cppNames.end()) {
scope = *attached;
@@ -341,8 +341,8 @@ bool CheckIdentifiers::operator()(const QHash<QString, ScopeTree::ConstPtr> &qml
if (scopedName.front().isUpper()) {
const QString qualified = memberAccessBase.m_name + QLatin1Char('.')
+ scopedName;
- const auto typeIt = m_types.importedQmlNames.find(qualified);
- if (typeIt != m_types.importedQmlNames.end()) {
+ const auto typeIt = m_types.qmlNames.find(qualified);
+ if (typeIt != m_types.qmlNames.end()) {
memberAccessChain.takeFirst();
if (!checkMemberAccess(memberAccessChain, *typeIt))
noUnqualifiedIdentifier = false;
@@ -385,8 +385,8 @@ bool CheckIdentifiers::operator()(const QHash<QString, ScopeTree::ConstPtr> &qml
if (memberAccessBase.m_name == QLatin1String("Qt"))
continue;
- const auto typeIt = m_types.importedQmlNames.find(memberAccessBase.m_name);
- if (typeIt != m_types.importedQmlNames.end()) {
+ const auto typeIt = m_types.qmlNames.find(memberAccessBase.m_name);
+ if (typeIt != m_types.qmlNames.end()) {
if (!checkMemberAccess(memberAccessChain, *typeIt))
noUnqualifiedIdentifier = false;
continue;
diff --git a/tools/qmllint/findwarnings.cpp b/tools/qmllint/findwarnings.cpp
index 742c1a8d35..74c70ce731 100644
--- a/tools/qmllint/findwarnings.cpp
+++ b/tools/qmllint/findwarnings.cpp
@@ -117,16 +117,16 @@ bool FindWarningVisitor::visit(QQmlJS::AST::UiProgram *)
if (!m_qmltypesFiles.isEmpty()) {
const auto baseTypes = m_importer.importQmltypes(m_qmltypesFiles);
- m_rootScopeImports.importedQmlNames.insert(baseTypes.importedQmlNames);
+ m_rootScopeImports.qmlNames.insert(baseTypes.qmlNames);
m_rootScopeImports.cppNames.insert(baseTypes.cppNames);
}
// add "self" (as we only ever check the first part of a qualified identifier, we get away with
// using an empty ScopeTree
- m_rootScopeImports.importedQmlNames.insert(QFileInfo { m_filePath }.baseName(), {});
+ m_rootScopeImports.qmlNames.insert(QFileInfo { m_filePath }.baseName(), {});
const auto imported = m_importer.importFileOrDirectory(QFileInfo(m_filePath).path());
- m_rootScopeImports.importedQmlNames.insert(imported.importedQmlNames);
+ m_rootScopeImports.qmlNames.insert(imported.qmlNames);
m_rootScopeImports.cppNames.insert(imported.cppNames);
const QStringList warnings = m_importer.takeWarnings();
@@ -330,7 +330,7 @@ bool FindWarningVisitor::visit(QQmlJS::AST::UiPublicMember *uipm)
uipm->memberType ? uipm->memberType->name.toString() : QString(),
uipm->typeModifier == QLatin1String("list"), !uipm->isReadonlyMember, false,
uipm->memberType ? (uipm->memberType->name == QLatin1String("alias")) : false, 0);
- property.setType(m_rootScopeImports.importedQmlNames.value(property.typeName()));
+ property.setType(m_rootScopeImports.qmlNames.value(property.typeName()));
m_currentScope->insertPropertyIdentifier(property);
}
return true;
@@ -480,7 +480,7 @@ bool FindWarningVisitor::visit(QQmlJS::AST::UiImport *import)
const auto imported = m_importer.importFileOrDirectory(
file.isRelative() ? QFileInfo(m_filePath).dir().filePath(filename) : filename,
prefix);
- m_rootScopeImports.importedQmlNames.insert(imported.importedQmlNames);
+ m_rootScopeImports.qmlNames.insert(imported.qmlNames);
m_rootScopeImports.cppNames.insert(imported.cppNames);
}
@@ -488,7 +488,7 @@ bool FindWarningVisitor::visit(QQmlJS::AST::UiImport *import)
if (!import->importId.isEmpty()) {
// TODO: do not put imported ids into the same space as qml IDs
const QString importId = import->importId.toString();
- m_qmlid2scope.insert(importId, m_rootScopeImports.importedQmlNames.value(importId));
+ m_qmlid2scope.insert(importId, m_rootScopeImports.qmlNames.value(importId));
}
auto uri = import->importUri;
while (uri) {
@@ -501,7 +501,7 @@ bool FindWarningVisitor::visit(QQmlJS::AST::UiImport *import)
const auto imported = m_importer.importModule(
path, prefix, import->version ? import->version->version : QTypeRevision());
- m_rootScopeImports.importedQmlNames.insert(imported.importedQmlNames);
+ m_rootScopeImports.qmlNames.insert(imported.qmlNames);
m_rootScopeImports.cppNames.insert(imported.cppNames);
const QStringList warnings = m_importer.takeWarnings();
@@ -534,11 +534,11 @@ bool FindWarningVisitor::visit(QQmlJS::AST::UiObjectBinding *uiob)
MetaProperty prop(uiob->qualifiedId->name.toString(), name, false, true, true,
name == QLatin1String("alias"), 0);
- prop.setType(m_rootScopeImports.importedQmlNames.value(uiob->qualifiedTypeNameId->name.toString()));
+ prop.setType(m_rootScopeImports.qmlNames.value(uiob->qualifiedTypeNameId->name.toString()));
m_currentScope->addProperty(prop);
enterEnvironment(ScopeType::QMLScope, name);
- m_currentScope->resolveTypes(m_rootScopeImports.importedQmlNames);
+ m_currentScope->resolveTypes(m_rootScopeImports.qmlNames);
importExportedNames(m_currentScope);
return true;
}
@@ -569,7 +569,7 @@ bool FindWarningVisitor::visit(QQmlJS::AST::UiObjectDefinition *uiod)
if (name.isLower())
return false; // Ignore grouped properties for now
- m_currentScope->resolveTypes(m_rootScopeImports.importedQmlNames);
+ m_currentScope->resolveTypes(m_rootScopeImports.qmlNames);
importExportedNames(m_currentScope);
if (name.endsWith("Connections")) {
@@ -599,7 +599,7 @@ bool FindWarningVisitor::visit(QQmlJS::AST::UiObjectDefinition *uiod)
do {
scope = scope->parentScope(); // TODO: rename method
} while (scope->scopeType() != ScopeType::QMLScope);
- targetScope = m_rootScopeImports.importedQmlNames.value(scope->baseTypeName());
+ targetScope = m_rootScopeImports.qmlNames.value(scope->baseTypeName());
} else {
// there was a target, check if we already can find it
auto scopeIt = m_qmlid2scope.find(target);