Add line number record for start of ASM line

This commit is contained in:
Yoshi Askharoun
2025-01-28 14:13:54 -06:00
parent bc1df39ed6
commit 75964d9566
+3 -1
View File
@@ -27,7 +27,7 @@ public class ObjectSection
ByteCodeWriter writer = new(); ByteCodeWriter writer = new();
_labelOffsetMap = new(); _labelOffsetMap = new();
foreach (var bodyItem in _program.Body) foreach (var bodyItem in _program.Code)
{ {
var offset = writer.DataSize; var offset = writer.DataSize;
@@ -36,11 +36,13 @@ public class ObjectSection
_labelOffsetMap[label.Name] = offset; _labelOffsetMap[label.Name] = offset;
continue; continue;
} }
if (bodyItem is not Instruction instruction) if (bodyItem is not Instruction instruction)
continue; continue;
// Add entry to line number table // Add entry to line number table
_loadResult.LineNumberTable.AddRecord(offset, instruction.Line, instruction.Column); _loadResult.LineNumberTable.AddRecord(offset, instruction.Line, instruction.Column);
_loadResult.LineNumberTable.AddRecord(offset, instruction.Line, 0);
var opCode = instruction.OpCode; var opCode = instruction.OpCode;
writer.WriteByte(opCode); writer.WriteByte(opCode);