SwiftCompilerSources: refactor DiagnosticEngine

* move it from the SIL to the AST module (where it belongs)
* change the signature of `diagnose` from `diagnose(location, .some_error)` to `diagnose(.some_error, at: location)`
* add an overload to allow passing a `SIL.Location` directly to `diagnose`
* add a `Diagnostic : Error` utility struct which allows throwing a `Diagnostic`
This commit is contained in:
Erik Eckstein
2025-04-17 12:18:51 +02:00
parent 43d793ba96
commit 1c9a7cd562
15 changed files with 84 additions and 41 deletions

View File

@@ -31,3 +31,9 @@ public struct DeclRef: CustomStringConvertible, NoReflectionChildren {
lhs.bridged.isEqualTo(rhs.bridged)
}
}
extension DeclRef: DiagnosticArgument {
public func _withBridgedDiagnosticArgument(_ fn: (BridgedDiagnosticArgument) -> Void) {
fn(bridged.asDiagnosticArgument())
}
}