Skip to main content

emit_project

Function emit_project 

Source
pub fn emit_project(
    program: &CheckedProgram,
    ctx: &EmitProjectCtx,
    source_text: &str,
    source_name: &str,
) -> Result<(TsProgram, Option<String>), Vec<InternalFault>>
Expand description

Emit TypeScript source for a single file inside a multi-file project, including cross-file and cross-commons imports computed from EmitProjectCtx. Emit one unit’s TypeScript, plus its source map (slice 1, ADR 0103).

source_text is the originating .bynk file’s text and source_name its project-root-relative path; together they let the source-map builder resolve each recorded span to a (line, col) and embed sourcesContent. Returns the generated TS and the serialised source-map v3 JSON (None when nothing mapped — e.g. a unit whose items all came from sibling files).

1A.34: a checker fact the emitter needed and did not find is an InternalFault, not an any, an undefined or a panic. Lowering carries on past each, so the Err holds every fault of the unit; the program built alongside is then never used.