aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmlcompiler/qqmljsstorageinitializer.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2024-11-19 17:27:09 +0100
committerUlf Hermann <ulf.hermann@qt.io>2024-11-28 13:16:01 +0100
commit4a563051b0b7edb895780b409bc8895cd7e67def (patch)
treec925bb6aef3d4c648e7419832fb97be1c45488c2 /src/qmlcompiler/qqmljsstorageinitializer.cpp
parentf2920663dcd35cadcd1dad2f25eed620acedda72 (diff)
QmlCompiler: Move type adjustment into QQmlJSRegisterContent
This is the central piece of the refactoring. Instead of re-writing the QQmlJSScopes on adjustment we now rewrite the QQmlJSRegisterContents. The main benefit of this is that we can locally link QQmlJSRegisterContents together without invoking QQmlJSTypeResolver. The other benefit is that we gain more control over where the re-written types show up. QQmlJSScope is stored in many places that should really not be re-written. QQmlJSRegisterContent is only used locally when analyzing a binding or function. Finally, we can now chain the type adjustments with other operations on QQmlJSRegisterContents, without restrictions. This makes a few methods of QQmlJSTypeResolver obsolete. Those will be removed in a separate step. In order to get this right, we need to deviate from the notion that every read register is either a rename or a conversion. Rather, we must pass any "as-is" read of a register through that way. We rely on those to be re-written when the original register is. Task-number: QTBUG-124670 Change-Id: I0d968dfe495b82d9d9f67d598447bd2ad5bdcd04 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Diffstat (limited to 'src/qmlcompiler/qqmljsstorageinitializer.cpp')
-rw-r--r--src/qmlcompiler/qqmljsstorageinitializer.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/qmlcompiler/qqmljsstorageinitializer.cpp b/src/qmlcompiler/qqmljsstorageinitializer.cpp
index a542e03e3f..04ba64a647 100644
--- a/src/qmlcompiler/qqmljsstorageinitializer.cpp
+++ b/src/qmlcompiler/qqmljsstorageinitializer.cpp
@@ -32,19 +32,19 @@ QQmlJSCompilePass::BlocksAndAnnotations QQmlJSStorageInitializer::run(Function *
}
const auto storeRegister = [&](QQmlJSRegisterContent &content) {
- if (!content.isValid())
+ if (!content.isValid() || !content.storage().isNull())
return;
- const QQmlJSScope::ConstPtr original
- = m_typeResolver->originalType(content.containedType());
- const QQmlJSScope::ConstPtr originalStored = m_typeResolver->storedType(original);
+ const QQmlJSRegisterContent original = m_typeResolver->original(content);
+ const QQmlJSScope::ConstPtr originalStored
+ = m_typeResolver->storedType(original.containedType());
const QQmlJSScope::ConstPtr originalTracked = m_typeResolver->trackedType(originalStored);
content = m_pool->storedIn(content, originalTracked);
const QQmlJSScope::ConstPtr adjustedStored
= m_typeResolver->storedType(content.containedType());
- if (!m_typeResolver->adjustTrackedType(originalTracked, adjustedStored)) {
+ if (!m_typeResolver->adjustTrackedType(content.storage(), adjustedStored)) {
addError(QStringLiteral("Cannot adjust stored type for %1.")
.arg(content.containedType()->internalName()));
}