aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qqmlirbuilder_p.h
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2016-06-15 13:27:20 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2016-06-16 19:05:40 +0000
commitf2c97b4e307a62b831f68a0278551d4375170336 (patch)
treee4cfa8d09551f3fe6684c3b874357a633b7e0523 /src/qml/compiler/qqmlirbuilder_p.h
parent12d2b60218542e900076aebfce73a229a8b29ae1 (diff)
PropertyCacheCreator traversal cleanup
Replace the direct linked list object traversal with iterators. This will allow for re-use of the code against the QV4::CompiledData structures when they get the same interface. Change-Id: I901fd3377ef0f0317e5d9278cface37d80f93abf Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/compiler/qqmlirbuilder_p.h')
-rw-r--r--src/qml/compiler/qqmlirbuilder_p.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/qml/compiler/qqmlirbuilder_p.h b/src/qml/compiler/qqmlirbuilder_p.h
index 2409050f7d..a29727fc9e 100644
--- a/src/qml/compiler/qqmlirbuilder_p.h
+++ b/src/qml/compiler/qqmlirbuilder_p.h
@@ -175,6 +175,14 @@ struct PoolList
return ptr;
}
+ T &operator*() {
+ return *ptr;
+ }
+
+ const T &operator*() const {
+ return *ptr;
+ }
+
void operator++() {
ptr = ptr->next;
}
@@ -204,6 +212,12 @@ public:
, count(0)
{}
+ void allocate(QQmlJS::MemoryPool *pool, int size)
+ {
+ count = size;
+ data = reinterpret_cast<T*>(pool->allocate(count * sizeof(T)));
+ }
+
void allocate(QQmlJS::MemoryPool *pool, const QVector<T> &vector)
{
count = vector.count();
@@ -244,6 +258,9 @@ public:
return i;
return -1;
}
+
+ const T *begin() const { return data; }
+ const T *end() const { return data + count; }
};
struct Object;
@@ -261,6 +278,10 @@ struct Signal
QStringList parameterStringList(const QV4::Compiler::StringTableGenerator *stringPool) const;
+ int parameterCount() const { return parameters->count; }
+ PoolList<SignalParameter>::Iterator parametersBegin() const { return parameters->begin(); }
+ PoolList<SignalParameter>::Iterator parametersEnd() const { return parameters->end(); }
+
Signal *next;
};
@@ -290,6 +311,13 @@ struct Function
QV4::CompiledData::Location location;
int nameIndex;
quint32 index; // index in parsedQML::functions
+ FixedPoolArray<int> formals;
+
+ // --- QQmlPropertyCacheCreator interface
+ const int *formalsBegin() const { return formals.begin(); }
+ const int *formalsEnd() const { return formals.end(); }
+ // ---
+
Function *next;
};
@@ -342,6 +370,12 @@ public:
PoolList<Binding>::Iterator bindingsEnd() const { return bindings->end(); }
PoolList<Property>::Iterator propertiesBegin() const { return properties->begin(); }
PoolList<Property>::Iterator propertiesEnd() const { return properties->end(); }
+ PoolList<Alias>::Iterator aliasesBegin() const { return aliases->begin(); }
+ PoolList<Alias>::Iterator aliasesEnd() const { return aliases->end(); }
+ PoolList<Signal>::Iterator signalsBegin() const { return qmlSignals->begin(); }
+ PoolList<Signal>::Iterator signalsEnd() const { return qmlSignals->end(); }
+ PoolList<Function>::Iterator functionsBegin() const { return functions->begin(); }
+ PoolList<Function>::Iterator functionsEnd() const { return functions->end(); }
// If set, then declarations for this object (and init bindings for these) should go into the
// specified object. Used for declarations inside group properties.