diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-02-19 16:30:19 -0500 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-02-19 16:30:19 -0500 |
| commit | b89291957acbefbb0e9db90421411094ebc6aed8 (patch) | |
| tree | f37c2e971b1322b7e80c3bb8b163fadd16772441 /structs.c | |
| parent | c4479e4bd61fb2c68fdac2637a20d6d99f7b9552 (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.c | 7 |
1 files changed, 2 insertions, 5 deletions
@@ -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) |
