diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2020-11-12 16:30:03 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-11-12 16:47:46 +0100 |
commit | ccb9c17d29cb680dd01318f5e59e7edab26b73c6 (patch) | |
tree | d4c5b715c9ffd6e9a3bcededad31449404107e30 /src | |
parent | 9f98bfd81d4831b1e2c8ffa7802f51bfb99be4a2 (diff) |
QmlCompiler: Add method to get first non-composite base scope
That's a recurring thing.
Change-Id: I8dc049a559e337c70089dd1f81ff23bf7d2140fe
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/qmlcompiler/qqmljsscope_p.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/qmlcompiler/qqmljsscope_p.h b/src/qmlcompiler/qqmljsscope_p.h index 0513612e42..f1ead0ece2 100644 --- a/src/qmlcompiler/qqmljsscope_p.h +++ b/src/qmlcompiler/qqmljsscope_p.h @@ -244,6 +244,15 @@ public: return m_sourceLocation; } + static QQmlJSScope::ConstPtr nonCompositeBaseType(const QQmlJSScope::ConstPtr &type) + { + for (QQmlJSScope::ConstPtr base = type; base; base = base->baseType()) { + if (!base->isComposite()) + return base; + } + return {}; + } + private: QQmlJSScope(ScopeType type, const QQmlJSScope::Ptr &parentScope = QQmlJSScope::Ptr()); |