![]() | Fun 0.41.5 The programming language that makes You have fun |
Implements the OP_CAST opcode for converting a value to a target type. More...
Go to the source code of this file.
Functions | |
| if (tn) | |
| if (!tn) | |
| else | if (strcmp(target, "number")==0) |
| else | if (strcmp(target, "string")==0) |
| else | if (strcmp(target, "array")==0) |
| else | if (strcmp(target, "map")==0) |
| else | if (strcmp(target, "nil")==0) |
| else | if (strcmp(target, "function")==0) |
| else | if (strcmp(target, "boolean")==0) |
| free_value (t) | |
| free_value (v) | |
| push_value (vm, out) | |
Variables | |
| case | OP_CAST |
| Value | v = pop_value(vm) |
| const char * | tn = (t.type == VAL_STRING && t.s) ? t.s : NULL |
| Value | out = make_nil() |
| char | target [32] = '\0' |
| int | k = 0 |
| else | |
| break | |
Implements the OP_CAST opcode for converting a value to a target type.
Stack contract:
Definition in file cast.c.
| free_value | ( | t | ) |
| free_value | ( | v | ) |
| push_value | ( | vm | , |
| out | ) |
| else |
| const char* tn = (t.type == VAL_STRING && t.s) ? t.s : NULL |