From 1e095058e165b1c2f244799ca1928ae4cc046a2c Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Fri, 15 Nov 2024 13:52:25 +0100 Subject: QmlCompiler: Split QQmlJSRegisterContent in public and private classes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/qmlcompiler/qqmljsfunctioninitializer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/qmlcompiler/qqmljsfunctioninitializer.cpp') 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); -- cgit v1.2.3