Struct erg_compiler::build_package::GenericPackageBuilder
source · pub struct GenericPackageBuilder<ASTBuilder: ASTBuildable = ASTBuilder, HIRBuilder: Buildable = GenericHIRBuilder> { /* private fields */ }
Expand description
Resolve dependencies and build a package. This object should be a singleton.
Invariant condition: build_module
must be idempotent.
That is, the only thing that may differ as a result of analyzing the same package is the elapsed time.
Implementations§
source§impl<ASTBuilder: ASTBuildable, HIRBuilder: Buildable> GenericPackageBuilder<ASTBuilder, HIRBuilder>
impl<ASTBuilder: ASTBuildable, HIRBuilder: Buildable> GenericPackageBuilder<ASTBuilder, HIRBuilder>
pub fn new(cfg: ErgConfig, shared: SharedCompilerResource) -> Self
sourcepub fn new_with_cache(
cfg: ErgConfig,
mod_name: Str,
shared: SharedCompilerResource
) -> Self
pub fn new_with_cache( cfg: ErgConfig, mod_name: Str, shared: SharedCompilerResource ) -> Self
For batch compilation mode, mod_name
of the entry point must be <module>
.
For ELS mode, mod_name
must be the file name of the entry point.
pub fn finalize(&mut self)
pub fn build( &mut self, src: String, mode: &str ) -> Result<CompleteArtifact, IncompleteArtifact>
pub fn build_module(&mut self) -> Result<CompleteArtifact, IncompleteArtifact>
pub fn build_root( &mut self, ast: AST, mode: &str ) -> Result<CompleteArtifact, IncompleteArtifact>
Trait Implementations§
source§impl<ASTBuilder: ASTBuildable + 'static, HIRBuilder: BuildRunnable + 'static> BuildRunnable for GenericPackageBuilder<ASTBuilder, HIRBuilder>
impl<ASTBuilder: ASTBuildable + 'static, HIRBuilder: BuildRunnable + 'static> BuildRunnable for GenericPackageBuilder<ASTBuilder, HIRBuilder>
fn build_module(&mut self) -> Result<CompleteArtifact<T>, IncompleteArtifact<T>>
source§impl<ASTBuilder: ASTBuildable, HIRBuilder: Buildable> Buildable for GenericPackageBuilder<ASTBuilder, HIRBuilder>
impl<ASTBuilder: ASTBuildable, HIRBuilder: Buildable> Buildable for GenericPackageBuilder<ASTBuilder, HIRBuilder>
fn inherit(cfg: ErgConfig, shared: SharedCompilerResource) -> Self
fn inherit_with_name( cfg: ErgConfig, mod_name: Str, shared: SharedCompilerResource ) -> Self
fn build( &mut self, src: String, mode: &str ) -> Result<CompleteArtifact, IncompleteArtifact>
fn build_from_ast( &mut self, ast: AST, mode: &str ) -> Result<CompleteArtifact<HIR>, IncompleteArtifact<HIR>>
fn pop_context(&mut self) -> Option<ModuleContext>
fn get_context(&self) -> Option<&ModuleContext>
source§impl<ASTBuilder: ASTBuildable, HIRBuilder: Buildable + ContextProvider> ContextProvider for GenericPackageBuilder<ASTBuilder, HIRBuilder>
impl<ASTBuilder: ASTBuildable, HIRBuilder: Buildable + ContextProvider> ContextProvider for GenericPackageBuilder<ASTBuilder, HIRBuilder>
source§impl<ASTBuilder: Debug + ASTBuildable, HIRBuilder: Debug + Buildable> Debug for GenericPackageBuilder<ASTBuilder, HIRBuilder>
impl<ASTBuilder: Debug + ASTBuildable, HIRBuilder: Debug + Buildable> Debug for GenericPackageBuilder<ASTBuilder, HIRBuilder>
source§impl<ASTBuilder: ASTBuildable, HIRBuilder: Buildable> Default for GenericPackageBuilder<ASTBuilder, HIRBuilder>
impl<ASTBuilder: ASTBuildable, HIRBuilder: Buildable> Default for GenericPackageBuilder<ASTBuilder, HIRBuilder>
source§impl<A: ASTBuildable, H: BuildRunnable> New for GenericPackageBuilder<A, H>
impl<A: ASTBuildable, H: BuildRunnable> New for GenericPackageBuilder<A, H>
source§impl<ASTBuilder: ASTBuildable, HIRBuilder: BuildRunnable> Runnable for GenericPackageBuilder<ASTBuilder, HIRBuilder>
impl<ASTBuilder: ASTBuildable, HIRBuilder: BuildRunnable> Runnable for GenericPackageBuilder<ASTBuilder, HIRBuilder>
type Err = CompileError
type Errs = CompileErrors
const NAME: &'static str = "Erg package builder"
fn cfg(&self) -> &ErgConfig
fn cfg_mut(&mut self) -> &mut ErgConfig
fn finish(&mut self)
source§fn initialize(&mut self)
fn initialize(&mut self)
Erase all but immutable information.
fn exec(&mut self) -> Result<ExitStatus, Self::Errs>
fn eval(&mut self, src: String) -> Result<String, Self::Errs>
fn expect_block(&self, src: &str) -> BlockKind
fn input(&self) -> &Input
fn set_input(&mut self, input: Input)
fn start_message(&self) -> String
fn ps1(&self) -> String
fn ps2(&self) -> String
fn quit(&mut self, code: i32) -> !
fn quit_successfully(&mut self, output: BufWriter<StdoutLock<'_>>) -> !
fn run(cfg: ErgConfig) -> ExitStatus
Auto Trait Implementations§
impl<ASTBuilder = ASTBuilder, HIRBuilder = GenericHIRBuilder> !RefUnwindSafe for GenericPackageBuilder<ASTBuilder, HIRBuilder>
impl<ASTBuilder, HIRBuilder> Send for GenericPackageBuilder<ASTBuilder, HIRBuilder>where
HIRBuilder: Send,
impl<ASTBuilder, HIRBuilder> Sync for GenericPackageBuilder<ASTBuilder, HIRBuilder>where
HIRBuilder: Sync,
impl<ASTBuilder, HIRBuilder> Unpin for GenericPackageBuilder<ASTBuilder, HIRBuilder>where
HIRBuilder: Unpin,
impl<ASTBuilder = ASTBuilder, HIRBuilder = GenericHIRBuilder> !UnwindSafe for GenericPackageBuilder<ASTBuilder, HIRBuilder>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more