pub enum GoExpr {
Show 15 variants
Lit(GoLit),
Var(String),
Call(Box<GoExpr>, Vec<GoExpr>),
BinOp(String, Box<GoExpr>, Box<GoExpr>),
Unary(String, Box<GoExpr>),
Field(Box<GoExpr>, String),
Index(Box<GoExpr>, Box<GoExpr>),
TypeAssert(Box<GoExpr>, GoType),
Composite(GoType, Vec<(String, GoExpr)>),
SliceLit(GoType, Vec<GoExpr>),
AddressOf(Box<GoExpr>),
Deref(Box<GoExpr>),
FuncLit(Vec<(String, GoType)>, Vec<GoType>, Vec<GoStmt>),
Make(GoType, Vec<GoExpr>),
New(GoType),
}Expand description
Go expression for code generation.
Variants§
Lit(GoLit)
A literal value: 42, "hello", true, nil
Var(String)
A variable identifier: x, _t0, natAdd
Call(Box<GoExpr>, Vec<GoExpr>)
A function call: f(a, b, c)
BinOp(String, Box<GoExpr>, Box<GoExpr>)
A binary operator expression: a + b, a == b
Unary(String, Box<GoExpr>)
A unary operator expression: !x, -n
Field(Box<GoExpr>, String)
Field access: obj.Field
Index(Box<GoExpr>, Box<GoExpr>)
Index expression: arr[i]
TypeAssert(Box<GoExpr>, GoType)
Type assertion: x.(T)
Composite(GoType, Vec<(String, GoExpr)>)
Composite literal: MyStruct{Field: val, ...}
SliceLit(GoType, Vec<GoExpr>)
Slice literal: []T{a, b, c}
AddressOf(Box<GoExpr>)
Address-of: &expr
Deref(Box<GoExpr>)
Dereference: *expr
FuncLit(Vec<(String, GoType)>, Vec<GoType>, Vec<GoStmt>)
Anonymous function literal: func(params) ret_ty { body }
Make(GoType, Vec<GoExpr>)
make(T, args...)
New(GoType)
new(T)
Trait Implementations§
impl StructuralPartialEq for GoExpr
Auto Trait Implementations§
impl Freeze for GoExpr
impl RefUnwindSafe for GoExpr
impl Send for GoExpr
impl Sync for GoExpr
impl Unpin for GoExpr
impl UnsafeUnpin for GoExpr
impl UnwindSafe for GoExpr
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