pub enum IrExpr {
Var(String),
Lit(IrLit),
App {
func: Box<IrExpr>,
args: Vec<IrExpr>,
},
Let {
name: String,
ty: IrType,
value: Box<IrExpr>,
body: Box<IrExpr>,
},
Lambda {
params: Vec<(String, IrType)>,
body: Box<IrExpr>,
captured: Vec<String>,
},
If {
cond: Box<IrExpr>,
then_branch: Box<IrExpr>,
else_branch: Box<IrExpr>,
},
Match {
scrutinee: Box<IrExpr>,
arms: Vec<IrMatchArm>,
},
Struct {
name: String,
fields: Vec<(String, IrExpr)>,
},
Field {
object: Box<IrExpr>,
field: String,
},
Alloc(Box<IrExpr>),
Deref(Box<IrExpr>),
Seq(Vec<IrExpr>),
}Expand description
Core intermediate representation expression
Variants§
Var(String)
Variable reference
Lit(IrLit)
Literal value
App
Function application
Let
Let binding
Lambda
Lambda abstraction (after closure conversion, becomes function reference)
If
Conditional expression
Match
Pattern match
Struct
Struct construction
Field
Field access
Alloc(Box<IrExpr>)
Memory allocation
Deref(Box<IrExpr>)
Memory dereference
Seq(Vec<IrExpr>)
Sequence of expressions
Trait Implementations§
impl StructuralPartialEq for IrExpr
Auto Trait Implementations§
impl Freeze for IrExpr
impl RefUnwindSafe for IrExpr
impl Send for IrExpr
impl Sync for IrExpr
impl Unpin for IrExpr
impl UnsafeUnpin for IrExpr
impl UnwindSafe for IrExpr
Blanket Implementations§
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