From 38723762d5e3c61dab16d6e40bc905b53e21baca Mon Sep 17 00:00:00 2001 From: Kai Gunger Date: Mon, 8 Dec 2025 21:59:55 -0500 Subject: fix memory issues with type resolution --- tnslc/compile/module.tnsl | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'tnslc/compile/module.tnsl') 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 -- cgit v1.2.3