Struct erg_compiler::lower::GenericASTLowerer
source · pub struct GenericASTLowerer<ASTBuilder: ASTBuildable = ASTBuilder> { /* private fields */ }
Expand description
Checks & infers types of an AST, and convert (lower) it into a HIR
Implementations§
source§impl<ASTBuilder: ASTBuildable> GenericASTLowerer<ASTBuilder>
impl<ASTBuilder: ASTBuildable> GenericASTLowerer<ASTBuilder>
pub fn new(cfg: ErgConfig) -> Self
pub fn new_with_cache<S: Into<Str>>( cfg: ErgConfig, mod_name: S, shared: SharedCompilerResource ) -> Self
pub fn new_with_ctx(module: ModuleContext) -> Self
pub fn pop_mod_ctx(&mut self) -> Option<ModuleContext>
pub fn pop_mod_ctx_or_default(&mut self) -> ModuleContext
pub fn get_mod_ctx(&self) -> &ModuleContext
pub fn dir(&self) -> Dict<&VarName, &VarInfo>
pub fn get_receiver_ctx(&self, receiver_name: &str) -> Option<&Context>
pub fn get_var_info(&self, name: &str) -> Option<(&VarName, &VarInfo)>
pub fn clear(&mut self)
pub fn unregister(&mut self, name: &str) -> Option<VarInfo>
source§impl<A: ASTBuildable> GenericASTLowerer<A>
impl<A: ASTBuildable> GenericASTLowerer<A>
sourcepub fn lower_chunk(
&mut self,
chunk: Expr,
expect: Option<&Type>
) -> LowerResult<Expr>
pub fn lower_chunk( &mut self, chunk: Expr, expect: Option<&Type> ) -> LowerResult<Expr>
The meaning of TypeAscription changes between chunk and expr.
For example, x: Int
, as expr, is x
itself,
but as chunk, it declares that x
is of type Int
, and is valid even before x
is defined.
pub fn lower( &mut self, ast: AST, mode: &str ) -> Result<CompleteArtifact, IncompleteArtifact>
Trait Implementations§
source§impl<A: ASTBuildable + 'static> BuildRunnable for GenericASTLowerer<A>
impl<A: ASTBuildable + 'static> BuildRunnable for GenericASTLowerer<A>
fn build_module(&mut self) -> Result<CompleteArtifact<T>, IncompleteArtifact<T>>
source§impl<ASTBuilder: ASTBuildable> Buildable for GenericASTLowerer<ASTBuilder>
impl<ASTBuilder: ASTBuildable> Buildable for GenericASTLowerer<ASTBuilder>
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<HIR>, IncompleteArtifact<HIR>>
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<A: ASTBuildable> ContextProvider for GenericASTLowerer<A>
impl<A: ASTBuildable> ContextProvider for GenericASTLowerer<A>
source§impl<ASTBuilder: Debug + ASTBuildable> Debug for GenericASTLowerer<ASTBuilder>
impl<ASTBuilder: Debug + ASTBuildable> Debug for GenericASTLowerer<ASTBuilder>
source§impl<A: ASTBuildable> Default for GenericASTLowerer<A>
impl<A: ASTBuildable> Default for GenericASTLowerer<A>
source§impl<A: ASTBuildable> New for GenericASTLowerer<A>
impl<A: ASTBuildable> New for GenericASTLowerer<A>
source§impl<ASTBuilder: ASTBuildable> Runnable for GenericASTLowerer<ASTBuilder>
impl<ASTBuilder: ASTBuildable> Runnable for GenericASTLowerer<ASTBuilder>
type Err = CompileError
type Errs = CompileErrors
const NAME: &'static str = "Erg lowerer"
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> !RefUnwindSafe for GenericASTLowerer<ASTBuilder>
impl<ASTBuilder> Send for GenericASTLowerer<ASTBuilder>
impl<ASTBuilder> Sync for GenericASTLowerer<ASTBuilder>
impl<ASTBuilder> Unpin for GenericASTLowerer<ASTBuilder>
impl<ASTBuilder = ASTBuilder> !UnwindSafe for GenericASTLowerer<ASTBuilder>
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