diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-08-18 20:58:36 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-08-18 20:58:36 -0400 |
| commit | 6f3b2c073a968e57d787849dce42ff1253ed0102 (patch) | |
| tree | e5fb20ae4322fdbbded412c2cb771b7e4ed68ecf /types.c | |
| parent | 967b649da20f1cb2011025456853cb55f25e9a88 (diff) | |
Add `enum.tag` as a way to do a boolean test for whether a value has a
particular tag or not
Diffstat (limited to 'types.c')
| -rw-r--r-- | types.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -594,6 +594,14 @@ type_t *get_field_type(type_t *t, const char *field_name) } return NULL; } + case EnumType: { + auto e = Match(t, EnumType); + for (tag_t *tag = e->tags; tag; tag = tag->next) { + if (streq(field_name, tag->name)) + return Type(BoolType); + } + return NULL; + } case SetType: { if (streq(field_name, "length")) return INT_TYPE; |
