Skip to main content

lower_tree

Function lower_tree 

Source
pub fn lower_tree(tree: &SyntaxTree) -> LowerResult
Expand description

Lower an already-parsed [SyntaxTree]: evaluate it, then run the §6 stage-3 resolver. The CLI calls this after mos_parse::parse so a phase barrier can sit between parsing and lowering; lower is the parse-and-lower convenience used by tests and embedders.

§Examples

use std::path::Path;

let mut sink = mos_core::CollectingSink::new();
let tree = mos_parse::parse(
    "= Intro <intro>\n\nSee @intro\n",
    Path::new("main.mos"),
    &mut sink,
)?;
let lowered = mos_eval::lower_tree(&tree);

assert!(!lowered.has_errors());