![]() | Fun 0.41.5 The programming language that makes You have fun |
Implements the OP_TYPEOF opcode for obtaining a human-readable type name. More...
Go to the source code of this file.
Functions | |
| switch (v.type) | |
| push_value (vm, make_string(tname)) | |
| free_value (v) | |
Variables | |
| case | OP_TYPEOF |
| const char * | tname = "Unknown" |
| break | |
Implements the OP_TYPEOF opcode for obtaining a human-readable type name.
This snippet is included by the VM's opcode dispatch. It pops a single value from the stack, determines its runtime type, pushes a new string with a human-readable type name (e.g., "Number", "String", "Array"), and frees the original value.
Stack contract:
Definition in file typeof.c.
| free_value | ( | v | ) |
| push_value | ( | vm | , |
| make_string(tname) | ) |