Skip to main content

compile_recursive_with_root_path

Function compile_recursive_with_root_path 

Source
pub fn compile_recursive_with_root_path(
    ast: &Ast,
    root_path: &str,
    loader: &dyn FileLoader,
) -> Result<IrGraph, CompilerError>
Expand description

Like [compile_recursive] but also records root_path as the canonical filename of ast. When any imported module attempts to re-import the root by that filename the BFS deduplicates it against the already-loaded root instead of re-compiling it — preventing duplicate preamble execution and double-declared constants.

Use this variant when the root script was loaded from a known file path (e.g. from the CLI or a language server that has the URI).