better comments in generated code
This commit is contained in:
@@ -95,6 +95,7 @@ public class QBEGenerator
|
||||
%size =l loadl %array
|
||||
ret %size
|
||||
}
|
||||
|
||||
""");
|
||||
|
||||
_writer.Comment("========== Referenced structs ==========");
|
||||
@@ -113,7 +114,6 @@ public class QBEGenerator
|
||||
EmitStructDefinition(structDef);
|
||||
}
|
||||
|
||||
_writer.NewLine();
|
||||
_writer.Comment("========== Function definitions ==========");
|
||||
|
||||
foreach (var funcDef in _definitions.OfType<FuncNode>())
|
||||
@@ -121,7 +121,6 @@ public class QBEGenerator
|
||||
EmitFuncDefinition(funcDef);
|
||||
}
|
||||
|
||||
_writer.NewLine();
|
||||
_writer.Comment("========== cstring literals ==========");
|
||||
|
||||
foreach (var cStringLiteral in _cStringLiterals)
|
||||
@@ -393,7 +392,7 @@ public class QBEGenerator
|
||||
|
||||
private void EmitStructDefinition(StructNode structDef)
|
||||
{
|
||||
_writer.Comment($" ===== {structDef.Module}::{structDef.Name} =====");
|
||||
_writer.Comment($"{structDef.Module}::{structDef.Name}");
|
||||
_writer.WriteLine($"export function {StructCtorName(structDef.Module, structDef.Name)}(l %struct) {{");
|
||||
_writer.WriteLine("@start");
|
||||
|
||||
@@ -410,14 +409,14 @@ public class QBEGenerator
|
||||
|
||||
_writer.Indented("ret");
|
||||
_writer.WriteLine("}");
|
||||
_writer.NewLine();
|
||||
|
||||
foreach (var function in structDef.Functions)
|
||||
{
|
||||
_writer.Comment($" ===== {structDef.Module}::{structDef.Name}.{function.Name} =====");
|
||||
_writer.Comment($"{structDef.Module}::{structDef.Name}.{function.Name}");
|
||||
_labelIndex = 0;
|
||||
_tmpIndex = 0;
|
||||
|
||||
_writer.NewLine();
|
||||
_writer.Write("export function ");
|
||||
|
||||
if (function.Signature.ReturnType is not VoidTypeNode)
|
||||
@@ -445,6 +444,7 @@ public class QBEGenerator
|
||||
}
|
||||
|
||||
_writer.WriteLine("}");
|
||||
_writer.NewLine();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -482,6 +482,7 @@ public class QBEGenerator
|
||||
}
|
||||
|
||||
_writer.WriteLine("}");
|
||||
_writer.NewLine();
|
||||
}
|
||||
|
||||
private void EmitBlock(BlockNode block)
|
||||
|
||||
Reference in New Issue
Block a user