pub enum Expression {
Show 13 variants
Literal(RubyValue),
Variable(String),
GlobalVariable(String),
InstanceVariable(String),
ClassVariable(String),
MethodCall {
receiver: Box<Expression>,
method: String,
arguments: Vec<Expression>,
},
BinaryOp {
left: Box<Expression>,
op: BinaryOperator,
right: Box<Expression>,
},
UnaryOp {
op: UnaryOperator,
operand: Box<Expression>,
},
ArrayLiteral(Vec<Expression>),
HashLiteral(HashMap<String, Expression>),
Block {
parameters: Vec<String>,
body: Vec<Statement>,
},
SelfRef,
SuperCall {
arguments: Vec<Expression>,
},
}Expand description
Expression types in the IR
Variants§
Literal(RubyValue)
Literal value
Variable(String)
Variable reference
GlobalVariable(String)
Global variable reference
InstanceVariable(String)
Instance variable reference
ClassVariable(String)
Class variable reference
MethodCall
Method call
BinaryOp
Binary operation
Fields
§
left: Box<Expression>Left operand
§
op: BinaryOperatorBinary operator
§
right: Box<Expression>Right operand
UnaryOp
Unary operation
ArrayLiteral(Vec<Expression>)
Array literal
HashLiteral(HashMap<String, Expression>)
Hash literal
Block
Block creation
SelfRef
Self reference
SuperCall
Super call
Fields
§
arguments: Vec<Expression>Super call arguments
Trait Implementations§
Source§impl Clone for Expression
impl Clone for Expression
Source§fn clone(&self) -> Expression
fn clone(&self) -> Expression
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Expression
impl Debug for Expression
Source§impl<'de> Deserialize<'de> for Expression
impl<'de> Deserialize<'de> for Expression
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for Expression
impl PartialEq for Expression
Source§impl Serialize for Expression
impl Serialize for Expression
impl StructuralPartialEq for Expression
Auto Trait Implementations§
impl Freeze for Expression
impl RefUnwindSafe for Expression
impl Send for Expression
impl Sync for Expression
impl Unpin for Expression
impl UnsafeUnpin for Expression
impl UnwindSafe for Expression
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