diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2025-02-04 12:01:46 +0100 |
|---|---|---|
| committer | Ulf Hermann <ulf.hermann@qt.io> | 2025-02-21 16:20:38 +0100 |
| commit | a5cb71925c31593e9d71a3e4ac621d3120311199 (patch) | |
| tree | 2d72a59dce1750a9b65aaf4f8e7d08014788366f /tools | |
| parent | 8daf02d39c7d29461fed9d281c9dae0f2e34ae04 (diff) | |
QmlCompiler: Tighten detection of assignment to unknown properties
While those properties may be of type Component, they don't have to. We
can in fact not resolve anything resembling an ID while inside one of
those objects because we cannot determine the component boundaries.
Amends commit dea8e38d95508acd67da997d0c2a9c91ef1bc887
Pick-to: 6.9 6.8
Fixes: QTBUG-133460
Change-Id: Iac7294166d38ce591c45c0d31b139a52eda70fc1
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/qmltc/qmltccompilerpieces.h | 4 | ||||
| -rw-r--r-- | tools/qmltc/qmltcvisitor.cpp | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/tools/qmltc/qmltccompilerpieces.h b/tools/qmltc/qmltccompilerpieces.h index cd85b1e2f0..ef64938654 100644 --- a/tools/qmltc/qmltccompilerpieces.h +++ b/tools/qmltc/qmltccompilerpieces.h @@ -411,7 +411,7 @@ inline void QmltcCodeGenerator::generate_qmltcInstructionCallCode( function->body << u"// call children's methods"_s; for (qsizetype i = 1; i < types.size(); ++i) { const auto &type = types[i]; - Q_ASSERT(!type->isComponentRootElement()); + Q_ASSERT(type->componentRootStatus() == QQmlJSScope::IsComponentRoot::No); function->body << u"creator->get<%1>(%2)->%3(%4);"_s.arg( type->internalName(), QString::number(i), function->name, childInstructionArgs); } @@ -532,7 +532,7 @@ inline void QmltcCodeGenerator::generate_interfaceCallCode(QmltcMethod *function function->body << u"// call children's methods"_s; for (qsizetype i = 1; i < types.size(); ++i) { const auto &type = types[i]; - Q_ASSERT(!type->isComponentRootElement()); + Q_ASSERT(type->componentRootStatus() == QQmlJSScope::IsComponentRoot::No); function->body << u"{"_s; function->body << u"auto child = creator->get<%1>(%2);"_s.arg(type->internalName(), QString::number(i)); diff --git a/tools/qmltc/qmltcvisitor.cpp b/tools/qmltc/qmltcvisitor.cpp index f050e8a7ac..dee3426598 100644 --- a/tools/qmltc/qmltcvisitor.cpp +++ b/tools/qmltc/qmltcvisitor.cpp @@ -49,7 +49,7 @@ static bool isImplicitComponent(const QQmlJSScope::ConstPtr &type) return false; const auto cppBase = QQmlJSScope::nonCompositeBaseType(type); const bool isComponentBased = (cppBase && cppBase->internalName() == u"QQmlComponent"); - return type->isComponentRootElement() && !isComponentBased; + return type->componentRootStatus() != QQmlJSScope::IsComponentRoot::No && !isComponentBased; } /*! \internal @@ -573,7 +573,7 @@ void QmltcVisitor::postVisitResolve( const auto setRuntimeId = [&](const QQmlJSScope::ConstPtr &type) { // any type wrapped in an implicit component shouldn't be processed // here. even if it has id, it doesn't need to be set by qmltc - if (type->isComponentRootElement()) { + if (type->componentRootStatus() != QQmlJSScope::IsComponentRoot::No) { return true; } |
