Enum move_ir_types::ast::Exp_
source · pub enum Exp_ {
Dereference(Box<Exp>),
UnaryExp(UnaryOp, Box<Exp>),
BinopExp(Box<Exp>, BinOp, Box<Exp>),
Value(CopyableVal),
Pack(StructName, Vec<Type>, ExpFields),
Borrow {
is_mutable: bool,
exp: Box<Exp>,
field: FieldIdent,
},
Move(Var),
Copy(Var),
BorrowLocal(bool, Var),
FunctionCall(FunctionCall, Box<Exp>),
ExprList(Vec<Exp>),
}
Expand description
Enum for all expressions
Variants§
Dereference(Box<Exp>)
*e
UnaryExp(UnaryOp, Box<Exp>)
op e
BinopExp(Box<Exp>, BinOp, Box<Exp>)
e_1 op e_2
Value(CopyableVal)
Wrapper to lift CopyableVal
into Exp
v
Pack(StructName, Vec<Type>, ExpFields)
Takes the given field values and instantiates the struct
Returns a fresh StructInstance
whose type and kind (resource or otherwise)
as the current struct class (i.e., the class of the method we’re currently executing).
n { f_1: e_1, ... , f_j: e_j }
Borrow
Fields
field: FieldIdent
the field being borrowed
&e.f
, &mut e.f
Move(Var)
move(x)
Copy(Var)
copy(x)
BorrowLocal(bool, Var)
&x
or &mut x
FunctionCall(FunctionCall, Box<Exp>)
f(e)
or f(e_1, e_2, ..., e_j)
ExprList(Vec<Exp>)
(e_1, e_2, e_3, …, e_j)
Implementations§
source§impl Exp_
impl Exp_
sourcepub fn address(addr: AccountAddress) -> Exp
pub fn address(addr: AccountAddress) -> Exp
Creates a new address Exp
with no location information
sourcepub fn value(b: CopyableVal_) -> Exp
pub fn value(b: CopyableVal_) -> Exp
Creates a new value Exp
with no location information
sourcepub fn byte_array(buf: Vec<u8>) -> Exp
pub fn byte_array(buf: Vec<u8>) -> Exp
Creates a new bytearray Exp
with no location information
sourcepub fn instantiate(n: StructName, tys: Vec<Type>, s: ExpFields) -> Exp
pub fn instantiate(n: StructName, tys: Vec<Type>, s: ExpFields) -> Exp
Creates a new pack/struct-instantiation Exp
with no location information
sourcepub fn binop(lhs: Exp, op: BinOp, rhs: Exp) -> Exp
pub fn binop(lhs: Exp, op: BinOp, rhs: Exp) -> Exp
Creates a new binary operator Exp
with no location information
sourcepub fn dereference(e: Exp) -> Exp
pub fn dereference(e: Exp) -> Exp
Creates a new *e
Exp
with no location information
sourcepub fn borrow(is_mutable: bool, exp: Box<Exp>, field: FieldIdent) -> Exp
pub fn borrow(is_mutable: bool, exp: Box<Exp>, field: FieldIdent) -> Exp
Creates a new borrow field Exp
with no location information
sourcepub fn function_call(f: FunctionCall, e: Exp) -> Exp
pub fn function_call(f: FunctionCall, e: Exp) -> Exp
Creates a new function call Exp
with no location information