This commit is contained in:
nub31
2025-09-12 23:36:10 +02:00
parent b900c706ef
commit 46432d2f8e

View File

@@ -95,7 +95,7 @@ public class QBEGenerator
%size =l loadl %array %size =l loadl %array
ret %size ret %size
} }
"""); """);
_writer.Comment("========== Referenced structs =========="); _writer.Comment("========== Referenced structs ==========");
@@ -355,6 +355,8 @@ public class QBEGenerator
private void EmitStructType(StructTypeNode structType) private void EmitStructType(StructTypeNode structType)
{ {
// todo(nub31): qbe expects structs to be declared in order. We must Check the dependencies of the struct to see if a type need to be declared before this one
// qbe allows multiple declarations of the same struct, but we should keep track and only emit an new one if necessary
_writer.Write($"type {StructTypeName(structType.Module, structType.Name)} = {{ "); _writer.Write($"type {StructTypeName(structType.Module, structType.Name)} = {{ ");
foreach (var field in structType.Fields) foreach (var field in structType.Fields)