pub enum ControlFlow {
    Match {
        source: BindingId,
        arms: Vec<MatchArm>,
    },
    Equal {
        a: BindingId,
        b: BindingId,
        body: Block,
    },
    Loop {
        result: BindingId,
        body: Block,
    },
    Return {
        pos: Pos,
        result: BindingId,
    },
}
Expand description

What kind of control-flow structure do we need to emit here?

Variants§

§

Match

Fields

§source: BindingId

Which binding site are we examining at this point?

§arms: Vec<MatchArm>

What patterns do we care about?

Test a binding site against one or more mutually-exclusive patterns and branch to the appropriate block if a pattern matches.

§

Equal

Fields

§a: BindingId

One binding site.

§b: BindingId

The other binding site. To ensure we always generate the same code given the same set of ISLE rules, b should be strictly greater than a.

§body: Block

If the test succeeds, evaluate this block.

Test whether two binding sites have values which are equal when evaluated on the current input.

§

Loop

Fields

§result: BindingId

A binding site of type Binding::Iterator. Its source binding site must be a multi-extractor or multi-constructor call.

§body: Block

What to evaluate with each binding.

Evaluate a block once with each value of the given binding site.

§

Return

Fields

§pos: Pos

Where was the rule defined that had this right-hand side?

§result: BindingId

What is the result expression which should be returned if this rule matched?

Return a result from the right-hand side of a rule. If we’re building a multi-constructor then this doesn’t actually return, but adds to a list of results instead. Otherwise this return stops evaluation before any later steps.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.