diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-06-16 15:12:00 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-06-16 15:12:00 -0400 |
| commit | 7a53e10826e583b4fc00d032eeecada2cf19e9e2 (patch) | |
| tree | 1acc23774ce1accf83ba28151b33eedc67d8b242 /structs.c | |
| parent | 729d856139567d8ab458f24e10a8e714251deff1 (diff) | |
Fix issue with type namespaces not getting properly prefixed by library
namespace
Diffstat (limited to 'structs.c')
| -rw-r--r-- | structs.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -14,7 +14,7 @@ static CORD compile_str_method(env_t *env, ast_t *ast) { auto def = Match(ast, StructDef); - CORD full_name = CORD_cat(env->file_prefix, def->name); + CORD full_name = CORD_cat(namespace_prefix(env->namespace), def->name); const char *name = def->name; const char *dollar = strrchr(name, '$'); if (dollar) name = dollar + 1; @@ -39,7 +39,7 @@ static CORD compile_str_method(env_t *env, ast_t *ast) static CORD compile_compare_method(env_t *env, ast_t *ast) { auto def = Match(ast, StructDef); - CORD full_name = CORD_cat(env->file_prefix, def->name); + CORD full_name = CORD_cat(namespace_prefix(env->namespace), def->name); CORD cmp_func = CORD_all("static int ", full_name, "$compare(const ", full_name, "_t *x, const ", full_name, "_t *y, const TypeInfo *info) {\n" "(void)info;\n", @@ -67,7 +67,7 @@ static CORD compile_compare_method(env_t *env, ast_t *ast) static CORD compile_equals_method(env_t *env, ast_t *ast) { auto def = Match(ast, StructDef); - CORD full_name = CORD_cat(env->file_prefix, def->name); + CORD full_name = CORD_cat(namespace_prefix(env->namespace), def->name); CORD eq_func = CORD_all("static bool ", full_name, "$equal(const ", full_name, "_t *x, const ", full_name, "_t *y, const TypeInfo *info) {\n" "(void)info;\n"); @@ -96,7 +96,7 @@ static CORD compile_equals_method(env_t *env, ast_t *ast) static CORD compile_hash_method(env_t *env, ast_t *ast) { auto def = Match(ast, StructDef); - CORD full_name = CORD_cat(env->file_prefix, def->name); + CORD full_name = CORD_cat(namespace_prefix(env->namespace), def->name); CORD hash_func = CORD_all("static uint32_t ", full_name, "$hash(const ", full_name, "_t *obj, const TypeInfo *info) {\n" "(void)info;\n" "uint32_t field_hashes[] = {"); @@ -114,7 +114,7 @@ static CORD compile_hash_method(env_t *env, ast_t *ast) void compile_struct_def(env_t *env, ast_t *ast) { auto def = Match(ast, StructDef); - CORD full_name = CORD_cat(env->file_prefix, def->name); + CORD full_name = CORD_cat(namespace_prefix(env->namespace), def->name); type_t *t = Table$str_get(*env->types, def->name); assert(t && t->tag == StructType); @@ -165,7 +165,7 @@ void compile_struct_def(env_t *env, ast_t *ast) CORD compile_struct_header(env_t *env, ast_t *ast) { auto def = Match(ast, StructDef); - CORD full_name = CORD_cat(env->file_prefix, def->name); + CORD full_name = CORD_cat(namespace_prefix(env->namespace), def->name); CORD header = CORD_all("typedef struct ", full_name, "_s ", full_name, "_t;\n"); CORD struct_code = CORD_all("struct ", full_name, "_s {\n"); |
