mirror of
https://github.com/erg-lang/erg.git
synced 2025-08-04 18:58:30 +00:00
chore: add HIRBuilder::build_linked_module
This commit is contained in:
parent
23df312cc6
commit
dfe62e5173
2 changed files with 11 additions and 3 deletions
|
@ -11,6 +11,7 @@ use crate::artifact::{BuildRunnable, Buildable, CompleteArtifact, IncompleteArti
|
|||
use crate::context::{Context, ContextKind, ContextProvider, ModuleContext};
|
||||
use crate::effectcheck::SideEffectChecker;
|
||||
use crate::error::{CompileError, CompileErrors, LowerWarnings};
|
||||
use crate::link_hir::HIRLinker;
|
||||
use crate::lower::ASTLowerer;
|
||||
use crate::module::SharedCompilerResource;
|
||||
use crate::ownercheck::OwnershipChecker;
|
||||
|
@ -184,6 +185,13 @@ impl HIRBuilder {
|
|||
self.build(src, "exec")
|
||||
}
|
||||
|
||||
pub fn build_linked_module(&mut self) -> Result<CompleteArtifact, IncompleteArtifact> {
|
||||
let artifact = self.build_module()?;
|
||||
let linker = HIRLinker::new(self.cfg(), self.lowerer.module.context.mod_cache());
|
||||
let hir = linker.link(artifact.object);
|
||||
Ok(CompleteArtifact::new(hir, artifact.warns))
|
||||
}
|
||||
|
||||
pub fn pop_mod_ctx(&mut self) -> Option<ModuleContext> {
|
||||
self.lowerer.pop_mod_ctx()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue