![]() |
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) = strdup("") | |
| 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:
Definition in file make_array.c.
| for | ( | ) |
Definition at line 49 of file make_array.c.
| for | ( | int | i = n - 1; i >= 0; --i | ) |
Definition at line 44 of file make_array.c.
| free | ( | vals | ) |
| if | ( | ! | vals | ) | = strdup("") |
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.