summaryrefslogtreecommitdiff
path: root/tnslc/compile/struct.tnsl
diff options
context:
space:
mode:
authorCircleShift <kgunger12@gmail.com>2025-12-05 01:58:03 -0500
committerCircleShift <kgunger12@gmail.com>2025-12-05 01:58:03 -0500
commit062aefd6aa7cda6a30ae557f4813a2a967b49596 (patch)
treed87bae11b5ccc8b5400744489da93dee9aac18c7 /tnslc/compile/struct.tnsl
parent5b81a4819a249921085f6596927f9939dffc46e7 (diff)
[tnslc] Fix struct resolution
Diffstat (limited to 'tnslc/compile/struct.tnsl')
-rw-r--r--tnslc/compile/struct.tnsl21
1 files changed, 12 insertions, 9 deletions
diff --git a/tnslc/compile/struct.tnsl b/tnslc/compile/struct.tnsl
index 45f85d3..780e8ad 100644
--- a/tnslc/compile/struct.tnsl
+++ b/tnslc/compile/struct.tnsl
@@ -149,13 +149,13 @@ struct Struct {
return
;/
- /; if (ft`.size == 0)
- # Recurse
- ft`._compute_size(parent)
- ;/
-
/; if (ft`.size < 0)
# Cyclical dependency
+ _printf("ERROR: Cyclic struct definition: '\0")
+ _printf(ft`.name)
+ _printf("' imported from '\0")
+ _printf(self.name)
+ _printf("'\n\0")
return
;/
@@ -198,10 +198,13 @@ struct Struct {
# Find struct and compute its size
~Struct out = parent`.find(SEARCH_STRUCT, ~sv)
- sv.pop()
- ~Module outp = parent
- /; if (sv.count !== 0)
- outp = parent`.find(SEARCH_SUB, ~sv)
+ /; if (out !== NULL && out`.size == 0)
+ sv.pop()
+ ~Module outp = parent
+ /; if (sv.count !== 0)
+ outp = parent`.find(SEARCH_SUB, ~sv)
+ ;/
+ out`._compute_size(outp)
;/
sv.end()
return out