aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmlcompiler/qqmljsfunctioninitializer.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2024-11-15 13:52:25 +0100
committerUlf Hermann <ulf.hermann@qt.io>2024-11-20 10:00:56 +0100
commit1e095058e165b1c2f244799ca1928ae4cc046a2c (patch)
treee85ad67398f6724d723cf3c3b40f602db6f37193 /src/qmlcompiler/qqmljsfunctioninitializer.cpp
parent55c3b94035787ea265c5ff6e3c271d7154186def (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/qqmljsfunctioninitializer.cpp')
-rw-r--r--src/qmlcompiler/qqmljsfunctioninitializer.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/qmlcompiler/qqmljsfunctioninitializer.cpp b/src/qmlcompiler/qqmljsfunctioninitializer.cpp
index c276d2ff4f..2419c425ad 100644
--- a/src/qmlcompiler/qqmljsfunctioninitializer.cpp
+++ b/src/qmlcompiler/qqmljsfunctioninitializer.cpp
@@ -162,7 +162,7 @@ QQmlJSCompilePass::Function QQmlJSFunctionInitializer::run(
bindingLocation.startColumn = irBinding.location.column();
QQmlJSCompilePass::Function function;
- function.qmlScope = QQmlJSRegisterContent::create(
+ function.qmlScope = m_typeResolver->registerContentPool()->create(
m_scopeType, QQmlJSRegisterContent::InvalidLookupIndex,
QQmlJSRegisterContent::ScopeObject);
@@ -275,7 +275,7 @@ QQmlJSCompilePass::Function QQmlJSFunctionInitializer::run(
Q_UNUSED(functionName);
QQmlJSCompilePass::Function function;
- function.qmlScope = QQmlJSRegisterContent::create(
+ function.qmlScope = m_typeResolver->registerContentPool()->create(
m_scopeType, QQmlJSRegisterContent::InvalidLookupIndex,
QQmlJSRegisterContent::ScopeObject);