diff options
author | Kyle Gunger <kgunger12@gmail.com> | 2024-03-26 01:23:14 -0400 |
---|---|---|
committer | Kyle Gunger <kgunger12@gmail.com> | 2024-03-26 01:23:14 -0400 |
commit | 7c1c14f592f854ed58385005a27230617d8ba6b2 (patch) | |
tree | 23f98c8f93c4e394e7e4dbfbacbfc0b0696c7799 | |
parent | 89a27e4159b2b01be96b5f8ca51832766e878c51 (diff) |
naming fixes
-rw-r--r-- | compiler.c | 21 |
1 files changed, 15 insertions, 6 deletions
@@ -2374,15 +2374,22 @@ char *mod_full_path(Module *m) { return vect_as_string(&out); } -char *mod_label_prefix(Module *m) { - Vector out = vect_from_string(""); - - while (m->parent != NULL) { - vect_push_string(&out, m->name); +Vector _mod_label_prefix(Module *m) { + if (m == NULL) { + Vector out = vect_from_string(""); + return out; + } + + Vector out = _mod_label_prefix(m->parent); + vect_push_string(&out, m->name); + if (out.count > 0) { vect_push_string(&out, "."); - m = m->parent; } + return out; +} +char *mod_label_prefix(Module *m) { + Vector out = _mod_label_prefix(m); return vect_as_string(&out); } @@ -3905,6 +3912,8 @@ void p1_resolve_types(Module *root) { for(size_t i = 0; i < root->submods.count; i++) { p1_resolve_types(vect_get(&root->submods, i)); + Module *s = vect_get(&root->submods, i); + s->parent = root; } for(size_t i = 0; i < root->funcs.count; i++) { |