Trait hotg_rune_compiler::hooks::Hooks
source · [−]pub trait Hooks {
fn before_parse(&mut self, _ctx: &mut dyn Context) -> Continuation { ... }
fn after_parse(&mut self, ctx: &mut dyn AfterParseContext) -> Continuation { ... }
fn after_lowering(
&mut self,
ctx: &mut dyn AfterLoweringContext
) -> Continuation { ... }
fn after_type_checking(
&mut self,
ctx: &mut dyn AfterTypeCheckingContext
) -> Continuation { ... }
fn after_codegen(
&mut self,
ctx: &mut dyn AfterCodegenContext
) -> Continuation { ... }
fn after_compile(
&mut self,
ctx: &mut dyn AfterCompileContext
) -> Continuation { ... }
}
Expand description
Callbacks that are fired at different points in the compilation process.
Each hook is optional, with the default implementation returning
Continuation::Halt
when Diagnostics::has_errors()
indicates there
were errors.
Provided methods
fn before_parse(&mut self, _ctx: &mut dyn Context) -> Continuation
fn before_parse(&mut self, _ctx: &mut dyn Context) -> Continuation
fn after_parse(&mut self, ctx: &mut dyn AfterParseContext) -> Continuation
fn after_parse(&mut self, ctx: &mut dyn AfterParseContext) -> Continuation
Callback fired after parsing the Runefile.
fn after_lowering(&mut self, ctx: &mut dyn AfterLoweringContext) -> Continuation
fn after_lowering(&mut self, ctx: &mut dyn AfterLoweringContext) -> Continuation
Callback fired after lowering a crate::parse::Document
to
crate::lowering
types but before any type checking is applied.
fn after_type_checking(
&mut self,
ctx: &mut dyn AfterTypeCheckingContext
) -> Continuation
fn after_type_checking(
&mut self,
ctx: &mut dyn AfterTypeCheckingContext
) -> Continuation
Callback fired after type checking and before codegen.
fn after_codegen(&mut self, ctx: &mut dyn AfterCodegenContext) -> Continuation
fn after_codegen(&mut self, ctx: &mut dyn AfterCodegenContext) -> Continuation
Callback fired after generating the Rust project but immediately before it is compiled to WebAssembly.