commit 4c589689bdb1818a767f87fa51727916a1c90008 parent 425cf416fdff00fd7918b214696c04a6bd470bef Author: Eyal Sawady <ecs@d2evs.net> Date: Fri, 11 Dec 2020 23:42:40 -0500 type_storage_unparse: unparse all type storages Also replace the `default: assert(0)` with an assert(0) at the end to help the compiler catch errors for us Diffstat:
M | src/types.c | | | 61 | +++++++++++++++++++++++++++++++++++++++++-------------------- |
1 file changed, 41 insertions(+), 20 deletions(-)
diff --git a/src/types.c b/src/types.c @@ -5,39 +5,60 @@ const char * type_storage_unparse(enum type_storage storage) { switch (storage) { - case TYPE_STORAGE_U8: - return "u8"; - case TYPE_STORAGE_U16: - return "u16"; - case TYPE_STORAGE_U32: - return "u32"; - case TYPE_STORAGE_U64: - return "u64"; - case TYPE_STORAGE_I8: - return "i8"; + case TYPE_STORAGE_ALIAS: + return "alias"; + case TYPE_STORAGE_ARRAY: + return "array"; + case TYPE_STORAGE_BOOL: + return "bool"; + case TYPE_STORAGE_CHAR: + return "char"; + case TYPE_STORAGE_F32: + return "f32"; + case TYPE_STORAGE_F64: + return "f64"; + case TYPE_STORAGE_FUNCTION: + return "function"; case TYPE_STORAGE_I16: return "i16"; case TYPE_STORAGE_I32: return "i32"; case TYPE_STORAGE_I64: return "i64"; + case TYPE_STORAGE_I8: + return "i8"; case TYPE_STORAGE_INT: return "int"; + case TYPE_STORAGE_POINTER: + return "pointer"; case TYPE_STORAGE_RUNE: return "rune"; - case TYPE_STORAGE_UINT: - return "uint"; - case TYPE_STORAGE_UINTPTR: - return "uintptr"; case TYPE_STORAGE_SIZE: return "size"; - case TYPE_STORAGE_F32: - return "f32"; - case TYPE_STORAGE_F64: - return "f64"; + case TYPE_STORAGE_SLICE: + return "slice"; case TYPE_STORAGE_STRING: return "str"; - default: - assert(0); + case TYPE_STORAGE_STRUCT: + return "struct"; + case TYPE_STORAGE_TAGGED_UNION: + return "tagged union"; + case TYPE_STORAGE_U16: + return "u16"; + case TYPE_STORAGE_U32: + return "u32"; + case TYPE_STORAGE_U64: + return "u64"; + case TYPE_STORAGE_U8: + return "u8"; + case TYPE_STORAGE_UINT: + return "uint"; + case TYPE_STORAGE_UINTPTR: + return "uintptr"; + case TYPE_STORAGE_UNION: + return "union"; + case TYPE_STORAGE_VOID: + return "void"; } + assert(0); }