aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4object.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-08-02 16:54:59 +0200
committerLars Knoll <lars.knoll@qt.io>2018-08-02 20:25:55 +0000
commita88f01364e147d9ea093bf0fdc639b45feef1788 (patch)
treecf1c49dee57f1c691eeecd633bffd0601256f236 /src/qml/jsruntime/qv4object.cpp
parent0d63c22eee293fe59d7691608deaaf3468045eb3 (diff)
Implement ObjectIterator using the new iteration mechanism
And with that get rid of the old advanceIterator methods. Change-Id: I969fa89d25df8992a4b08c8c081b91c92ffdfddd Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4object.cpp')
-rw-r--r--src/qml/jsruntime/qv4object.cpp71
1 files changed, 0 insertions, 71 deletions
diff --git a/src/qml/jsruntime/qv4object.cpp b/src/qml/jsruntime/qv4object.cpp
index f4604dbce7..6a6687661c 100644
--- a/src/qml/jsruntime/qv4object.cpp
+++ b/src/qml/jsruntime/qv4object.cpp
@@ -337,77 +337,6 @@ bool Object::virtualDeleteProperty(Managed *m, PropertyKey id)
return static_cast<Object *>(m)->internalDeleteProperty(id);
}
-void Object::virtualAdvanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *pd, PropertyAttributes *attrs)
-{
- Object *o = static_cast<Object *>(m);
- name->setM(nullptr);
- *index = UINT_MAX;
-
- if (o->arrayData()) {
- if (!it->arrayIndex)
- it->arrayNode = o->sparseBegin();
-
- // sparse arrays
- if (it->arrayNode) {
- while (it->arrayNode != o->sparseEnd()) {
- int k = it->arrayNode->key();
- uint pidx = it->arrayNode->value;
- Heap::SparseArrayData *sa = o->d()->arrayData.cast<Heap::SparseArrayData>();
- const Property *p = reinterpret_cast<const Property *>(sa->values.data() + pidx);
- it->arrayNode = it->arrayNode->nextNode();
- PropertyAttributes a = sa->attrs ? sa->attrs[pidx] : Attr_Data;
- if (!(it->flags & ObjectIterator::EnumerableOnly) || a.isEnumerable()) {
- it->arrayIndex = k + 1;
- *index = k;
- *attrs = a;
- pd->copy(p, a);
- return;
- }
- }
- it->arrayNode = nullptr;
- it->arrayIndex = UINT_MAX;
- }
- // dense arrays
- while (it->arrayIndex < o->d()->arrayData->values.size) {
- Heap::SimpleArrayData *sa = o->d()->arrayData.cast<Heap::SimpleArrayData>();
- const Value &val = sa->data(it->arrayIndex);
- PropertyAttributes a = o->arrayData()->attributes(it->arrayIndex);
- ++it->arrayIndex;
- if (!val.isEmpty()
- && (!(it->flags & ObjectIterator::EnumerableOnly) || a.isEnumerable())) {
- *index = it->arrayIndex - 1;
- *attrs = a;
- pd->value = val;
- return;
- }
- }
- }
-
- while (it->memberIndex < o->internalClass()->size) {
- PropertyKey n = o->internalClass()->nameMap.at(it->memberIndex);
- if (!n.isStringOrSymbol() || !n.asStringOrSymbol()->internalClass->vtable->isString) {
- // accessor properties have a dummy entry with n == 0
- // symbol entries are supposed to be skipped
- ++it->memberIndex;
- continue;
- }
-
- int idx = it->memberIndex;
- PropertyAttributes a = o->internalClass()->propertyData[it->memberIndex];
- ++it->memberIndex;
- if (!(it->flags & ObjectIterator::EnumerableOnly) || a.isEnumerable()) {
- name->setM(n.asStringOrSymbol());
- *attrs = a;
- pd->value = *o->propertyData(idx);
- if (a.isAccessor())
- pd->set = *o->propertyData(idx + SetterOffset);
- return;
- }
- }
-
- *attrs = PropertyAttributes();
-}
-
PropertyKey ObjectOwnPropertyKeyIterator::next(const Object *o, Property *pd, PropertyAttributes *attrs)
{
if (arrayIndex != UINT_MAX && o->arrayData()) {