diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2016-06-15 09:24:51 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2016-06-16 20:21:46 +0000 |
commit | 54d92bbcbf9cde4d66cfea9053e66e7b072a7ada (patch) | |
tree | 873595de774c2aea74ed64c51d5d6845bbd1b99a /src/qml/compiler/qqmlpropertycachecreator_p.h | |
parent | ebe51b92a353ba17e6293c280b77aab3f2a02a90 (diff) |
Separate non-generic code out of QQmlPropertyCacheCreator
Some code is not suitable for a future conversion of the class to a
template, which is now moved out. This includes the tr() handling as
well as the instantiation context, which does not require any
parameterization.
Change-Id: Ib40e24ebb7166c8649ca218f02558a737d39fe53
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 | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/src/qml/compiler/qqmlpropertycachecreator_p.h b/src/qml/compiler/qqmlpropertycachecreator_p.h index 6d575c6a99..f78aa69cfe 100644 --- a/src/qml/compiler/qqmlpropertycachecreator_p.h +++ b/src/qml/compiler/qqmlpropertycachecreator_p.h @@ -54,9 +54,23 @@ QT_BEGIN_NAMESPACE -class QQmlPropertyCacheCreator +struct QQmlBindingInstantiationContext { + QQmlBindingInstantiationContext(); + QQmlBindingInstantiationContext(int referencingObjectIndex, const QV4::CompiledData::Binding *instantiatingBinding, const QString &instantiatingPropertyName, const QQmlPropertyCache *referencingObjectPropertyCache); + int referencingObjectIndex; + const QV4::CompiledData::Binding *instantiatingBinding; + QQmlPropertyData *instantiatingProperty; +}; + +struct QQmlPropertyCacheCreatorBase +{ + Q_DECLARE_TR_FUNCTIONS(QQmlPropertyCacheCreatorBase) +public: + static QAtomicInt classIndexCounter; +}; + +class QQmlPropertyCacheCreator : public QQmlPropertyCacheCreatorBase { - Q_DECLARE_TR_FUNCTIONS(QQmlPropertyCacheCreator) public: QQmlPropertyCacheCreator(QQmlPropertyCacheVector *propertyCaches, QQmlEnginePrivate *enginePrivate, const QQmlTypeCompiler *compiler, const QQmlImports *imports); ~QQmlPropertyCacheCreator(); @@ -64,16 +78,8 @@ public: QQmlCompileError buildMetaObjects(); protected: - 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 buildMetaObjectRecursively(int objectIndex, const QQmlBindingInstantiationContext &context); + QQmlPropertyCache *propertyCacheForObject(const QmlIR::Object *obj, const QQmlBindingInstantiationContext &context, QQmlCompileError *error) const; QQmlCompileError createMetaObject(int objectIndex, const QmlIR::Object *obj, QQmlPropertyCache *baseTypeCache); QString stringAt(int index) const { return compiler->stringAt(index); } |