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>

source

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.

source

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>

source§

fn rewrite_local_var(&mut self, id: NodeId, sym: Symbol) -> Option<Exp>

source§

fn rewrite_temporary(&mut self, id: NodeId, idx: TempIndex) -> Option<Exp>

source§

fn rewrite_node_id(&mut self, id: NodeId) -> Option<NodeId>

source§

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.
source§

fn rewrite_vec(&mut self, exps: &[Exp]) -> Vec<Exp>

source§

fn rewrite_enter_scope<'a>( &mut self, decls: impl Iterator<Item = &'a LocalVarDecl> )

source§

fn rewrite_exit_scope(&mut self)

source§

fn rewrite_value(&mut self, id: NodeId, value: &Value) -> Option<Exp>

source§

fn rewrite_spec_var( &mut self, id: NodeId, mid: ModuleId, vid: SpecVarId, label: &Option<MemoryLabel> ) -> Option<Exp>

source§

fn rewrite_call( &mut self, id: NodeId, oper: &Operation, args: &[Exp] ) -> Option<Exp>

source§

fn rewrite_invoke(&mut self, id: NodeId, target: &Exp, args: &[Exp]) -> Option<Exp>

source§

fn rewrite_lambda( &mut self, id: NodeId, vars: &[LocalVarDecl], body: &Exp ) -> Option<Exp>

source§

fn rewrite_block( &mut self, id: NodeId, vars: &[LocalVarDecl], body: &Exp ) -> Option<Exp>

source§

fn rewrite_quant( &mut self, id: NodeId, vars: &[(LocalVarDecl, Exp)], triggers: &[Vec<Exp>], cond: &Option<Exp>, body: &Exp ) -> Option<Exp>

source§

fn rewrite_if_else( &mut self, id: NodeId, cond: &Exp, then: &Exp, else_: &Exp ) -> Option<Exp>

source§

fn rewrite_exp_descent(&mut self, exp: Exp) -> Exp

source§

fn internal_rewrite_id(&mut self, id: &NodeId) -> (bool, NodeId)

source§

fn internal_rewrite_exp(&mut self, exp: &Exp) -> (bool, Exp)

source§

fn internal_rewrite_vec(&mut self, exps: &[Exp]) -> Option<Vec<Exp>>

source§

fn internal_rewrite_decls( &mut self, decls: &[LocalVarDecl] ) -> (bool, Vec<LocalVarDecl>)

source§

fn internal_rewrite_quant_decls( &mut self, decls: &[(LocalVarDecl, Exp)] ) -> (bool, Vec<(LocalVarDecl, Exp)>)

Auto Trait Implementations§

§

impl<'env, 'rewriter> !RefUnwindSafe for ExpRewriter<'env, 'rewriter>

§

impl<'env, 'rewriter> !Send for ExpRewriter<'env, 'rewriter>

§

impl<'env, 'rewriter> !Sync for ExpRewriter<'env, 'rewriter>

§

impl<'env, 'rewriter> Unpin for ExpRewriter<'env, 'rewriter>

§

impl<'env, 'rewriter> !UnwindSafe for ExpRewriter<'env, 'rewriter>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V