aboutsummaryrefslogtreecommitdiff
path: root/src/compile/files.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-09-21 15:14:37 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-09-21 15:14:37 -0400
commitf5612e38183dc20d18f207f8ab055574a4d93ad0 (patch)
treec2caf5a0311b6d9fd0fbd4c08493dac5981088be /src/compile/files.c
parent7f6683269ce689a83b9c6e1fae15e0cc60351095 (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/files.c')
-rw-r--r--src/compile/files.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/compile/files.c b/src/compile/files.c
index 7ff252c2..bd1e9cc3 100644
--- a/src/compile/files.c
+++ b/src/compile/files.c
@@ -111,7 +111,7 @@ Text_t compile_top_level_code(env_t *env, ast_t *ast) {
code_err(ast,
"Conversions are only supported for text, struct, and enum "
"types, not ",
- type_to_str(type));
+ type_to_text(type));
Text_t name_code =
namespace_name(env, env->namespace, Texts(name, "$", get_line_number(ast->file, ast->start)));
return compile_function(env, name_code, ast, &env->code->staticdefs);
@@ -170,6 +170,8 @@ typedef struct {
static void add_type_infos(type_ast_t *type_ast, void *userdata) {
if (type_ast && type_ast->tag == EnumTypeAST) {
compile_info_t *info = (compile_info_t *)userdata;
+ // Force the type to get defined:
+ (void)parse_type_ast(info->env, type_ast);
*info->code = Texts(
*info->code,
compile_enum_typeinfo(info->env, String("enum$", (int64_t)(type_ast->start - type_ast->file->text)),