Struct pomelo_hir::lower::context::LoweringCtxt
source · Expand description
Context needed while lowering.
This is used to do name resolution on the topdecs during lowering.
Maybe need to also have a BodyLoweringCtxt
as well, just to keep track of weird nested infix stuff?
That seems like an annoying corner case…
Fields§
§res: Resolver
§file: File
§errors: Vec<Error>
Implementations§
source§impl LoweringCtxt
impl LoweringCtxt
pub fn new() -> Self
pub(crate) fn lower_file(self, file: &File) -> (File, Vec<Error>)
pub(super) fn resolver(&self) -> &Resolver
fn resolver_mut(&mut self) -> &mut Resolver
pub(super) fn in_inner_scope<T>(&mut self, f: impl FnMut(&mut Self) -> T) -> T
fn file_mut(&mut self) -> &mut File
pub fn arenas(&self) -> &impl FileArena
pub fn alloc_ast_id<N>(&mut self, ast: &N) -> FileAstIdx<N>where
N: AstNode<Language = SML>,
pub fn interner_mut(&mut self) -> &mut impl NameInterner
sourcepub fn make_rec_dec(
&mut self,
ast_id: AstId<Dec>,
f: impl FnOnce(&mut Self, Idx<Dec>) -> DecKind
) -> Idx<Dec>
pub fn make_rec_dec(
&mut self,
ast_id: AstId<Dec>,
f: impl FnOnce(&mut Self, Idx<Dec>) -> DecKind
) -> Idx<Dec>
This is needed because some of the dec can have recursive bindings.
For these, we need to preallocate the Dec node so we can give its index out before lowering interior pats, exprs, etc.
sourcepub fn register_rec_pat(&mut self, pat: Idx<Pat>, dec: Idx<Dec>)
pub fn register_rec_pat(&mut self, pat: Idx<Pat>, dec: Idx<Dec>)
Register patterns in val rec
declarations.
This is needed because the expression in the binding can refer to the names in pat
.
sourcepub fn register_bound_vids_dec(&mut self, index: Idx<Dec>)
pub fn register_bound_vids_dec(&mut self, index: Idx<Dec>)
Register identifiers bound in the current Dec
.
sourcepub fn register_bound_tycons_dec(&mut self, index: Idx<Dec>)
pub fn register_bound_tycons_dec(&mut self, index: Idx<Dec>)
Register type constructors bound in the current Dec
.
sourcepub fn register_fixities(&mut self, index: Idx<Dec>)
pub fn register_fixities(&mut self, index: Idx<Dec>)
Register fixities bound in the current Dec
.
sourcepub fn register_pat_names_in_match(&mut self, index: Idx<Pat>)
pub fn register_pat_names_in_match(&mut self, index: Idx<Pat>)
Register identifiers declared in the the Pat
of a pattern match.
This needs to be done before lowering Expr
on the RHS of the match,
otherwise any names declared here will not be in scope in the Expr
.
sourcepub fn fixup_vid_expr_ref(&mut self, expr: Idx<Expr>, loc: DefLoc)
pub fn fixup_vid_expr_ref(&mut self, expr: Idx<Expr>, loc: DefLoc)
Horrible hack to make while loop lowering work…
pub fn add_expr(&mut self, expr: Expr) -> Idx<Expr>
pub fn add_pat(&mut self, pat: Pat) -> Idx<Pat>
pub fn add_ty(&mut self, ty: Ty) -> Idx<Ty>
fn arenas_mut(&mut self) -> &mut impl FileArenaExt
Trait Implementations§
source§impl Clone for LoweringCtxt
impl Clone for LoweringCtxt
source§fn clone(&self) -> LoweringCtxt
fn clone(&self) -> LoweringCtxt
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more