Trait FunctionCodeGenerator

Source
pub trait FunctionCodeGenerator<E: Debug> {
    // Required methods
    fn feed_return(&mut self, ty: WpType) -> Result<(), E>;
    fn feed_param(&mut self, ty: WpType) -> Result<(), E>;
    fn feed_local(&mut self, ty: WpType, n: usize, loc: u32) -> Result<(), E>;
    fn begin_body(&mut self, module_info: &ModuleInfo) -> Result<(), E>;
    fn feed_event(
        &mut self,
        op: Event<'_, '_>,
        module_info: &ModuleInfo,
        source_loc: u32,
    ) -> Result<(), E>;
    fn finalize(&mut self) -> Result<(), E>;
}
Expand description

The function-scope code generator trait.

Required Methods§

Source

fn feed_return(&mut self, ty: WpType) -> Result<(), E>

Sets the return type.

Source

fn feed_param(&mut self, ty: WpType) -> Result<(), E>

Adds a parameter to the function.

Source

fn feed_local(&mut self, ty: WpType, n: usize, loc: u32) -> Result<(), E>

Adds n locals to the function.

Source

fn begin_body(&mut self, module_info: &ModuleInfo) -> Result<(), E>

Called before the first call to feed_opcode.

Source

fn feed_event( &mut self, op: Event<'_, '_>, module_info: &ModuleInfo, source_loc: u32, ) -> Result<(), E>

Called for each operator.

Source

fn finalize(&mut self) -> Result<(), E>

Finalizes the function.

Implementors§