pub trait PatternVisitor {
    type PatternId: Copy;

    fn add_match_equal(
        &mut self,
        a: Self::PatternId,
        b: Self::PatternId,
        ty: TypeId
    ); fn add_match_int(&mut self, input: Self::PatternId, ty: TypeId, int_val: i128); fn add_match_prim(&mut self, input: Self::PatternId, ty: TypeId, val: Sym); fn add_match_variant(
        &mut self,
        input: Self::PatternId,
        input_ty: TypeId,
        arg_tys: &[TypeId],
        variant: VariantId
    ) -> Vec<Self::PatternId>; fn add_extract(
        &mut self,
        input: Self::PatternId,
        input_ty: TypeId,
        output_tys: Vec<TypeId>,
        term: TermId,
        infallible: bool,
        multi: bool
    ) -> Vec<Self::PatternId>; }
Expand description

Visitor interface for Patterns. Visitors can assign an arbitrary identifier to each subpattern, which is threaded through to subsequent calls into the visitor.

Required Associated Types§

The type of subpattern identifiers.

Required Methods§

Match if a and b have equal values.

Match if input is the given integer constant.

Match if input is the given primitive constant.

Match if input is the given enum variant. Returns an identifier for each field within the enum variant. The length of the return list must equal the length of arg_tys.

Match if the given external extractor succeeds on input. Returns an identifier for each return value from the external extractor. The length of the return list must equal the length of output_tys.

Implementors§