Skip to main content

AstMap

Trait AstMap 

Source
pub trait AstMap<'a> {
    // Required method
    fn arenas(&self) -> Arenas<'a>;

    // Provided methods
    fn map_expr(&mut self, e: &'a Expr<'a>) -> &'a Expr<'a> { ... }
    fn map_stmt(&mut self, s: &Stmt<'a>) -> Stmt<'a> { ... }
    fn map_type(&mut self, t: &'a TypeExpr<'a>) -> &'a TypeExpr<'a> { ... }
    fn map_arm(&mut self, arm: &MatchArm<'a>) -> MatchArm<'a> { ... }
    fn map_block(&mut self, block: &'a [Stmt<'a>]) -> &'a [Stmt<'a>] { ... }
}
Expand description

A rewriting pass over the imperative AST. Each hook’s default rebuilds the node from its mapped children.

Required Methods§

Source

fn arenas(&self) -> Arenas<'a>

Provided Methods§

Source

fn map_expr(&mut self, e: &'a Expr<'a>) -> &'a Expr<'a>

Source

fn map_stmt(&mut self, s: &Stmt<'a>) -> Stmt<'a>

Source

fn map_type(&mut self, t: &'a TypeExpr<'a>) -> &'a TypeExpr<'a>

Source

fn map_arm(&mut self, arm: &MatchArm<'a>) -> MatchArm<'a>

Source

fn map_block(&mut self, block: &'a [Stmt<'a>]) -> &'a [Stmt<'a>]

A block: by default each statement mapped in turn. A pass that rewrites a block’s statement sequence (replacing or joining adjacent statements) overrides this, and every block in the program reaches it.

Implementors§