diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-09-21 15:14:37 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-09-21 15:14:37 -0400 |
| commit | f5612e38183dc20d18f207f8ab055574a4d93ad0 (patch) | |
| tree | c2caf5a0311b6d9fd0fbd4c08493dac5981088be /src/compile/enums.c | |
| parent | 7f6683269ce689a83b9c6e1fae15e0cc60351095 (diff) | |
Bugfixes for anonymous enums, code cleanup to remove type_to_string(),
and changed it so anonymous enums show up in doctests with their full
type instead of `enum$20`
Diffstat (limited to 'src/compile/enums.c')
| -rw-r--r-- | src/compile/enums.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/compile/enums.c b/src/compile/enums.c index f8a3994e..ec7a1755 100644 --- a/src/compile/enums.c +++ b/src/compile/enums.c @@ -30,7 +30,7 @@ Text_t compile_enum_typeinfo(env_t *env, const char *name, tag_ast_t *tags) { Text_t info = namespace_name(env, env->namespace, Texts(name, "$$info")); Text_t typeinfo = Texts("public const TypeInfo_t ", info, " = {", (int64_t)type_size(t), "u, ", (int64_t)type_align(t), - "u, .metamethods=", metamethods, ", {.tag=EnumInfo, .EnumInfo={.name=\"", name, + "u, .metamethods=", metamethods, ", {.tag=EnumInfo, .EnumInfo={.name=\"", type_to_text(t), "\", " ".num_tags=", (int64_t)num_tags, ", .tags=(NamedType_t[]){"); @@ -78,6 +78,7 @@ Text_t compile_enum_header(env_t *env, const char *name, tag_ast_t *tags) { Text_t none_name = namespace_name(env, env->namespace, Texts(name, "$none")); Text_t enum_name = namespace_name(env, env->namespace, Texts(name, "$$enum")); Text_t enum_tags = Texts("{ ", none_name, "=0, "); + assert(Table$str_get(*env->types, name)); bool has_any_tags_with_fields = false; for (tag_ast_t *tag = tags; tag; tag = tag->next) { @@ -167,5 +168,5 @@ Text_t compile_enum_field_access(env_t *env, ast_t *ast) { } } } - code_err(ast, "The field '", f->field, "' is not a valid tag name of ", type_to_str(value_t)); + code_err(ast, "The field '", f->field, "' is not a valid tag name of ", type_to_text(value_t)); } |
