summaryrefslogtreecommitdiff
path: root/compiler.c
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2024-03-26 01:23:14 -0400
committerKyle Gunger <kgunger12@gmail.com>2024-03-26 01:23:14 -0400
commit7c1c14f592f854ed58385005a27230617d8ba6b2 (patch)
tree23f98c8f93c4e394e7e4dbfbacbfc0b0696c7799 /compiler.c
parent89a27e4159b2b01be96b5f8ca51832766e878c51 (diff)
naming fixes
Diffstat (limited to 'compiler.c')
-rw-r--r--compiler.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/compiler.c b/compiler.c
index cd6709d..24359d9 100644
--- a/compiler.c
+++ b/compiler.c
@@ -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++) {