aboutsummaryrefslogtreecommitdiff
path: root/types.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-10-08 13:35:18 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-10-08 13:35:18 -0400
commit954ed42934ad76ac101b27b6ff06be383ad5dcd2 (patch)
treef0757e0e9bb87845d961be52a49c8f894e23e14c /types.c
parent6b9055db7c03c09654c0605b96a37d50bf563fa9 (diff)
Simplify enum/struct codegen by using reusable general-purpose
metamethods for structs/enums instead of metamethod codegen for each struct/enum defined.
Diffstat (limited to 'types.c')
-rw-r--r--types.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/types.c b/types.c
index 17009f9e..a0e347ca 100644
--- a/types.c
+++ b/types.c
@@ -431,7 +431,7 @@ PUREFUNC size_t type_size(type_t *t)
type_t *nonnull = Match(t, OptionalType)->type;
switch (nonnull->tag) {
case IntType:
- switch (Match(t, IntType)->bits) {
+ switch (Match(nonnull, IntType)->bits) {
case TYPE_IBITS64: return sizeof(OptionalInt64_t);
case TYPE_IBITS32: return sizeof(OptionalInt32_t);
case TYPE_IBITS16: return sizeof(OptionalInt16_t);
@@ -511,7 +511,7 @@ PUREFUNC size_t type_align(type_t *t)
type_t *nonnull = Match(t, OptionalType)->type;
switch (nonnull->tag) {
case IntType:
- switch (Match(t, IntType)->bits) {
+ switch (Match(nonnull, IntType)->bits) {
case TYPE_IBITS64: return __alignof__(OptionalInt64_t);
case TYPE_IBITS32: return __alignof__(OptionalInt32_t);
case TYPE_IBITS16: return __alignof__(OptionalInt16_t);