This commit is contained in:
nub31
2025-06-14 19:00:45 +02:00
parent d57d95ec8e
commit 04fb47ef32
8 changed files with 27 additions and 26 deletions

View File

@@ -13,8 +13,6 @@ namespace Generation.QBE;
public static class QBEGenerator
{
private const string OutOfBoundsMessage = "Index is out of bounds\\n";
private static CompilationUnit _compilationUnit = null!;
private static DefinitionTable _definitionTable = null!;
@@ -65,12 +63,9 @@ public static class QBEGenerator
_builder.AppendLine();
}
_builder.AppendLine($"data $oob_message = {{ b \"{OutOfBoundsMessage}\" }}");
for (var i = 0; i < _strings.Count; i++)
{
var str = _strings[i];
_builder.AppendLine($"data $string{i + 1} = {{ b \"{str}\", b 0 }}");
_builder.AppendLine($"data $string{i + 1} = {{ b \"{_strings[i]}\", b 0 }}");
}
return _builder.ToString();
@@ -806,7 +801,7 @@ public static class QBEGenerator
_builder.AppendLine($" jnz {anyOobName}, {oobLabel}, {notOobLabel}");
_builder.AppendLine(oobLabel);
_builder.AppendLine($" call $nub_panic(l $oob_message, l {OutOfBoundsMessage.Length})");
_builder.AppendLine($" call $nub_panic_array_oob()");
_builder.AppendLine(notOobLabel);
}
@@ -1146,7 +1141,6 @@ public static class QBEGenerator
}
}
private static string GenerateStructInitializer(StructInitializerNode structInitializer)
{
var structDefinition = _definitionTable.LookupStruct(structInitializer.StructType.Namespace, structInitializer.StructType.Name).GetValue();