Skip to main content

compile_script_checked

Function compile_script_checked 

Source
pub fn compile_script_checked(
    source: &str,
    filename: &str,
    file: FileId,
    packages: &[&PackageDeclaration],
    mcps: &[&PackageDeclaration],
) -> Result<CompiledScript, CompileError>
Expand description

Compile a script module. filename is the DWARF compile-unit name for backtrace source mapping; file is this source’s FileId in the caller’s Sources registry. packages are real package declarations that emit Wasm imports; mcps are declaration-only virtual MCP packages.

Returns CompiledScript on success. Warnings are non-fatal and should be surfaced without aborting; callers that only need Wasm bytes can read CompiledScript::wasm. Returns Err(diagnostics) if any phase errors.