[−][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
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.
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> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
🔬 This is a nightly-only experimental API. (
try_from
)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> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,