[][src]Struct walrus::ir::WithSideEffects

pub struct WithSideEffects {
    pub value: ExprId,
    pub side_effects: Vec<ExprId>,
}

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

value: ExprId

The value.

side_effects: Vec<ExprId>

The stack-neutral, side-effecting operations.

Trait Implementations

impl Ast for WithSideEffects[src]

type Id = WithSideEffectsId

The identifier type for this AST node.

impl<'expr> Visit<'expr> for WithSideEffects[src]

impl VisitMut for WithSideEffects[src]

impl Clone for 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]

impl Debug for WithSideEffects[src]

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]