pub struct LoadedPackage {
pub program: Program,
pub imports_by_file: BTreeMap<String, BTreeMap<String, String>>,
pub module_prefixes: BTreeMap<String, String>,
}Expand description
A package loaded as one unit by load_package.
Fields§
§program: ProgramEvery file’s declarations, each exactly once, all prefix-mangled.
imports_by_file: BTreeMap<String, BTreeMap<String, String>>The non-inlined imports each file makes itself — stdlib always, plus
registry/git package imports when the package was loaded without
inlining (#930) — keyed by the file’s path relative to the package root
(src/schema.lex), each mapping the import reference to its as
alias. Unlike program, this is per-file: the flattening entry points
cannot report it, because by the time they return, a file’s imports and
those of everything it imports are one undifferentiated list. The alias
is preserved so a non-default import "lex-nt/lib" as nt round-trips as
nt rather than the default last-segment lib (#909).
module_prefixes: BTreeMap<String, String>Mangling prefix → the file it belongs to (schema_a1b2 →
src/schema.lex), for every file in the package. A declaration’s
mangled name is <prefix>.<local>, so this is what lets a
consumer attribute each declaration in program back to its
source file — the record export-git needs to de-flatten the
package into its src/*.lex tree (#894).