summaryrefslogtreecommitdiff
path: root/tnslc/compile/module.tnsl
diff options
context:
space:
mode:
authorKai Gunger <kgunger12@gmail.com>2025-12-08 21:59:55 -0500
committerKai Gunger <kgunger12@gmail.com>2025-12-08 21:59:55 -0500
commit38723762d5e3c61dab16d6e40bc905b53e21baca (patch)
treea8a3211b089f837d78ac5de714cb83b97262c0ea /tnslc/compile/module.tnsl
parent8bb2e3bdb00341dcd8b6fd4d272b2c96a708acb3 (diff)
fix memory issues with type resolution
Diffstat (limited to 'tnslc/compile/module.tnsl')
-rw-r--r--tnslc/compile/module.tnsl22
1 files changed, 15 insertions, 7 deletions
diff --git a/tnslc/compile/module.tnsl b/tnslc/compile/module.tnsl
index eb7ce47..a60533a 100644
--- a/tnslc/compile/module.tnsl
+++ b/tnslc/compile/module.tnsl
@@ -44,20 +44,29 @@ struct Module {
self.e = mod`._type == parse.NTYPE_EXPORT
self._from_tree(mod, buf)
-
- ~Module sub
- /; loop (int i = 0; i < self.subs.count) [i++]
- sub = self.subs.get(i)
- sub`.update_children()
- ;/
;/
/; update_children
~Module sub
/; loop (int i = 0; i < self.subs.count) [i++]
sub = self.subs.get(i)
+ sub`.update_children()
sub`.parent = ~self
;/
+
+ ~Struct str
+ utils.Vector n
+ /; loop (int i = 0; i < self.structs.count) [i++]
+ str = self.structs.get(i)
+
+ n.from_cstr("_#\0")
+ n.push_cstr(str`.name)
+
+ sub = self._find_sub(n.as_cstr())
+ str`.methods = sub
+
+ n.end()
+ ;/
;/
/; _create_methods (~uint8 name) [~Module]
@@ -95,7 +104,6 @@ struct Module {
~Module m = self._create_methods(sub`.data)
Struct s
s.init(sub)
- s.methods = m
self.structs.push(~s)
;; else if (sub`._type == parse.NTYPE_FUNCTION)
Function f