diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-12-06 14:55:00 -0500 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-12-06 14:55:00 -0500 |
| commit | 48491f94c96615e8055bcf72ed9009b1d921467f (patch) | |
| tree | b30b934d71ca14a7f9602282c35d2f2c137d902a /src/types.c | |
| parent | a13b39f1e1ea220a868d99508796d06492a40611 (diff) | |
Use `foo!` as sugar for `foo.FirstTag!` for enum values. Also, give
better error messages for this kind of `!` assertion.
Diffstat (limited to 'src/types.c')
| -rw-r--r-- | src/types.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/types.c b/src/types.c index 6ed24f6c..b34d8bf9 100644 --- a/src/types.c +++ b/src/types.c @@ -63,7 +63,7 @@ Text_t type_to_text(type_t *t) { } case StructType: { DeclareMatch(struct_, t, StructType); - return Text$from_str(struct_->name); + return Text$replace(Text$from_str(struct_->name), Text("$"), Text(".")); } case PointerType: { DeclareMatch(ptr, t, PointerType); @@ -73,7 +73,7 @@ Text_t type_to_text(type_t *t) { case EnumType: { DeclareMatch(enum_, t, EnumType); if (enum_->name != NULL && strncmp(enum_->name, "enum$", strlen("enum$")) != 0) - return Text$from_str(enum_->name); + return Text$replace(Text$from_str(enum_->name), Text("$"), Text(".")); Text_t text = Text("enum("); for (tag_t *tag = enum_->tags; tag; tag = tag->next) { text = Texts(text, Text$from_str(tag->name)); |
