Bit of cleanup
This commit is contained in:
@@ -347,8 +347,10 @@ public partial class QBEGenerator
|
||||
var parameterStrings = parameters.Select(x => FuncQBETypeName(x.Type) + $" %{x.Name}");
|
||||
|
||||
builder.Append($"({string.Join(", ", parameterStrings)})");
|
||||
builder.AppendLine(" {");
|
||||
builder.Append("@start");
|
||||
|
||||
_writer.StartFunction(builder.ToString());
|
||||
_writer.WriteLine(builder.ToString());
|
||||
|
||||
var scope = new Scope();
|
||||
|
||||
@@ -361,14 +363,11 @@ public partial class QBEGenerator
|
||||
|
||||
// Implicit return for void functions if no explicit return has been set
|
||||
if (returnType is VoidTypeNode && body.Statements is [.., not ReturnNode])
|
||||
{
|
||||
if (returnType is VoidTypeNode)
|
||||
{
|
||||
_writer.Indented("ret");
|
||||
}
|
||||
}
|
||||
|
||||
_writer.EndFunction();
|
||||
_writer.WriteLine("}");
|
||||
}
|
||||
|
||||
private void EmitStructDefinition(StructNode structDef)
|
||||
|
||||
@@ -6,18 +6,6 @@ internal class QBEWriter
|
||||
{
|
||||
private readonly StringBuilder _builder = new();
|
||||
|
||||
public void StartFunction(string signature)
|
||||
{
|
||||
_builder.Append(signature);
|
||||
_builder.AppendLine(" {");
|
||||
_builder.AppendLine("@start");
|
||||
}
|
||||
|
||||
public void EndFunction()
|
||||
{
|
||||
_builder.AppendLine("}");
|
||||
}
|
||||
|
||||
public void Indented(string value)
|
||||
{
|
||||
_builder.Append('\t');
|
||||
|
||||
Reference in New Issue
Block a user