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 817-821)
816    pub fn compile(&self) -> Result<harn_kernel::ProgramArtifact, Vec<harn_kernel::Diagnostic>> {
817        let result = harn_kernel::compile_source_package(
818            self.package(),
819            self.entry,
820            harn_kernel::EntryKind::Function,
821        );
822        assert_eq!(
823            result.is_ok(),
824            self.expected_ok,
825            "{} compilation decision drifted",
826            self.id
827        );
828        if let Err(diagnostics) = &result {
829            assert!(
830                !diagnostics.is_empty(),
831                "{} has no failure diagnostic",
832                self.id
833            );
834        }
835        result
836    }