Skip to main content

build

Function build 

Source
pub fn build(
    module: &Module,
    solved: HashMap<Name, Solved>,
    instances: Vec<SolvedInstance>,
) -> Module
Expand description

Turn a checked module and what the typer solved for it into the IR a backend reads.

solved and instances are consumed rather than borrowed: a Declaration owns its body, and the only other holder of these terms is the caller that just received them.

Every value of module, in values or in broken, ends up in exactly one of Module::declarations and Module::unchecked — see the second field for why nothing may merely go missing. A broken one is always unchecked, with an error reported behind it: canonicalization’s, or the syntax error of a declaration chunk that did not parse.

instances is one SolvedInstance for each of the module’s instances, in the same order. Every binding of an instance is accounted for the way a value is: in the instance’s members or in its unchecked.