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
+13
View File
@@ -70,6 +70,19 @@ public protocol ProgramExecutionEvaluator {
) -> (Result<P4Value>, ProgramExecution)
}
public protocol Errorable: CustomStringConvertible {
func format() -> String
func msg() -> String
func append(error: any Errorable) -> any Errorable
func eq(_ rhs: any Errorable) -> Bool
}
extension Errorable {
public func eq(_ rhs: any Errorable) -> Bool {
return self.msg() == rhs.msg()
}
}
extension ProgramExecutionEvaluator {
public func ExecuteStatements(
_ statements: [EvaluatableStatement], inExecution execution: ProgramExecution