For loop on arrays working, untested, read more
Needed: break and continue support, extensive tests, other iterables
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
|
||||
|
||||
```toy
|
||||
for (var name in array) {
|
||||
//
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
pushStack name
|
||||
pushStack array
|
||||
pushStack counter //tracks the index for each loop
|
||||
|
||||
OPCODE iterable:
|
||||
pushScope
|
||||
declare name = array.next() if next is not null else jump to end
|
||||
|
||||
(user code)
|
||||
|
||||
popScope
|
||||
jump to beginning
|
||||
|
||||
popStack counter, array, name
|
||||
Reference in New Issue
Block a user