From 87785555eca3b7166d5f1af658a08f58a64340ed Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Tue, 23 Jul 2024 19:46:42 -0400 Subject: Fix for order of operations issues with enum and function typedef code --- structs.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'structs.c') diff --git a/structs.c b/structs.c index 22965b72..80049cdc 100644 --- a/structs.c +++ b/structs.c @@ -165,11 +165,11 @@ void compile_struct_def(env_t *env, ast_t *ast) compile_namespace(env, def->name, def->namespace); } -CORD compile_struct_header(env_t *env, ast_t *ast) +CORD compile_struct_typedef(env_t *env, ast_t *ast) { auto def = Match(ast, StructDef); CORD full_name = CORD_cat(namespace_prefix(env->libname, env->namespace), def->name); - CORD header = CORD_all("typedef struct ", full_name, "_s ", full_name, "_t;\n"); + CORD code = CORD_all("typedef struct ", full_name, "_s ", full_name, "_t;\n"); CORD struct_code = CORD_all("struct ", full_name, "_s {\n"); for (arg_ast_t *field = def->fields; field; field = field->next) { @@ -179,10 +179,8 @@ CORD compile_struct_header(env_t *env, ast_t *ast) CORD_cmp(type_code, "Bool_t") ? "" : ":1"); } struct_code = CORD_all(struct_code, "};\n"); - header = CORD_all(header, struct_code); - header = CORD_all(header, "extern const TypeInfo ", full_name, ";\n"); - header = CORD_all(header, compile_namespace_headers(env, def->name, def->namespace)); - return header; + code = CORD_all(code, struct_code); + return code; } // vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1,\:0 -- cgit v1.2.3