![]() | Fun 0.41.5 The programming language that makes You have fun |
VM opcode snippet for converting a Fun Value to a JSON string. More...
Go to the source code of this file.
Functions | |
| free_value (vpretty) | |
| free_value (any) | |
| push_value (vm, make_string("null")) | |
Variables | |
| case | OP_JSON_STRINGIFY |
| Value | any = pop_value(vm) |
| break | |
VM opcode snippet for converting a Fun Value to a JSON string.
Implements the OP_JSON_STRINGIFY instruction. Expects a boolean/integer flag indicating pretty-printing and a Value to serialize. Uses json-c to build a json_object from the Value and then renders it to a string, which is pushed back to the stack.
Build gating: compiled only when FUN_WITH_JSON is enabled. Otherwise the opcode consumes its two arguments and pushes the string "null".
Stack effect (with FUN_WITH_JSON):
Errors and edge cases:
Definition in file stringify.c.
| free_value | ( | any | ) |
| free_value | ( | vpretty | ) |
| push_value | ( | vm | , |
| make_string("null") | ) |
| Value any = pop_value(vm) |
Definition at line 48 of file stringify.c.
| break |
Definition at line 52 of file stringify.c.
| case OP_JSON_STRINGIFY |
Definition at line 32 of file stringify.c.