compiler, runtime: Refactor Errors

Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
This commit is contained in:
Will Hawkins
2026-05-04 10:34:07 -04:00
parent b49ec104e9
commit 168d48fa7c
16 changed files with 456 additions and 304 deletions
+4 -4
View File
@@ -60,7 +60,7 @@ public struct Program {
// Add our FFIs
compilation_context = compilation_context.update(newFFIs: ffis)
var errors: [Error] = Array()
var errors: [any Errorable] = Array()
// If the caller gave any global instances, add them here.
if let globalInstances = globalInstances {
@@ -98,8 +98,8 @@ public struct Program {
// If none of the declaration parsers chose to parse, that's an error, too!
if !found_parser {
errors.append(
ErrorOnNode(
node: specific_declaration_node, withError: "Could not find parser for declaration node"
ErrorWithLocation(
sourceLocation: specific_declaration_node.toSourceLocation(), withError: "Could not find parser for declaration node"
))
}
}
@@ -108,7 +108,7 @@ public struct Program {
return Result.Error(
Error(
withMessage: errors.map { error in
return error.msg
return error.format()
}.joined(separator: ";")))
}