Skip to main content

compile_source_package

Function compile_source_package 

Source
pub fn compile_source_package(
    package: PortableSourcePackage,
    entry: &str,
    entry_kind: EntryKind,
) -> Result<ProgramArtifact, Vec<Diagnostic>>
Expand description

Parse a resolved source package manifest using the canonical Harn lexer and parser, then compile it through compile_program_package. This keeps the browser and native source-to-artifact path on one frontend; hosts still own import resolution and typechecking before serializing the manifest.

Examples found in repository?
examples/../testdata/portable_conformance.rs (lines 804-808)
803    pub fn compile(&self) -> Result<harn_kernel::ProgramArtifact, Vec<harn_kernel::Diagnostic>> {
804        let result = harn_kernel::compile_source_package(
805            self.package(),
806            self.entry,
807            harn_kernel::EntryKind::Function,
808        );
809        assert_eq!(
810            result.is_ok(),
811            self.expected_ok,
812            "{} compilation decision drifted",
813            self.id
814        );
815        if let Err(diagnostics) = &result {
816            assert!(
817                !diagnostics.is_empty(),
818                "{} has no failure diagnostic",
819                self.id
820            );
821        }
822        result
823    }