aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorEvgeniy A. Dushistov <dushistov@mail.ru>2021-04-08 02:04:41 +0300
committerEvgeniy A. Dushistov <dushistov@mail.ru>2021-04-13 11:43:45 +0300
commit8ac9a3f80d7491674097227a8b228b9d894a2de3 (patch)
tree150909441213168c180b1322cd9d56cef375f52b /tools
parent9b4bb235cf94721662f0cb07d033d4a10489b5a4 (diff)
Check also property type names
At the moment, qmllint only check the types of objects and classes being imported, it totally ignored types of properties that should be also imported. Fixes: QTBUG-92449 Change-Id: Ia5173bed84640d93fc48f6239179604ceb5db2cd Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tools')
-rw-r--r--tools/qmllint/findwarnings.cpp17
-rw-r--r--tools/qmllint/findwarnings.h1
2 files changed, 18 insertions, 0 deletions
diff --git a/tools/qmllint/findwarnings.cpp b/tools/qmllint/findwarnings.cpp
index bf54122de3..3f0c992fd3 100644
--- a/tools/qmllint/findwarnings.cpp
+++ b/tools/qmllint/findwarnings.cpp
@@ -645,3 +645,20 @@ void FindWarningVisitor::endVisit(QQmlJS::AST::BinaryExpression *binExp)
else
m_fieldMemberBase = nullptr;
}
+
+bool FindWarningVisitor::visit(QQmlJS::AST::UiPublicMember *uipb)
+{
+ QQmlJSImportVisitor::visit(uipb);
+ if (uipb->type == QQmlJS::AST::UiPublicMember::Property && uipb->memberType != nullptr
+ && !uipb->memberType->name.isEmpty() && uipb->memberType->name != QLatin1String("alias")) {
+ const auto name = uipb->memberType->name.toString();
+ if (m_importTypeLocationMap.contains(name)) {
+ m_usedTypes.insert(name);
+ } else {
+ m_logger.log(name + QStringLiteral(" was not found. Did you add all import paths?\n"),
+ Log_Import);
+ }
+ }
+
+ return true;
+}
diff --git a/tools/qmllint/findwarnings.h b/tools/qmllint/findwarnings.h
index d5363a177b..5e870155ca 100644
--- a/tools/qmllint/findwarnings.h
+++ b/tools/qmllint/findwarnings.h
@@ -111,6 +111,7 @@ private:
bool visit(QQmlJS::AST::UiObjectDefinition *uiod) override;
void endVisit(QQmlJS::AST::UiObjectDefinition *) override;
bool visit(QQmlJS::AST::UiScriptBinding *uisb) override;
+ bool visit(QQmlJS::AST::UiPublicMember *uipb) override;
// expression handling
bool visit(QQmlJS::AST::IdentifierExpression *idexp) override;