Struct move_model::exp_rewriter::ExpRewriter
source · pub struct ExpRewriter<'env, 'rewriter> { /* private fields */ }
Expand description
Rewriter for expressions, allowing to substitute locals by expressions as well as instantiate types.
Implementations§
source§impl<'env, 'rewriter> ExpRewriter<'env, 'rewriter>
impl<'env, 'rewriter> ExpRewriter<'env, 'rewriter>
sourcepub fn new<F>(env: &'env GlobalEnv, replacer: &'rewriter mut F) -> Selfwhere
F: FnMut(NodeId, RewriteTarget) -> Option<Exp>,
pub fn new<F>(env: &'env GlobalEnv, replacer: &'rewriter mut F) -> Selfwhere F: FnMut(NodeId, RewriteTarget) -> Option<Exp>,
Creates a new rewriter with the given replacer map.
sourcepub fn set_type_args(self, type_args: &'rewriter [Type]) -> Self
pub fn set_type_args(self, type_args: &'rewriter [Type]) -> Self
Adds a type argument list to this rewriter. Generic type parameters are replaced by the given types.
Trait Implementations§
source§impl<'env, 'rewriter> ExpRewriterFunctions for ExpRewriter<'env, 'rewriter>
impl<'env, 'rewriter> ExpRewriterFunctions for ExpRewriter<'env, 'rewriter>
fn rewrite_local_var(&mut self, id: NodeId, sym: Symbol) -> Option<Exp>
fn rewrite_temporary(&mut self, id: NodeId, idx: TempIndex) -> Option<Exp>
fn rewrite_node_id(&mut self, id: NodeId) -> Option<NodeId>
source§fn rewrite_exp(&mut self, exp: Exp) -> Exp
fn rewrite_exp(&mut self, exp: Exp) -> Exp
Top-level entry for rewriting an expression. Can be re-implemented to do some
pre/post processing embedding a call to
do_rewrite
.