diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2023-09-12 12:16:47 +0200 |
|---|---|---|
| committer | Ulf Hermann <ulf.hermann@qt.io> | 2023-09-21 10:11:05 +0200 |
| commit | a173d50a9e54d2a21a5207f6c66bb54bb8f3a612 (patch) | |
| tree | 4b433bf9a693da88dbb7e5d995adbf996dd79b20 /src/qmlcompiler/qqmljsbasicblocks.cpp | |
| parent | af24ed58c250cce32e8d2dc12cfc36de79706f92 (diff) | |
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>
Diffstat (limited to 'src/qmlcompiler/qqmljsbasicblocks.cpp')
| -rw-r--r-- | src/qmlcompiler/qqmljsbasicblocks.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/qmlcompiler/qqmljsbasicblocks.cpp b/src/qmlcompiler/qqmljsbasicblocks.cpp index 6a535b9582..fc8f5b91fe 100644 --- a/src/qmlcompiler/qqmljsbasicblocks.cpp +++ b/src/qmlcompiler/qqmljsbasicblocks.cpp @@ -225,6 +225,12 @@ void QQmlJSBasicBlocks::generate_JumpNotUndefined(int offset) processJump(offset, Conditional); } +void QQmlJSBasicBlocks::generate_IteratorNext(int value, int offset) +{ + Q_UNUSED(value); + processJump(offset, Conditional); +} + void QQmlJSBasicBlocks::generate_Ret() { auto currentBlock = basicBlockForInstruction(m_basicBlocks, currentInstructionOffset()); |
