[−][src]Struct walrus::ir::WithSideEffects
A value followed by one or more stack-neutral, side-effecting expressions.
This allows us to express "stacky" and "non-tree-like" expressions such as:
;; Assuming `f` has type `[] -> i32` and potential side effects.
call $f
call $f
call $f
drop
i32.add
Without WithSideEffects
, we would need to create a synthetic block
with a temporary local like this:
(i32.added
(call $f)
(block
(set_local $temp (call $f))
(drop (call $f))
(get_local $temp)
end))
But using WithoutSideEffects
we can represent this like so:
(i32.add
(with_side_effects
;; value
(call $f)
;; side_effects
(drop (call $f)))
(call $f))
Fields
before: Vec<ExprId>
The stack-neutral, side-effecting operations before value
value: ExprId
The value.
after: Vec<ExprId>
The stack-neutral, side-effecting operations after value
Trait Implementations
impl Ast for WithSideEffects
[src]
type Id = WithSideEffectsId
The identifier type for this AST node.
fn new_id(id: ExprId) -> WithSideEffectsId
[src]
impl<'expr> Visit<'expr> for WithSideEffects
[src]
impl VisitMut for WithSideEffects
[src]
fn visit_mut<V: VisitorMut>(&mut self, visitor: &mut V)
[src]
impl Clone for WithSideEffects
[src]
fn clone(&self) -> WithSideEffects
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl From<WithSideEffects> for Expr
[src]
fn from(x: WithSideEffects) -> Expr
[src]
impl Debug for WithSideEffects
[src]
Auto Trait Implementations
impl Send for WithSideEffects
impl Sync for WithSideEffects
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,