diff --git a/builtins/types.c b/builtins/types.c index 965bb06..56826b5 100644 --- a/builtins/types.c +++ b/builtins/types.c @@ -38,8 +38,8 @@ public uint32_t generic_hash(const void *obj, const TypeInfo *type) halfsiphash(hash_values, sizeof(uint32_t)*info.members.length, SSS_HASH_VECTOR, (uint8_t*)&hash, sizeof(hash)); return hash; } - case TaggedUnionInfo: { - auto info = type->TaggedUnionInfo; + case EnumInfo: { + auto info = type->EnumInfo; int32_t tag = *(int32_t*)obj; int64_t offset = 4; typedef struct { int64_t tag; const char *name; const TypeInfo *type;} tu_member_t; @@ -95,8 +95,8 @@ public int32_t generic_compare(const void *x, const void *y, const TypeInfo *typ } return 0; } - case TaggedUnionInfo: { - auto info = type->TaggedUnionInfo; + case EnumInfo: { + auto info = type->EnumInfo; int32_t xtag = *(int32_t*)x, ytag = *(int32_t*)y; @@ -146,8 +146,8 @@ public bool generic_equal(const void *x, const void *y, const TypeInfo *type) } return true; } - case TaggedUnionInfo: { - auto info = type->TaggedUnionInfo; + case EnumInfo: { + auto info = type->EnumInfo; int32_t xtag = *(int32_t*)x, ytag = *(int32_t*)y; @@ -256,8 +256,8 @@ public CORD generic_cord(const void *obj, bool colorize, const TypeInfo *type) CORD_sprintf(&c, colorize ? "\x1b[1m%s\x1b[m%r" : "%s%r", type->name, c); return c; } - case TaggedUnionInfo: { - auto info = type->TaggedUnionInfo; + case EnumInfo: { + auto info = type->EnumInfo; int32_t tag = *(int32_t*)obj; int64_t offset = 4; typedef struct { int64_t tag; const char *name; const TypeInfo *type;} tu_member_t; diff --git a/builtins/types.h b/builtins/types.h index 72f7884..960098b 100644 --- a/builtins/types.h +++ b/builtins/types.h @@ -17,7 +17,7 @@ typedef struct TypeInfo { const char *name; int64_t size, align; struct { // Anonymous tagged union for convenience - enum { CustomInfo, PointerInfo, ArrayInfo, TableInfo, StructInfo, TaggedUnionInfo } tag; + enum { CustomInfo, PointerInfo, ArrayInfo, TableInfo, StructInfo, EnumInfo } tag; union { struct { equal_fn_t equal; @@ -42,7 +42,7 @@ typedef struct TypeInfo { } StructInfo; struct { array_t members; // [{tag, name, type}] - } TaggedUnionInfo; + } EnumInfo; }; }; } TypeInfo;