Struct move_model::ast::Exp
source · pub struct Exp { /* private fields */ }
Expand description
An internalized expression. We do use a wrapper around the underlying internement implementation variant to ensure a unique API (LocalIntern and ArcIntern e.g. differ in the presence of the Copy trait, and by wrapping we effectively remove the Copy from LocalIntern).
Methods from Deref<Target = ExpData>§
pub fn node_id(&self) -> NodeId
pub fn call_args(&self) -> &[Exp]
pub fn node_ids(&self) -> Vec<NodeId> ⓘ
sourcepub fn free_vars(&self, env: &GlobalEnv) -> Vec<(Symbol, Type)> ⓘ
pub fn free_vars(&self, env: &GlobalEnv) -> Vec<(Symbol, Type)> ⓘ
Returns the free local variables, inclusive their types, used in this expression. Result is ordered by occurrence.
sourcepub fn used_memory(
&self,
env: &GlobalEnv
) -> BTreeSet<(QualifiedInstId<StructId>, Option<MemoryLabel>)>
pub fn used_memory( &self, env: &GlobalEnv ) -> BTreeSet<(QualifiedInstId<StructId>, Option<MemoryLabel>)>
Returns the used memory of this expression.
sourcepub fn temporaries(&self, env: &GlobalEnv) -> Vec<(TempIndex, Type)> ⓘ
pub fn temporaries(&self, env: &GlobalEnv) -> Vec<(TempIndex, Type)> ⓘ
Returns the temporaries used in this expression. Result is ordered by occurrence.
sourcepub fn visit<F>(&self, visitor: &mut F)where
F: FnMut(&ExpData),
pub fn visit<F>(&self, visitor: &mut F)where F: FnMut(&ExpData),
Visits expression, calling visitor on each sub-expression, depth first.
pub fn any<P>(&self, predicate: &mut P) -> boolwhere P: FnMut(&ExpData) -> bool,
sourcepub fn visit_pre_post<F>(&self, visitor: &mut F)where
F: FnMut(bool, &ExpData),
pub fn visit_pre_post<F>(&self, visitor: &mut F)where F: FnMut(bool, &ExpData),
Visits expression, calling visitor on each sub-expression. visitor(false, ..)
will
be called before descending into expression, and visitor(true, ..)
after. Notice
we use one function instead of two so a lambda can be passed which encapsulates mutable
references.
sourcepub fn module_usage(&self, usage: &mut BTreeSet<ModuleId>)
pub fn module_usage(&self, usage: &mut BTreeSet<ModuleId>)
Returns the set of module ids used by this expression.
sourcepub fn display<'a>(&'a self, env: &'a GlobalEnv) -> ExpDisplay<'a>
pub fn display<'a>(&'a self, env: &'a GlobalEnv) -> ExpDisplay<'a>
Creates a display of an expression which can be used in formatting.
Trait Implementations§
impl Eq for Exp
impl StructuralEq for Exp
impl StructuralPartialEq for Exp
Auto Trait Implementations§
impl RefUnwindSafe for Exp
impl !Send for Exp
impl !Sync for Exp
impl Unpin for Exp
impl UnwindSafe for Exp
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.