aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmlcompiler/qqmljsimportvisitor.cpp
diff options
context:
space:
mode:
authorSami Shalayel <sami.shalayel@qt.io>2024-06-26 17:25:27 +0200
committerSami Shalayel <sami.shalayel@qt.io>2024-10-28 21:33:42 +0200
commit31fbe8a19d5ad1b376bba1f96a2b4dde65ba4bb7 (patch)
tree693bdaf06679e0c94b14d64e642c9da17f62f9c5 /src/qmlcompiler/qqmljsimportvisitor.cpp
parentb0f1ec4e394dcee82400964225be485a7cdd3c53 (diff)
QQmlJSScope: add isRootFileComponent flag
Add a flag to tell whether the QQmlJSScope is the root QML scope. This can be then used in user-written QQmlSA passes to apply special checks on root items, which is needed in the QDS warnings for .ui.qml file, for example. Task-number: QTBUG-129308 Change-Id: Ie67294b0ee2b813da3a80a0bd8002ebae618ee1c Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Diffstat (limited to 'src/qmlcompiler/qqmljsimportvisitor.cpp')
-rw-r--r--src/qmlcompiler/qqmljsimportvisitor.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/qmlcompiler/qqmljsimportvisitor.cpp b/src/qmlcompiler/qqmljsimportvisitor.cpp
index 5b732ef023..56f522bed6 100644
--- a/src/qmlcompiler/qqmljsimportvisitor.cpp
+++ b/src/qmlcompiler/qqmljsimportvisitor.cpp
@@ -186,6 +186,7 @@ void QQmlJSImportVisitor::enterRootScope(QQmlJSScope::ScopeType type, const QStr
{
QQmlJSScope::reparent(m_currentScope, m_exportedRootScope);
m_currentScope = m_exportedRootScope;
+ m_currentScope->setIsRootFileComponentFlag(true);
populateCurrentScope(type, name, location);
}
@@ -858,7 +859,8 @@ void QQmlJSImportVisitor::checkRequiredProperties()
}
for (const auto &defScope : m_objectDefinitionScopes) {
- if (defScope->parentScope() == m_globalScope || defScope->isInlineComponent() || defScope->isComponentRootElement())
+ if (defScope->isFileRootComponent() || defScope->isInlineComponent()
+ || defScope->isComponentRootElement())
continue;
QVector<QQmlJSScope::ConstPtr> scopesToSearch;