pub enum Expression {
Const(ConstantValue),
Call {
method: MethodRef,
this: Option<Operand>,
args: Vec<Operand>,
},
Closure {
name: String,
captures: Vec<Operand>,
bootstrap_method_index: u16,
closure_descriptor: MethodDescriptor,
},
Math(MathOperation),
Field(FieldAccess),
Array(ArrayOperation),
Conversion(Conversion),
Throw(Operand),
Synchronization(LockOperation),
New(ClassRef),
Subroutine {
return_address: ProgramCounter,
target: ProgramCounter,
},
}Available on crate feature
unstable-moka-ir only.Expand description
Represents an expression in the Moka IR. It may or may not generate a value.
Variants§
Const(ConstantValue)
A constant value.
Call
A function call Corresponds to the following JVM instructions:
invokestaticinvokevirtualinvokespecialinvokeinterface
Closure
A call to a bootstrap method to create a closure. Corresponds to the following JVM instructions:
invokedynamic
Fields
§
closure_descriptor: MethodDescriptorThe descriptor of the closure generation.
Math(MathOperation)
A mathematical operation.
Field(FieldAccess)
A field access.
Array(ArrayOperation)
An array operation.
Conversion(Conversion)
A type conversion.
Throw(Operand)
Throws an exception.
Synchronization(LockOperation)
An operation on a monitor.
New(ClassRef)
Creates a new object.
Subroutine
A return address.
Fields
§
return_address: ProgramCounterThe address to return to.
§
target: ProgramCounterThe address where the subroutine starts.
Implementations§
Source§impl Expression
impl Expression
Sourcepub fn uses(&self) -> HashSet<Identifier>
pub fn uses(&self) -> HashSet<Identifier>
Returns the set of Identifiers used by the expression.
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 (const: unstable) · 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 Display for Expression
impl Display for Expression
impl Eq for Expression
Source§impl PartialEq for Expression
impl PartialEq 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more