mirror of
https://github.com/erg-lang/erg.git
synced 2025-08-04 18:58:30 +00:00
WIP: support cyclic modules
This commit is contained in:
parent
f43b683eda
commit
3e137da0a1
12 changed files with 204 additions and 21 deletions
|
@ -8,12 +8,13 @@ use erg_parser::ast::{VarName, AST};
|
|||
use erg_parser::build_ast::ASTBuilder;
|
||||
|
||||
use crate::artifact::{BuildRunnable, Buildable, CompleteArtifact, IncompleteArtifact};
|
||||
use crate::context::{Context, ContextProvider, ModuleContext};
|
||||
use crate::context::{Context, ContextKind, ContextProvider, ModuleContext};
|
||||
use crate::effectcheck::SideEffectChecker;
|
||||
use crate::error::{CompileError, CompileErrors, LowerWarnings};
|
||||
use crate::lower::ASTLowerer;
|
||||
use crate::module::SharedCompilerResource;
|
||||
use crate::ownercheck::OwnershipChecker;
|
||||
use crate::ty::VisibilityModifier;
|
||||
use crate::varinfo::VarInfo;
|
||||
|
||||
/// Summarize lowering, side-effect checking, and ownership checking
|
||||
|
@ -134,6 +135,19 @@ impl HIRBuilder {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new_with_ctx(mut mod_ctx: ModuleContext) -> Self {
|
||||
mod_ctx.context.grow(
|
||||
"<module>",
|
||||
ContextKind::Module,
|
||||
VisibilityModifier::Private,
|
||||
None,
|
||||
);
|
||||
Self {
|
||||
ownership_checker: OwnershipChecker::new(mod_ctx.get_top_cfg()),
|
||||
lowerer: ASTLowerer::new_with_ctx(mod_ctx),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn check(&mut self, ast: AST, mode: &str) -> Result<CompleteArtifact, IncompleteArtifact> {
|
||||
let mut artifact = self.lowerer.lower(ast, mode)?;
|
||||
let effect_checker = SideEffectChecker::new(self.cfg().clone());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue