diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-05-04 10:56:19 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-05-09 20:47:27 +0000 |
commit | 128485ccdb4f1c6f1bf1ebea85c5bed749cacd7a (patch) | |
tree | 350c795726910498f2a2ee7f9caa71018ae7ad5a /src/qml/jsruntime/qv4vme_moth.cpp | |
parent | 20a5d1ab3f47b4da6ba39143beaafedb26dbad6a (diff) |
Add some basic support for for-of loops
The support is basically at the same level as for for-in
at the moment.
Currently unimplemented:
* Destructuring
* Proper lexical scoping
* calling iterator.throw()/return() when required
Change-Id: If193ce0b054c4315fc16b7e174334a31b2730dcf
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4vme_moth.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4vme_moth.cpp | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/qml/jsruntime/qv4vme_moth.cpp b/src/qml/jsruntime/qv4vme_moth.cpp index 08a085c90d..7f27619d08 100644 --- a/src/qml/jsruntime/qv4vme_moth.cpp +++ b/src/qml/jsruntime/qv4vme_moth.cpp @@ -938,17 +938,11 @@ QV4::ReturnedValue VME::interpret(CppStackFrame &frame, const uchar *code) STACK_VALUE(CallData::Context) = STACK_VALUE(reg); MOTH_END_INSTR(PopContext) - MOTH_BEGIN_INSTR(ForeachIteratorObject) + MOTH_BEGIN_INSTR(GetIterator) STORE_ACC(); - acc = Runtime::method_foreachIterator(engine, accumulator); + acc = Runtime::method_getIterator(engine, accumulator, iterator); CHECK_EXCEPTION; - MOTH_END_INSTR(ForeachIteratorObject) - - MOTH_BEGIN_INSTR(ForeachNextPropertyName) - STORE_ACC(); - acc = Runtime::method_foreachNextPropertyName(accumulator); - CHECK_EXCEPTION; - MOTH_END_INSTR(ForeachNextPropertyName) + MOTH_END_INSTR(GetIterator) MOTH_BEGIN_INSTR(DeleteMember) if (!Runtime::method_deleteMember(engine, STACK_VALUE(base), member)) { |