diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2024-11-15 13:52:25 +0100 |
|---|---|---|
| committer | Ulf Hermann <ulf.hermann@qt.io> | 2024-11-20 10:00:56 +0100 |
| commit | 1e095058e165b1c2f244799ca1928ae4cc046a2c (patch) | |
| tree | e85ad67398f6724d723cf3c3b40f602db6f37193 /src/qmlcompiler/qqmljsstorageinitializer.cpp | |
| parent | 55c3b94035787ea265c5ff6e3c271d7154186def (diff) | |
QmlCompiler: Split QQmlJSRegisterContent in public and private classes
We want an easy way to hold pointers to other QQmlJSRegisterContents in
QQmlJSRegisterContent. Furthermore, copying a QQmlJSRegisterContent so
far is very expensive. Solve both problems by introducing the PIMPL
pattern with a shared d-pointer.
This also changes the equality semantics of QQmlJSRegisterContent. Two
QQmlJSRegisterContents are only equal if they contain the same d-pointer
now, not if their contents are otherwise equal. However, since we
generally don't rely on immediate equality of QQmlJSRegisterContent
anyway, this is not a problem. QQmlJSTypeResolver::equals() still works.
There is one place where the equality was used, though. That one is
adapted.
Furthermore, we now want to keep the register contents in a pool that's
automatically cleared when we're done with our analysis. Therefore the
creation methods cannot be static anymore and storedIn() as well as
castTo() need to go through the pool as well.
Task-number: QTBUG-124670
Change-Id: I0a51b609fc769ccb33c1d82930bda83c2a40e1a5
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Diffstat (limited to 'src/qmlcompiler/qqmljsstorageinitializer.cpp')
| -rw-r--r-- | src/qmlcompiler/qqmljsstorageinitializer.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/qmlcompiler/qqmljsstorageinitializer.cpp b/src/qmlcompiler/qqmljsstorageinitializer.cpp index 27169001f2..a542e03e3f 100644 --- a/src/qmlcompiler/qqmljsstorageinitializer.cpp +++ b/src/qmlcompiler/qqmljsstorageinitializer.cpp @@ -23,7 +23,7 @@ QQmlJSCompilePass::BlocksAndAnnotations QQmlJSStorageInitializer::run(Function * if (QQmlJSRegisterContent &returnType = function->returnType; returnType.isValid()) { if (const QQmlJSScope::ConstPtr stored = m_typeResolver->storedType(returnType.containedType())) { - returnType = returnType.storedIn(m_typeResolver->trackedType(stored)); + returnType = m_pool->storedIn(returnType, m_typeResolver->trackedType(stored)); } else { addError(QStringLiteral("Cannot store the return type %1.") .arg(returnType.containedType()->internalName())); @@ -39,7 +39,7 @@ QQmlJSCompilePass::BlocksAndAnnotations QQmlJSStorageInitializer::run(Function * = m_typeResolver->originalType(content.containedType()); const QQmlJSScope::ConstPtr originalStored = m_typeResolver->storedType(original); const QQmlJSScope::ConstPtr originalTracked = m_typeResolver->trackedType(originalStored); - content = content.storedIn(originalTracked); + content = m_pool->storedIn(content, originalTracked); const QQmlJSScope::ConstPtr adjustedStored = m_typeResolver->storedType(content.containedType()); |
