Trait Pass

Source
pub trait Pass {
    // Required methods
    fn visit_expression(
        &mut self,
        expression: &mut Loc<Expression>,
    ) -> Result<()>;
    fn visit_unit(&mut self, unit: &mut Unit) -> Result<()>;

    // Provided method
    fn visit_statement(
        &mut self,
        _statement: &Loc<Statement>,
    ) -> Result<Option<Vec<Loc<Statement>>>> { ... }
}

Required Methods§

Source

fn visit_expression(&mut self, expression: &mut Loc<Expression>) -> Result<()>

Source

fn visit_unit(&mut self, unit: &mut Unit) -> Result<()>

Perform transformations on the unit. This should not transform the body of the unit, that is handled by visit_expression

Provided Methods§

Source

fn visit_statement( &mut self, _statement: &Loc<Statement>, ) -> Result<Option<Vec<Loc<Statement>>>>

Visit a statement, transforming it into a list of new statements which replace it. If the statement should be replaced Ok(Some(new…)) should be returned, if it should be kept, Ok(None) should be returned

Implementors§

Source§

impl<'a> Pass for InOutChecks<'a>

Source§

impl<'a> Pass for DisallowZeroSize<'a>

Source§

impl<'a> Pass for FlattenRegs<'a>

Source§

impl<'a> Pass for LowerLambdaDefs<'a>

Source§

impl<'a> Pass for LowerMethods<'a>

Source§

impl<'a> Pass for LowerTypeLevelIf<'a>