use crate::{
ast::{BinOp, CopyableVal_, Field_, QualifiedStructIdent, Type},
location::*,
};
use move_core_types::account_address::AccountAddress;
use move_symbol_pool::Symbol;
#[derive(PartialEq, Debug, Clone)]
pub enum FieldOrIndex {
Field(Field_),
Index(SpecExp),
}
#[derive(PartialEq, Debug, Clone)]
pub enum StorageLocation {
Formal(Symbol),
GlobalResource {
type_: QualifiedStructIdent,
type_actuals: Vec<Type>,
address: Box<StorageLocation>,
},
AccessPath {
base: Box<StorageLocation>,
fields_and_indices: Vec<FieldOrIndex>,
},
Address(AccountAddress),
Ret(u8),
}
#[derive(PartialEq, Debug, Clone)]
pub enum SpecExp {
Constant(CopyableVal_),
StorageLocation(StorageLocation),
GlobalExists {
type_: QualifiedStructIdent,
type_actuals: Vec<Type>,
address: StorageLocation,
},
Dereference(StorageLocation),
Reference(StorageLocation),
Not(Box<SpecExp>),
Binop(Box<SpecExp>, BinOp, Box<SpecExp>),
Update(Box<SpecExp>, Box<SpecExp>),
Old(Box<SpecExp>),
Call(Symbol, Vec<SpecExp>),
}
#[derive(PartialEq, Debug, Clone)]
pub enum Condition_ {
Ensures(SpecExp),
Requires(SpecExp),
AbortsIf(SpecExp),
SucceedsIf(SpecExp),
}
pub type Condition = Spanned<Condition_>;
#[derive(PartialEq, Debug, Clone)]
pub struct Invariant_ {
pub modifier: Option<Symbol>,
pub target: Option<Symbol>,
pub exp: SpecExp,
}
pub type Invariant = Spanned<Invariant_>;
#[derive(PartialEq, Debug, Clone)]
pub struct SyntheticDefinition_ {
pub name: Symbol,
pub type_: Type,
}
pub type SyntheticDefinition = Spanned<SyntheticDefinition_>;