Skip to main content

implicit_imports

Function implicit_imports 

Source
pub fn implicit_imports(
    written: &[Import],
    interfaces: &HashMap<Name, Interface>,
    is_core: bool,
) -> Vec<Import>
Expand description

The imports a module gets without writing them, given what it did write and which interfaces are available to it.

Empty whenever is_core is set — every module of zelkova-core gets none of the eight, including the ones named on the list themselves. That is why this no longer takes the module’s own name: a module named on the list can only belong to zelkova-core (resolve::visible_modules rejects it everywhere else), so the caller’s package-level answer already covers it and there is nothing left for a per-module check to add. Otherwise this returns one [parser::Import] per entry that written does not already name and that interfaces can satisfy — a written import of a default module replaces the implicit one, so import Maybe as M means M.map and nothing else.