| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "gwion_util.h" | ||
| 2 | #include "gwion_ast.h" | ||
| 3 | #include "gwion_env.h" | ||
| 4 | #include "vm.h" | ||
| 5 | #include "gwion.h" | ||
| 6 | #include "instr.h" | ||
| 7 | #include "object.h" | ||
| 8 | #include "operator.h" | ||
| 9 | #include "import.h" | ||
| 10 | #include "gwi.h" | ||
| 11 | #include "gack.h" | ||
| 12 | |||
| 13 | 10 | static GACK(gack_enum) { | |
| 14 | 10 | const Map m = &t->nspc->info->value->map; | |
| 15 | 10 | const m_uint value = *(m_uint*)VALUE; | |
| 16 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
10 | if(value < map_size(m)) { |
| 17 | 10 | const Value v = (Value)map_at(&t->nspc->info->value->map, *(m_uint*)VALUE); | |
| 18 | 10 | INTERP_PRINTF("%s", v->name); | |
| 19 | } else | ||
| 20 | ✗ | INTERP_PRINTF("%s", t->name); | |
| 21 | 10 | } | |
| 22 | |||
| 23 | 638 | GWION_IMPORT(enum) { | |
| 24 | 638 | const Type t_enum = gwi_mk_type(gwi, "enum", SZ_INT, "int"); | |
| 25 | 638 | gwi_set_global_type(gwi, t_enum, et_enum); | |
| 26 | 638 | gwi_gack(gwi, t_enum, gack_enum); | |
| 27 | 638 | return GW_OK; | |
| 28 | } | ||
| 29 |