![]() | Fun 0.41.5 The programming language that makes You have fun |
Implements the OP_ENUMERATE opcode for enumerating arrays in the VM. More...

Go to the source code of this file.
Functions | |
| if (arr.type !=VAL_ARRAY) | |
| free_value (arr) | |
| push_value (vm, out) | |
Variables | |
| case | OP_ENUMERATE |
| Value | out = bi_enumerate(&arr) |
| break | |
Implements the OP_ENUMERATE opcode for enumerating arrays in the VM.
This file handles the OP_ENUMERATE instruction, which creates an array of [index, value] pairs from an array. The array is popped from the stack, and the new array is pushed back.
Behavior:
Error Handling:
Example: // Bytecode: OP_ENUMERATE // Stack before: [[10, 20, 30]] // Stack after: [[[0, 10], [1, 20], [2, 30]]]
Definition in file enumerate.c.
| free_value | ( | arr | ) |
| if | ( | arr.type ! | = VAL_ARRAY | ) |
Definition at line 33 of file enumerate.c.
| push_value | ( | vm | , |
| out | ) |
| break |
Definition at line 40 of file enumerate.c.
| case OP_ENUMERATE |
Definition at line 31 of file enumerate.c.
| Value out = bi_enumerate(&arr) |
Definition at line 37 of file enumerate.c.