diff options
| author | Kai Gunger <kgunger12@gmail.com> | 2026-05-01 02:09:47 -0400 |
|---|---|---|
| committer | Kai Gunger <kgunger12@gmail.com> | 2026-05-01 02:09:47 -0400 |
| commit | 1de32dbcac6a7a9756df034b914a4a836ca5bbac (patch) | |
| tree | 764736f8ac02ca41a0650fc45cdad02820742be9 /tnslc/compile/module.tnsl | |
| parent | edba04ae6266536cf7285570eb31245298a5123f (diff) | |
[tnslc] self in method
Diffstat (limited to 'tnslc/compile/module.tnsl')
| -rw-r--r-- | tnslc/compile/module.tnsl | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/tnslc/compile/module.tnsl b/tnslc/compile/module.tnsl index 17e4984..d3deb2f 100644 --- a/tnslc/compile/module.tnsl +++ b/tnslc/compile/module.tnsl @@ -96,17 +96,40 @@ struct Module { return false ;/ - /; if (self.name{0} !== '_') + ~uint8 name = self.name + + /; if (name{0} !== '_') return false - ;; else if (self.name{1} !== '#') + ;; else if (name{1} !== '#') return false - ;; else if (self.name{2} == '#') + ;; else if (name{2} == '#') return false ;/ return true ;/ + /; related_type [~Struct] + /; if (self.is_method() == false) + return NULL + ;/ + + ~Module m = self.parent + ~Module match = ~self + ~Struct s + /; loop (int i = 0; i < m`.structs.count) [i++] + s = m`.structs.get(i) + /; if (s`.methods == match) + return s + ;/ + ;/ + + _printf("COMPILER ERROR: UNABLE to find a sutable struct for module \"\0") + _printf(self.name) + _printf("\"\n\0") + return NULL + ;/ + /; _from_tree (~parse.Node mod, ~CompBuf buf) ~parse.Node sub /; loop (int i = 0; i < mod`.sub.count) [i++] |