aboutsummaryrefslogtreecommitdiff
path: root/structs.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-02-19 16:30:19 -0500
committerBruce Hill <bruce@bruce-hill.com>2025-02-19 16:30:19 -0500
commitb89291957acbefbb0e9db90421411094ebc6aed8 (patch)
treef37c2e971b1322b7e80c3bb8b163fadd16772441 /structs.c
parentc4479e4bd61fb2c68fdac2637a20d6d99f7b9552 (diff)
Restructure compile_file() so it moves a bit more towards less usage of
side effects
Diffstat (limited to 'structs.c')
-rw-r--r--structs.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/structs.c b/structs.c
index 7c652678..f4361148 100644
--- a/structs.c
+++ b/structs.c
@@ -12,7 +12,7 @@
#include "typecheck.h"
#include "stdlib/util.h"
-void compile_struct_def(env_t *env, ast_t *ast)
+CORD compile_struct_typeinfo(env_t *env, ast_t *ast)
{
auto def = Match(ast, StructDef);
CORD full_name = CORD_cat(namespace_prefix(env, env->namespace), def->name);
@@ -41,10 +41,7 @@ void compile_struct_def(env_t *env, ast_t *ast)
}
typeinfo = CORD_all(typeinfo, "}");
}
- typeinfo = CORD_all(typeinfo, "};\n");
- env->code->typeinfos = CORD_all(env->code->typeinfos, typeinfo);
-
- compile_namespace(env, def->name, def->namespace);
+ return CORD_all(typeinfo, "};\n");
}
CORD compile_struct_header(env_t *env, ast_t *ast)