chore: let HIRBuilder/ASTLowerer be generic

This commit is contained in:
Shunsuke Shibayama 2023-11-03 03:03:11 +09:00
parent f4fcf3f2b2
commit 51c7b0778d
10 changed files with 126 additions and 75 deletions

View file

@ -186,6 +186,15 @@ impl From<ParserRunnerError> for CompileError {
}
}
impl From<CompileError> for ParserRunnerError {
fn from(err: CompileError) -> Self {
Self {
core: *err.core,
input: err.input,
}
}
}
impl ErrorDisplay for CompileError {
fn core(&self) -> &ErrorCore {
&self.core
@ -512,6 +521,12 @@ impl From<ParserRunnerErrors> for CompileErrors {
}
}
impl From<CompileErrors> for ParserRunnerErrors {
fn from(err: CompileErrors) -> Self {
Self::new(err.into_iter().map(|e| e.into()).collect())
}
}
impl From<Vec<CompileError>> for CompileErrors {
fn from(errs: Vec<CompileError>) -> Self {
Self(errs)