refactor: query diagnostic message table directly

This commit is contained in:
2026-10-24 02:44:47 +02:00
parent e9478dcf3f
commit 7551ce5f6d
2 changed files with 7 additions and 7 deletions
+6 -1
View File
@@ -1,5 +1,6 @@
import "@std/mem"
import "@std/arraylist"
import "@std/enummap"
import "@std/io"
import "@std/process"
@@ -182,7 +183,11 @@ report_diagnostics proc(
if (id == diagnostics.DiagnosticId(index)) label = "runtime trap"
}
try io.print("{s}:{}:{}: {s}: {s}\n", output, {
path, line + 1, offset - starts.items[line] + 1, label, diagnostics.message(diagnostic.code),
path,
line + 1,
offset - starts.items[line] + 1,
label,
enummap.get(diagnostics.Code, []u8, &diagnostics.messages, diagnostic.code)?,
})
}
}