aboutsummaryrefslogtreecommitdiffstats
path: root/tools/qmllint/findunqualified.cpp
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2019-07-23 16:10:24 +0200
committerFabian Kosmale <fabian.kosmale@qt.io>2019-07-26 09:00:07 +0200
commit66368ffdd93e63a182aa6961f821ca14290ecf80 (patch)
tree55be6dd8472d9b3afa3301a52e1e4c6fd0b1198f /tools/qmllint/findunqualified.cpp
parent53e7927fdf56617cfcd3b0e6c9f6db6e0b3d6483 (diff)
qmllint: Improve parent handling
- Do not warn about parent access in unknown components This avoids false positive warnings when an imported component could not be found (or when it actually was not imported). We still warn about the component which could not be found, so the user is still informed that something is not right. We also still emit a warning when we know the properties of a component, and parent is not one of them. - Do not recommend the use of parent to address the root components properties. For this to work, we would need to know whether the root component reparents its children or not. Moreover, id lookups are actually faster than parent lookups. Change-Id: I83d0e71e4bf20d34a3e6d836c2b123b2bf0d416e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tools/qmllint/findunqualified.cpp')
-rw-r--r--tools/qmllint/findunqualified.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/qmllint/findunqualified.cpp b/tools/qmllint/findunqualified.cpp
index e6a72df44c..69e1473975 100644
--- a/tools/qmllint/findunqualified.cpp
+++ b/tools/qmllint/findunqualified.cpp
@@ -325,7 +325,9 @@ void FindUnqualifiedIDVisitor::importExportedNames(QStringRef prefix, QString na
break;
}
} else {
- qDebug() << name << "not found";
+ m_colorOut.write(QLatin1String("warning: "), Warning);
+ m_colorOut.write(name + QLatin1String(" was not found. Did you add all import paths?\n"));
+ m_unknownImports.insert(name);
break;
}
}
@@ -526,7 +528,7 @@ bool FindUnqualifiedIDVisitor::visit(QQmlJS::AST::IdentifierExpression *idexp)
auto name = idexp->name;
if (!m_exportedName2MetaObject.contains(name.toString())) {
m_currentScope->addIdToAccssedIfNotInParentScopes(
- { name.toString(), idexp->firstSourceLocation() });
+ { name.toString(), idexp->firstSourceLocation() }, m_unknownImports);
}
return true;
}