diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-05-03 21:50:18 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-05-04 18:12:50 +0000 |
commit | 4f086e3aacdab13625192b31adefe2d18ced2ae6 (patch) | |
tree | b466c2a4424f698b8b03285761ecedfe4f56be5e /src/qml/jsapi/qjsvalueiterator.cpp | |
parent | cff55a7a0da4e84527b6d04218da9b71c84e8f0e (diff) |
Rename ForeachIterator to ForInIterator
As it's being used for for(... in ...) loops. Also add a ES6
compatible iterator interface to it, so that we can unify
the handling of for-in and for-of.
Change-Id: I264f88ed049484945f5ea7e8bdf0227187456ba2
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsapi/qjsvalueiterator.cpp')
-rw-r--r-- | src/qml/jsapi/qjsvalueiterator.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/qml/jsapi/qjsvalueiterator.cpp b/src/qml/jsapi/qjsvalueiterator.cpp index ce472ce7e5..222f63ed4a 100644 --- a/src/qml/jsapi/qjsvalueiterator.cpp +++ b/src/qml/jsapi/qjsvalueiterator.cpp @@ -57,7 +57,7 @@ QJSValueIteratorPrivate::QJSValueIteratorPrivate(const QJSValue &v) QV4::Scope scope(e); QV4::ScopedObject o(scope, QJSValuePrivate::getValue(&v)); - iterator.set(e, e->newForEachIteratorObject(o)); + iterator.set(e, e->newForInIteratorObject(o)); } @@ -102,7 +102,7 @@ QJSValueIterator::QJSValueIterator(const QJSValue& object) if (!v4) return; QV4::Scope scope(v4); - QV4::Scoped<QV4::ForEachIteratorObject> it(scope, d_ptr->iterator.value()); + QV4::Scoped<QV4::ForInIteratorObject> it(scope, d_ptr->iterator.value()); it->d()->it().flags = QV4::ObjectIterator::NoFlags; QV4::ScopedString nm(scope); QV4::Property nextProperty; @@ -153,7 +153,7 @@ bool QJSValueIterator::next() if (!v4) return false; QV4::Scope scope(v4); - QV4::Scoped<QV4::ForEachIteratorObject> it(scope, d_ptr->iterator.value()); + QV4::Scoped<QV4::ForInIteratorObject> it(scope, d_ptr->iterator.value()); QV4::ScopedString nm(scope); QV4::Property nextProperty; QV4::PropertyAttributes nextAttributes; @@ -229,8 +229,8 @@ QJSValueIterator& QJSValueIterator::operator=(QJSValue& object) QV4::Scope scope(v4); QV4::ScopedObject o(scope, QJSValuePrivate::getValue(&object)); - d_ptr->iterator.set(v4, v4->newForEachIteratorObject(o)); - QV4::Scoped<QV4::ForEachIteratorObject> it(scope, d_ptr->iterator.value()); + d_ptr->iterator.set(v4, v4->newForInIteratorObject(o)); + QV4::Scoped<QV4::ForInIteratorObject> it(scope, d_ptr->iterator.value()); it->d()->it().flags = QV4::ObjectIterator::NoFlags; QV4::ScopedString nm(scope); QV4::Property nextProperty; |