Enum rtlola_frontend::mir::ExpressionKind
source · [−]pub enum ExpressionKind {
LoadConstant(Constant),
ArithLog(ArithLogOp, Vec<Expression>),
StreamAccess {
target: StreamReference,
parameters: Vec<Expression>,
access_kind: StreamAccessKind,
},
ParameterAccess(StreamReference, usize),
Ite {
condition: Box<Expression>,
consequence: Box<Expression>,
alternative: Box<Expression>,
},
Tuple(Vec<Expression>),
TupleAccess(Box<Expression>, usize),
Function(String, Vec<Expression>),
Convert {
expr: Box<Expression>,
},
Default {
expr: Box<Expression>,
default: Box<Expression>,
},
}
Expand description
This enum contains all possible kinds of expressions and their relevant information.
Variants
LoadConstant(Constant)
Load a constant value
ArithLog(ArithLogOp, Vec<Expression>)
Apply an arithmetic or logic operation. The function is monomorphized.
Note: Arguments never need to be coerced. Unary: 1st argument -> operand Binary: 1st argument -> lhs, 2nd argument -> rhs n-ary: kth argument -> kth operand
StreamAccess
Fields
target: StreamReference
The target stream to be accessed
parameters: Vec<Expression>
The parameters of the specific stream instance that is accessed.
If the stream behind target
is not parametrized, this collection is empty.
access_kind: StreamAccessKind
The kind of access
Access another stream
ParameterAccess(StreamReference, usize)
Access to the parameter of a stream represented by a stream reference, referencing the target stream and the index of the parameter that should be accessed.
Ite
Fields
condition: Box<Expression>
The condition under which either consequence
or alternative
is selected.
consequence: Box<Expression>
The consequence should be evaluated and returned if the condition evaluates to true.
alternative: Box<Expression>
The alternative should be evaluated and returned if the condition evaluates to false.
A conditional (if-then-else) expression
Tuple(Vec<Expression>)
A tuple expression
TupleAccess(Box<Expression>, usize)
Represents a tuple projections, i.e., it accesses a specific tuple element.
Function(String, Vec<Expression>)
Represents a function call. The function is monomorphized.
Note: Arguments never need to be coerced. Unary: 1st argument -> operand Binary: 1st argument -> lhs, 2nd argument -> rhs n-ary: kth argument -> kth operand
Convert
Fields
expr: Box<Expression>
The expression that produces a value. The type of the expression indicates the source of the conversion.
Converting a value to a different type
The result type is indicated in the expression with the Convert
kind.
Default
Fields
expr: Box<Expression>
The expression that results in an optional value.
default: Box<Expression>
An infallible expression providing the default value if expr
fails to produce a value.
Transforms an optional value into a definitive one
Trait Implementations
sourceimpl Clone for ExpressionKind
impl Clone for ExpressionKind
sourcefn clone(&self) -> ExpressionKind
fn clone(&self) -> ExpressionKind
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for ExpressionKind
impl Debug for ExpressionKind
sourceimpl<'de> Deserialize<'de> for ExpressionKind
impl<'de> Deserialize<'de> for ExpressionKind
sourcefn 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
sourceimpl PartialEq<ExpressionKind> for ExpressionKind
impl PartialEq<ExpressionKind> for ExpressionKind
sourcefn eq(&self, other: &ExpressionKind) -> bool
fn eq(&self, other: &ExpressionKind) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &ExpressionKind) -> bool
fn ne(&self, other: &ExpressionKind) -> bool
This method tests for !=
.
sourceimpl Serialize for ExpressionKind
impl Serialize for ExpressionKind
impl StructuralPartialEq for ExpressionKind
Auto Trait Implementations
impl RefUnwindSafe for ExpressionKind
impl Send for ExpressionKind
impl Sync for ExpressionKind
impl Unpin for ExpressionKind
impl UnwindSafe for ExpressionKind
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more