aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4executablecompilationunit_p.h
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2023-03-07 14:39:52 +0100
committerUlf Hermann <ulf.hermann@qt.io>2023-03-15 01:08:43 +0100
commit2d7fe23b41aa3fd719b7bc8aa585ab799e4a0c39 (patch)
tree4d5720b2713ffbce0fc00769c02ed676f078f879 /src/qml/jsruntime/qv4executablecompilationunit_p.h
parent4c6d0b2bf09329dd8b036761f8f2924f54af3a07 (diff)
QML: Insert aliases in inline components when loading from disk cache
So far we did not completely restore aliases in inline components. This was masked by the fact that until recently we failed to load inline components from the disk cache and always loaded them from source instead. To fix this, refactor QQmlComponentAndAliasResolver to work for both, QmlIR and QV4::CompiledData. With QmlIR, it populates the relevant data structures. With QV4::CompiledData, it sanity-checks them. The sanity-checks do incur some overhead, but given recent events, we should err on the side of caution here. Since QQmlComponentAndAliasResolver has received all the fixes we've applied to make inline components work, this should lead to inline components loaded from cache files to work the same way as those compiled from source. In turn, we can drop some methods of QQmlPropertyCacheAliasCreator. Amends commit 131db085a752469e8f19974c2edb3a138d900249 Pick-to: 6.5 Fixes: QTBUG-111766 Fixes: QTBUG-111857 Change-Id: I9cc75e700a5fe5810a866e9aa930b9811368b1b4 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4executablecompilationunit_p.h')
-rw-r--r--src/qml/jsruntime/qv4executablecompilationunit_p.h17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4executablecompilationunit_p.h b/src/qml/jsruntime/qv4executablecompilationunit_p.h
index 403b15158c..1d73154b80 100644
--- a/src/qml/jsruntime/qv4executablecompilationunit_p.h
+++ b/src/qml/jsruntime/qv4executablecompilationunit_p.h
@@ -154,9 +154,22 @@ public:
std::unique_ptr<CompilationUnitMapper> backingFile;
// --- interface for QQmlPropertyCacheCreator
- using CompiledObject = CompiledData::Object;
- using CompiledFunction = CompiledData::Function;
+ using CompiledObject = const CompiledData::Object;
+ using CompiledFunction = const CompiledData::Function;
+ using CompiledBinding = const CompiledData::Binding;
enum class ListPropertyAssignBehavior { Append, Replace, ReplaceIfNotDefault };
+
+ // Empty dummy. We don't need to do this when loading from cache.
+ class IdToObjectMap
+ {
+ public:
+ void insert(int, int) {}
+ void clear() {}
+
+ // We have already checked uniqueness of IDs when creating the CU
+ bool contains(int) { return false; }
+ };
+
ListPropertyAssignBehavior listPropertyAssignBehavior() const
{
if (data->flags & CompiledData::Unit::ListPropertyAssignReplace)