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 695-699)
694    pub fn compile(&self) -> Result<harn_kernel::ProgramArtifact, Vec<harn_kernel::Diagnostic>> {
695        let result = harn_kernel::compile_source_package(
696            self.package(),
697            self.entry,
698            harn_kernel::EntryKind::Function,
699        );
700        assert_eq!(
701            result.is_ok(),
702            self.expected_ok,
703            "{} compilation decision drifted",
704            self.id
705        );
706        if let Err(diagnostics) = &result {
707            assert!(
708                !diagnostics.is_empty(),
709                "{} has no failure diagnostic",
710                self.id
711            );
712        }
713        result
714    }