diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2016-05-25 10:25:25 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2016-05-26 11:33:00 +0000 |
commit | 8457ca1b3dfb048acdb4426960ad7ee7c8227ed4 (patch) | |
tree | d33256028f22b5a28a9ea6fda3b98bedc5aeebab /src/qml/compiler/qqmltypecompiler_p.h | |
parent | 899c1ef0f7574019f1b41a922b2ba10614df130f (diff) |
Simplify object to id-in-context mapping
By storing the calculated integer id for an id-named object in
CompiledData::Object we can simplify the code and replace a hash table with a
plain vector.
Change-Id: I4a84cdd00e98766d603d152e5a6574b232771a02
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Diffstat (limited to 'src/qml/compiler/qqmltypecompiler_p.h')
-rw-r--r-- | src/qml/compiler/qqmltypecompiler_p.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/qml/compiler/qqmltypecompiler_p.h b/src/qml/compiler/qqmltypecompiler_p.h index a22169f728..2650d07a32 100644 --- a/src/qml/compiler/qqmltypecompiler_p.h +++ b/src/qml/compiler/qqmltypecompiler_p.h @@ -101,8 +101,8 @@ public: int rootObjectIndex() const; void setPropertyCaches(const QQmlPropertyCacheVector &caches); const QQmlPropertyCacheVector &propertyCaches() const; - QHash<int, int> *objectIndexToIdForRoot(); - QHash<int, QHash<int, int> > *objectIndexToIdPerComponent(); + QVector<quint32> *namedObjectsInRootScope(); + QHash<int, QVector<quint32> > *namedObjectsPerComponent(); QHash<int, QBitArray> *customParserBindings(); QQmlJS::MemoryPool *memoryPool(); QStringRef newStringRef(const QString &string); @@ -275,13 +275,13 @@ protected: int _componentIndex; QHash<int, int> _idToObjectIndex; - QHash<int, int> *_objectIndexToIdInScope; + QVector<quint32> *_namedObjectsInScope; QList<int> _objectsWithAliases; QHash<int, QQmlCompiledData::TypeReference*> *resolvedTypes; QQmlPropertyCacheVector propertyCaches; - QHash<int, int> *objectIndexToIdForRoot; - QHash<int, QHash<int, int> > *objectIndexToIdPerComponent; + QVector<quint32> *namedObjectsInRootScope; + QHash<int, QVector<quint32>> *namedObjectsPerComponent; }; class QQmlPropertyValidator : public QQmlCompilePass @@ -324,7 +324,7 @@ public: bool generateCodeForComponents(); private: - bool compileComponent(int componentRoot, const QHash<int, int> &objectIndexToId); + bool compileComponent(int componentRoot, const QVector<quint32> &namedObjects); bool compileJavaScriptCodeInObjectsRecursively(int objectIndex, int scopeObjectIndex); const QHash<int, QQmlCompiledData::TypeReference*> &resolvedTypes; |