aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/qmllint/findunqualified.cpp2
-rw-r--r--tools/qmllint/scopetree.cpp9
-rw-r--r--tools/qmllint/scopetree.h1
3 files changed, 12 insertions, 0 deletions
diff --git a/tools/qmllint/findunqualified.cpp b/tools/qmllint/findunqualified.cpp
index 359510f5f7..d0dc3a3711 100644
--- a/tools/qmllint/findunqualified.cpp
+++ b/tools/qmllint/findunqualified.cpp
@@ -888,7 +888,9 @@ bool FindUnqualifiedIDVisitor::visit(QQmlJS::AST::PatternElement *element)
void FindUnqualifiedIDVisitor::endVisit(QQmlJS::AST::UiObjectDefinition *)
{
+ auto childScope = m_currentScope;
leaveEnvironment();
+ childScope->updateParentProperty(m_currentScope);
}
bool FindUnqualifiedIDVisitor::visit(QQmlJS::AST::FieldMemberExpression *)
diff --git a/tools/qmllint/scopetree.cpp b/tools/qmllint/scopetree.cpp
index cac064eb27..e5b0eecc5f 100644
--- a/tools/qmllint/scopetree.cpp
+++ b/tools/qmllint/scopetree.cpp
@@ -448,6 +448,15 @@ void ScopeTree::setExportMetaObjectRevision(int exportIndex, int metaObjectRevis
m_exports[exportIndex].setMetaObjectRevision(metaObjectRevision);
}
+void ScopeTree::updateParentProperty(const ScopeTree *scope)
+{
+ auto it = m_properties.find(QLatin1String("parent"));
+ if (it != m_properties.end()
+ && scope->name() != QLatin1String("Component")
+ && scope->name() != QLatin1String("program"))
+ it->setType(scope);
+}
+
ScopeTree::Export::Export(QString package, QString type, const ComponentVersion &version,
int metaObjectRevision) :
m_package(std::move(package)),
diff --git a/tools/qmllint/scopetree.h b/tools/qmllint/scopetree.h
index 00cb466eb9..eb5f384477 100644
--- a/tools/qmllint/scopetree.h
+++ b/tools/qmllint/scopetree.h
@@ -153,6 +153,7 @@ public:
void addProperty(const MetaProperty &prop) { m_properties.insert(prop.propertyName(), prop); }
QHash<QString, MetaProperty> properties() const { return m_properties; }
+ void updateParentProperty(const ScopeTree *scope);
QString defaultPropertyName() const { return m_defaultPropertyName; }
void setDefaultPropertyName(const QString &name) { m_defaultPropertyName = name; }