Commit Graph

1 Commits

Author SHA1 Message Date
Ulf Hermann a173d50a9e QmlCompiler: Implement GetIterator and IteratorNext
Each GetIterator generates

* A unique iterator variable that keeps track of the current index
* In the case of for...of a copy of reference to the list being iterated

The result register holds a pointer to the unique iterator so that it
can be loaded and stored without resetting it.

In order to do anything meaningful with iterators (in the tests) we also
need to allow LoadElement with our "optional" types. That is a
conversion of undefined and some other type to QVariant or
QJSPrimitiveValue. This follows the same pattern as the other
"optional"s we already have.

For...of is currently not testable because it requires exception
handlers. The tests will be added once we get exception handlers.

Task-number: QTBUG-116725
Change-Id: I167fe16b983dc34bf86e1840dfcbf2bf682eecc1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-09-21 10:11:05 +02:00