Skip to main content

Module compile

Module compile 

Source
Expand description

End-to-end source-to-Wasm pipeline.

Callers run these entry points on a thread with at least crate::compiler_limits::COMPILER_STACK_BYTES of stack.

Structs§

CompiledPackage
CompiledScript
PackageSourceModule
ParsedScript
PhaseTimings
Wall-clock spent in each compile phase, filled in as the pipeline runs. A phase that never runs (e.g. codegen when the front-end errors) stays zero. Surfaced on CompiledScript for embedders that report compile-time performance.
ScriptImports

Functions§

compile_package
Compatibility adapter returning source and fatal failures as diagnostics.
compile_package_checked
compile_package_with_transitive
Compatibility adapter returning source and fatal failures as diagnostics.
compile_package_with_transitive_checked
compile_package with the rest of the dependency closure supplied separately.
compile_package_with_transitive_checked_for
compile_package_with_transitive_checked for an embedder that offers stdlib, so the package may import its optional packages.
compile_parsed_script_timed
Compatibility adapter returning source and fatal failures as diagnostics.
compile_parsed_script_timed_checked
compile_parsed_script_with_transitive
Compatibility adapter returning source and fatal failures as diagnostics.
compile_parsed_script_with_transitive_checked
Compile with declarations needed to reconstruct imported types without exposing those transitive packages to source-level imports.
compile_script
Compatibility adapter returning source and fatal failures as diagnostics.
compile_script_checked
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.
compile_script_owned_by
Compatibility adapter returning source and fatal failures as diagnostics.
compile_script_owned_by_checked
Compiles a script whose code belongs to owning_package rather than to main.
parse_script
typecheck
Compatibility adapter returning source and fatal failures as diagnostics.
typecheck_checked
Typecheck only — runs the front-end and stops before codegen. Returns Ok(warnings) when the program is error-free (warnings are non-fatal), Err(diagnostics) if any phase errors. Backs submilli check.
typecheck_parsed_checked
typecheck_checked for an already parsed script, against stdlib_defs (see Stdlib::package_declarations).
typecheck_to_typed_ast
Typecheck and return the typed AST together with every diagnostic, errors included. For tools that inspect what the typechecker inferred — the TypeScript baseline comparison in crates/conformance — rather than compile. The typed AST is only meaningful where the diagnostics are error-free.