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 726-730)
725 pub fn compile(&self) -> Result<harn_kernel::ProgramArtifact, Vec<harn_kernel::Diagnostic>> {
726 let result = harn_kernel::compile_source_package(
727 self.package(),
728 self.entry,
729 harn_kernel::EntryKind::Function,
730 );
731 assert_eq!(
732 result.is_ok(),
733 self.expected_ok,
734 "{} compilation decision drifted",
735 self.id
736 );
737 if let Err(diagnostics) = &result {
738 assert!(
739 !diagnostics.is_empty(),
740 "{} has no failure diagnostic",
741 self.id
742 );
743 }
744 result
745 }