diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2024-01-10 09:22:19 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2024-01-20 23:59:24 +0100 |
commit | 930c8f186ac07f3462de41bcba6cf9d881e79fc2 (patch) | |
tree | 555a8cc6d26691dac2f4f4d2dfd3a1e7b7dab9fb /src/qml/qml/qqmlpropertyvalidator.cpp | |
parent | af212e5e4edb73978298cd030b15deb8d8c28183 (diff) |
QtQml: Use CompiledData::CompilationUnit in more places
We rarely actually need the executable CU, and where we need it, we can
dynamically create or retrieve it from the engine. To that end, store
all the CUs in the same container in the engine.
Change-Id: I0b786048c578ac4f41ae4aee601da850fa400f2e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlpropertyvalidator.cpp')
-rw-r--r-- | src/qml/qml/qqmlpropertyvalidator.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/qml/qml/qqmlpropertyvalidator.cpp b/src/qml/qml/qqmlpropertyvalidator.cpp index 8b0e340736..82fd072698 100644 --- a/src/qml/qml/qqmlpropertyvalidator.cpp +++ b/src/qml/qml/qqmlpropertyvalidator.cpp @@ -28,15 +28,14 @@ QT_FOR_EACH_STATIC_PRIMITIVE_TYPE(HANDLE_PRIMITIVE); } } -QQmlPropertyValidator::QQmlPropertyValidator( - QQmlEnginePrivate *enginePrivate, const QQmlImports *imports, - const QQmlRefPointer<QV4::ExecutableCompilationUnit> &compilationUnit) +QQmlPropertyValidator::QQmlPropertyValidator(QQmlEnginePrivate *enginePrivate, const QQmlImports *imports, + const QQmlRefPointer<QV4::CompiledData::CompilationUnit> &compilationUnit) : enginePrivate(enginePrivate) , compilationUnit(compilationUnit) , imports(imports) , qmlUnit(compilationUnit->unitData()) - , propertyCaches(*compilationUnit->propertyCachesPtr()) - , bindingPropertyDataPerObject(&compilationUnit->baseCompilationUnit()->bindingPropertyDataPerObject) + , propertyCaches(compilationUnit->propertyCaches) + , bindingPropertyDataPerObject(&compilationUnit->bindingPropertyDataPerObject) { bindingPropertyDataPerObject->resize(compilationUnit->objectCount()); } @@ -343,7 +342,10 @@ QVector<QQmlError> QQmlPropertyValidator::validateObject( customParser->validator = this; customParser->engine = enginePrivate; customParser->imports = imports; - customParser->verifyBindings(compilationUnit, customBindings); + customParser->verifyBindings( + enginePrivate->v4engine()->executableCompilationUnit( + QQmlRefPointer<QV4::CompiledData::CompilationUnit>(compilationUnit)), + customBindings); customParser->validator = nullptr; customParser->engine = nullptr; customParser->imports = (QQmlImports*)nullptr; @@ -637,9 +639,9 @@ bool QQmlPropertyValidator::canCoerce(QMetaType to, QQmlPropertyCache::ConstPtr // it is not properly registered at this point, as registration // only occurs after the whole file has been validated // Therefore we need to check the ICs here - for (const auto& icDatum : compilationUnit->inlineComponentData()) { + for (const auto& icDatum : compilationUnit->inlineComponentData) { if (icDatum.qmlType.typeId() == to) { - toMo = compilationUnit->propertyCachesPtr()->at(icDatum.objectIndex); + toMo = compilationUnit->propertyCaches.at(icDatum.objectIndex); break; } } @@ -747,10 +749,10 @@ QQmlError QQmlPropertyValidator::validateObjectBinding(const QQmlPropertyData *p // it is not properly registered at this point, as registration // only occurs after the whole file has been validated // Therefore we need to check the ICs here - for (const auto& icDatum: compilationUnit->inlineComponentData()) { + for (const auto& icDatum: compilationUnit->inlineComponentData) { if (icDatum.qmlType.typeId() == property->propType()) { propertyMetaObject - = compilationUnit->propertyCachesPtr()->at(icDatum.objectIndex); + = compilationUnit->propertyCaches.at(icDatum.objectIndex); break; } } |