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

Go to the source code of this file.
Functions | |
| if (n< 0||vm->sp+1< n) | |
| if (!vals) | |
| for (int i=n - 1;i >=0;--i) | |
| for (int i=0;i< n;++i) | |
| free (vals) | |
| push_value (vm, arr) | |
Variables | |
| case | OP_MAKE_ARRAY |
| Value * | vals = (Value *)malloc(sizeof(Value) * n) |
| Value | arr = make_array_from_values(vals, n) |
| break | |
Implements the OP_MAKE_ARRAY opcode for creating arrays in the VM.
This file handles the OP_MAKE_ARRAY instruction, which pops n values from the stack, creates an array from them, and pushes the resulting array back onto the stack.
Behavior:
Error Handling:
Example: // Bytecode: OP_MAKE_ARRAY 3 // Stack before: [1, 2, 3] // Stack after: [[1, 2, 3]]
Definition in file make_array.c.
| for | ( | ) |
| for | ( | int | i = n - 1; i >= 0; --i | ) |
Definition at line 44 of file make_array.c.
| free | ( | vals | ) |

| if | ( | ! | vals | ) |
Definition at line 40 of file make_array.c.
| if | ( | ) |
Definition at line 34 of file make_array.c.
| push_value | ( | vm | , |
| arr | ) |
| Value arr = make_array_from_values(vals, n) |
Definition at line 48 of file make_array.c.
| break |
Definition at line 54 of file make_array.c.
| case OP_MAKE_ARRAY |
Definition at line 32 of file make_array.c.