Skip to main content

decision_tree

Function decision_tree 

Source
pub fn decision_tree<'a>(
    scrutinee: &Type,
    branches: &'a [(TermPattern, Box<TypedTerm>)],
    declaration: &Name,
) -> Decision<'a>
Expand description

Lower one case’s branches, in source order, into the Decision a backend walks.

scrutinee is the type of the value the case matches on — the solved type of super::TypedTermKind::Case’s own scrutinee — which a variable written as a whole branch’s pattern binds. branches is that case’s own, in the same order. And declaration names the value the case was written inside of, which is what a Decision::Fail leaf, if the tree needs one, carries (see that field’s doc).