diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-08-02 16:54:59 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-08-02 20:25:55 +0000 |
commit | a88f01364e147d9ea093bf0fdc639b45feef1788 (patch) | |
tree | cf1c49dee57f1c691eeecd633bffd0601256f236 /src/qml/jsruntime/qv4stringobject.cpp | |
parent | 0d63c22eee293fe59d7691608deaaf3468045eb3 (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/qv4stringobject.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4stringobject.cpp | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/src/qml/jsruntime/qv4stringobject.cpp b/src/qml/jsruntime/qv4stringobject.cpp index 12fed62bcc..a48ff0b00d 100644 --- a/src/qml/jsruntime/qv4stringobject.cpp +++ b/src/qml/jsruntime/qv4stringobject.cpp @@ -109,35 +109,6 @@ bool StringObject::virtualDeleteProperty(Managed *m, PropertyKey id) return Object::virtualDeleteProperty(m, id); } -void StringObject::virtualAdvanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attrs) -{ - name->setM(nullptr); - StringObject *s = static_cast<StringObject *>(m); - uint slen = s->d()->string->toQString().length(); - if (it->arrayIndex <= slen) { - while (it->arrayIndex < slen) { - *index = it->arrayIndex; - ++it->arrayIndex; - Property pd; - PropertyAttributes a = s->getOwnProperty(PropertyKey::fromArrayIndex(*index), &pd); - if (!(it->flags & ObjectIterator::EnumerableOnly) || a.isEnumerable()) { - *attrs = a; - p->copy(&pd, a); - return; - } - } - if (s->arrayData()) { - it->arrayNode = s->sparseBegin(); - // iterate until we're past the end of the string - while (it->arrayNode && it->arrayNode->key() < slen) - it->arrayNode = it->arrayNode->nextNode(); - } - } - - return Object::virtualAdvanceIterator(m, it, name, index, p, attrs); -} - - struct StringObjectOwnPropertyKeyIterator : ObjectOwnPropertyKeyIterator { ~StringObjectOwnPropertyKeyIterator() override = default; |