pub enum Term {
Int(i128),
Bool(bool),
Param(String),
RetVal,
Field {
base: Box<Term>,
name: String,
},
Old(Box<Term>),
Unary {
op: UnaryOp,
operand: Box<Term>,
},
Binary {
op: BinOp,
lhs: Box<Term>,
rhs: Box<Term>,
},
Ternary {
cond: Box<Term>,
then: Box<Term>,
els: Box<Term>,
},
}Expand description
A contract expression in fic’s subset.
Variants§
Int(i128)
Integer literal.
Bool(bool)
Boolean literal.
Param(String)
An identifier — a parameter once the contract is checked.
RetVal
The function’s return value (retval in Viper, \result in ACSL).
Field
base.name: a field of the return value (\result.origin).
Old(Box<Term>)
old(t): the value at entry. Parameters are immutable from the
caller’s point of view, so old(p) means p.
Unary
!t / -t.
Binary
lhs op rhs.
Ternary
cond ? then : els.
Implementations§
Source§impl Term
impl Term
Sourcepub fn binary(op: &str, lhs: Term, rhs: Term) -> Term
pub fn binary(op: &str, lhs: Term, rhs: Term) -> Term
lhs op rhs, with the operator given by its spelling.
Sourcepub fn mentions_retval(&self) -> bool
pub fn mentions_retval(&self) -> bool
true if the term mentions the return value.
Sourcepub fn identifiers(&self) -> Vec<&str>
pub fn identifiers(&self) -> Vec<&str>
Every identifier the term mentions, in first-occurrence order.
Trait Implementations§
impl Eq for Term
impl StructuralPartialEq for Term
Auto Trait Implementations§
impl Freeze for Term
impl RefUnwindSafe for Term
impl Send for Term
impl Sync for Term
impl Unpin for Term
impl UnsafeUnpin for Term
impl UnwindSafe for Term
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.