diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2016-06-14 11:11:18 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2016-06-16 18:00:32 +0000 |
commit | c2c13cacd450d866e60c58c87ff1ab16ae736804 (patch) | |
tree | 036a78caefe83045508bd18b3fe9c41aec32fe25 /src/qml/compiler/qqmlpropertycachecreator_p.h | |
parent | 79745bf95cfb656b7ea75850c2b378cac3ea18ec (diff) |
Clean up property cache creation code
* Reduce the complexity of the recursive tree traversal by moving
the base type property cache creation into a helper function and using a
context to encapsulate the origin of the current traversal
* ensureVMEMetaObject() had only one call site and it's easiest to
inline that for now.
* Transition to a new state-less error handling, so that in the future
this code can be used without the QQmlTypeCompiler dependency, which
will be needed for loading of compilation units from disk.
* A few missing consts.
Change-Id: Ibe7209c357a3c7e101fac6960ece40a033e55f72
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/compiler/qqmlpropertycachecreator_p.h')
-rw-r--r-- | src/qml/compiler/qqmlpropertycachecreator_p.h | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/qml/compiler/qqmlpropertycachecreator_p.h b/src/qml/compiler/qqmlpropertycachecreator_p.h index 1a3a96e4e3..5f49e6d973 100644 --- a/src/qml/compiler/qqmlpropertycachecreator_p.h +++ b/src/qml/compiler/qqmlpropertycachecreator_p.h @@ -63,9 +63,19 @@ public: bool buildMetaObjects(); protected: - bool buildMetaObjectRecursively(int objectIndex, int referencingObjectIndex, const QV4::CompiledData::Binding *instantiatingBinding); - bool ensureVMEMetaObject(int objectIndex); - bool createMetaObject(int objectIndex, const QmlIR::Object *obj, QQmlPropertyCache *baseTypeCache); + + struct InstantiationContext { + InstantiationContext(); + InstantiationContext(int referencingObjectIndex, const QV4::CompiledData::Binding *instantiatingBinding, const QString &instantiatingPropertyName, const QQmlPropertyCache *referencingObjectPropertyCache); + int referencingObjectIndex; + const QV4::CompiledData::Binding *instantiatingBinding; + QQmlPropertyData *instantiatingProperty; + }; + + QQmlCompileError buildMetaObjectRecursively(int objectIndex, const InstantiationContext &context); + QQmlPropertyCache *propertyCacheForObject(const QmlIR::Object *obj, const InstantiationContext &context, QQmlCompileError *error) const; + QQmlCompileError createMetaObject(int objectIndex, const QmlIR::Object *obj, QQmlPropertyCache *baseTypeCache); + QQmlEnginePrivate *enginePrivate; const QList<QmlIR::Object*> &qmlObjects; |