From 954ed42934ad76ac101b27b6ff06be383ad5dcd2 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Tue, 8 Oct 2024 13:35:18 -0400 Subject: Simplify enum/struct codegen by using reusable general-purpose metamethods for structs/enums instead of metamethod codegen for each struct/enum defined. --- types.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'types.c') 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); -- cgit v1.2.3