Add artifact.rs

This commit is contained in:
Shunsuke Shibayama 2022-10-29 17:27:21 +09:00
parent 7f674da751
commit 8ca4b7bd6e
6 changed files with 99 additions and 45 deletions

View file

@ -193,9 +193,12 @@ impl Compiler {
}
fn build_link_desugar(&mut self, src: String, mode: &str) -> Result<HIR, CompileErrors> {
let hir = self.builder.build(src, mode).map_err(|(_, errs)| errs)?;
let artifact = self
.builder
.build(src, mode)
.map_err(|artifact| artifact.errors)?;
let linker = Linker::new(&self.cfg, &self.mod_cache);
let hir = linker.link(hir);
let hir = linker.link(artifact.hir);
Ok(HIRDesugarer::desugar(hir))
}
}