From 2158bb97fc2a9744c5ed1bf4b5cd056498904925 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Wed, 18 Sep 2024 01:01:15 -0400 Subject: Clean up struct code a bit --- compile.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'compile.c') diff --git a/compile.c b/compile.c index 89948455..f836cee0 100644 --- a/compile.c +++ b/compile.c @@ -833,10 +833,8 @@ CORD compile_statement(env_t *env, ast_t *ast) ") Table$remove(&cache, cache.entries.data + cache.entries.stride*Int$random(I(0), I(cache.entries.length-1)), table_type);\n"); } - CORD arg_typedef = compile_struct_typedef(env, args_def); + CORD arg_typedef = compile_struct_header(env, args_def); env->code->local_typedefs = CORD_all(env->code->local_typedefs, arg_typedef); - env->code->staticdefs = CORD_all(env->code->staticdefs, - "extern const TypeInfo ", namespace_prefix(env->libname, env->namespace), arg_type_name, ";\n"); CORD wrapper = CORD_all( is_private ? CORD_EMPTY : "public ", ret_type_code, " ", name, arg_signature, "{\n" "static Table_t cache = {};\n", @@ -3803,12 +3801,7 @@ CORD compile_statement_header(env_t *env, ast_t *ast) } } case StructDef: { - auto def = Match(ast, StructDef); - CORD full_name = CORD_cat(namespace_prefix(env->libname, env->namespace), def->name); - return CORD_all( - compile_struct_typedef(env, ast), - "extern const TypeInfo ", full_name, ";\n", - compile_namespace_header(env, def->name, def->namespace)); + return compile_struct_header(env, ast); } case EnumDef: { return compile_enum_header(env, ast); -- cgit v1.2.3