aboutsummaryrefslogtreecommitdiff
path: root/src/types.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-09-20 14:07:26 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-09-20 14:26:08 -0400
commitb9a8ddea2c0b5f170e461b9216eb14f2d86588eb (patch)
treecb45901e3046b3d28823df9c85a719a38981804d /src/types.c
parente937e3056b934c6d426abc3db8de1c99433a434b (diff)
WIP on inline enums
Diffstat (limited to 'src/types.c')
-rw-r--r--src/types.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/types.c b/src/types.c
index b0caca1a..a670f212 100644
--- a/src/types.c
+++ b/src/types.c
@@ -67,8 +67,22 @@ Text_t type_to_text(type_t *t) {
return Texts(sigil, type_to_text(ptr->pointed));
}
case EnumType: {
- DeclareMatch(tagged, t, EnumType);
- return Text$from_str(tagged->name);
+ DeclareMatch(enum_, t, EnumType);
+ return Text$from_str(enum_->name);
+ // Text_t text = Text("enum(");
+ // for (tag_t *tag = enum_->tags; tag; tag = tag->next) {
+ // text = Texts(text, Text$from_str(tag->name));
+ // if (tag->type && Match(tag->type, StructType)->fields) {
+ // text = Texts(text, "(");
+ // for (arg_t *field = Match(tag->type, StructType)->fields; field; field = field->next) {
+ // text = Texts(text, Text$from_str(field->name), ":", type_to_text(field->type));
+ // if (field->next) text = Texts(text, ", ");
+ // }
+ // text = Texts(text, ")");
+ // }
+ // if (tag->next) text = Texts(text, ", ");
+ // }
+ // return enum_->name ? Text$from_str(enum_->name) : Text("enum");
}
case OptionalType: {
type_t *opt = Match(t, OptionalType)->type;