aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrei Golubev <andrei.golubev@qt.io>2022-02-10 16:23:26 +0100
committerAndrei Golubev <andrei.golubev@qt.io>2022-02-22 09:20:12 +0100
commitc07a77c96eb2ff3ce3317da8336d9a6891b50e98 (patch)
tree0365e14bfc2e9645cb11d1e60f4aa7f37dcc6184
parent54c4f18fda4c0cc1bac2cb45e64b78f436db3cd6 (diff)
qmltc: Fix attached property code generation
Attached property code generation is borked so fix accordingly: the compiler used an attached type where an attaching type should've been used. Given the obvious naming ambiguity, this was likely a typo of sorts Partial cherry-pick of a099030009eb8a9262b5e9e7565fe48bc866309b as the unskipped tests still would not work. They need 687609f2f3a98ade4b8e074615c3d1db1228fce0 in 6.3 (and maybe more) Change-Id: I1e4fd4d916ad3bd1bacf2aee1ce2346f9283c70d Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit a099030009eb8a9262b5e9e7565fe48bc866309b) Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
-rw-r--r--tools/qmltc/prototype/codegenerator.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/qmltc/prototype/codegenerator.cpp b/tools/qmltc/prototype/codegenerator.cpp
index dab45a22b8..f7c13657a7 100644
--- a/tools/qmltc/prototype/codegenerator.cpp
+++ b/tools/qmltc/prototype/codegenerator.cpp
@@ -1389,6 +1389,9 @@ void CodeGenerator::compileBinding(QQmlJSAotObject &current, const QmlIR::Bindin
std::for_each(irObject->bindingsBegin(), irObject->bindingsEnd(), compileComponent);
} else {
const QString attachingTypeName = propertyName; // acts as an identifier
+ auto attachingType = m_localTypeResolver->typeForName(attachingTypeName);
+ Q_ASSERT(attachingType); // an error somewhere else
+
QString attachedTypeName = type->attachedTypeName(); // TODO: check if == internalName?
if (attachedTypeName.isEmpty()) // TODO: shouldn't happen ideally
attachedTypeName = type->baseTypeName();
@@ -1401,7 +1404,7 @@ void CodeGenerator::compileBinding(QQmlJSAotObject &current, const QmlIR::Bindin
u"nullptr"_qs);
// Note: getting attached property is fairly expensive
const QString getAttachedPropertyLine = u"qobject_cast<" + attachedTypeName
- + u" *>(qmlAttachedPropertiesObject<" + attachedTypeName
+ + u" *>(qmlAttachedPropertiesObject<" + attachingType->internalName()
+ u">(this, /* create = */ true))";
current.endInit.body
<< attachedMemberName + u" = " + getAttachedPropertyLine + u";";