From 85d1507d8b7e0139135e040b7b4b23c02097a155 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 7 Dec 2025 18:44:58 -0500 Subject: Consolidate logic for enums with and without tags with fields. --- src/types.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'src/types.c') diff --git a/src/types.c b/src/types.c index b34d8bf9..e3bf326c 100644 --- a/src/types.c +++ b/src/types.c @@ -701,8 +701,7 @@ type_t *get_field_type(type_t *t, const char *field_name) { DeclareMatch(e, t, EnumType); for (tag_t *tag = e->tags; tag; tag = tag->next) { if (!streq(field_name, tag->name)) continue; - if (tag->type != NULL && Match(tag->type, StructType)->fields) return Type(OptionalType, tag->type); - else return Type(OptionalType, EMPTY_TYPE); + return Type(OptionalType, tag->type); } return NULL; } @@ -835,10 +834,3 @@ type_t *_make_function_type(type_t *ret, int n, arg_t args[n]) { } return Type(FunctionType, .ret = ret, .args = &arg_pointers[0]); } - -PUREFUNC bool enum_has_fields(type_t *t) { - for (tag_t *e_tag = Match(t, EnumType)->tags; e_tag; e_tag = e_tag->next) { - if (e_tag->type != NULL && Match(e_tag->type, StructType)->fields) return true; - } - return false; -} -- cgit v1.2.3