aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmlcompiler/qqmljsscope_p.h
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2021-05-14 16:11:14 +0200
committerUlf Hermann <ulf.hermann@qt.io>2021-05-19 11:46:37 +0200
commit4b46972be3c34c1b5506ba7d8c97f4520e2c17d6 (patch)
tree49fdcfb5561a1e892bc602e420e295764cb0cd9b /src/qmlcompiler/qqmljsscope_p.h
parentd6c98f192922b3ceab5eb65e651a7f0588b482e9 (diff)
Add a ParentProperty classinfo and use that to find parents
This is more robust than just going by the "parent" name. Task-number: QTBUG-93662 Change-Id: If099733de6ad0f3bb7cb75b8915789f66b554f85 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qmlcompiler/qqmljsscope_p.h')
-rw-r--r--src/qmlcompiler/qqmljsscope_p.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/qmlcompiler/qqmljsscope_p.h b/src/qmlcompiler/qqmljsscope_p.h
index f61cd7b2eb..fade4d84be 100644
--- a/src/qmlcompiler/qqmljsscope_p.h
+++ b/src/qmlcompiler/qqmljsscope_p.h
@@ -254,6 +254,9 @@ public:
QString defaultPropertyName() const { return m_defaultPropertyName; }
void setDefaultPropertyName(const QString &name) { m_defaultPropertyName = name; }
+ QString parentPropertyName() const { return m_parentPropertyName; }
+ void setParentPropertyName(const QString &name) { m_parentPropertyName = name; }
+
QString ownAttachedTypeName() const { return m_attachedTypeName; }
void setOwnAttachedTypeName(const QString &name) { m_attachedTypeName = name; }
QQmlJSScope::ConstPtr ownAttachedType() const { return m_attachedType; }
@@ -347,6 +350,15 @@ public:
&& this->internalName() == otherScope->internalName());
}
+ bool inherits(const QQmlJSScope::ConstPtr &base) const
+ {
+ for (const QQmlJSScope *scope = this; scope; scope = scope->baseType().get()) {
+ if (scope->isSameType(base))
+ return true;
+ }
+ return false;
+ }
+
/*!
\internal
Checks whether \a derived type can be assigned to this type. Returns \c
@@ -388,6 +400,7 @@ private:
QStringList m_interfaceNames;
QString m_defaultPropertyName;
+ QString m_parentPropertyName;
QString m_attachedTypeName;
QStringList m_requiredPropertyNames;
QQmlJSScope::WeakConstPtr m_attachedType;