Struct sway_core::semantic_analysis::namespace::Root
source · pub struct Root { /* private fields */ }
Expand description
The root module, from which all other modules can be accessed.
This is equivalent to the “crate root” of a Rust crate.
We use a custom type for the Root
in order to ensure that methods that only work with
canonical paths, or that use canonical paths internally, are only called from the root. This
normally includes methods that first lookup some canonical path via use_synonyms
before using
that canonical path to look up the symbol declaration.
Methods from Deref<Target = Module>§
sourcepub fn submodules(&self) -> &OrdMap<String, Module>
pub fn submodules(&self) -> &OrdMap<String, Module>
Immutable access to this module’s submodules.
sourcepub fn insert_submodule(&mut self, name: String, submodule: Module)
pub fn insert_submodule(&mut self, name: String, submodule: Module)
Insert a submodule into this Module
.
sourcepub fn submodule(&self, path: &Path) -> Option<&Module>
pub fn submodule(&self, path: &Path) -> Option<&Module>
Lookup the submodule at the given path.
sourcepub fn submodule_mut(&mut self, path: &Path) -> Option<&mut Module>
pub fn submodule_mut(&mut self, path: &Path) -> Option<&mut Module>
Unique access to the submodule at the given path.
sourcepub fn star_import_with_reexports(
&mut self,
src: &Path,
dst: &Path,
engines: Engines<'_>
) -> CompileResult<()>
pub fn star_import_with_reexports(
&mut self,
src: &Path,
dst: &Path,
engines: Engines<'_>
) -> CompileResult<()>
Given a path to a src
module, create synonyms to every symbol in that module to the given
dst
module.
This is used when an import path contains an asterisk.
Paths are assumed to be relative to self
.
Methods from Deref<Target = Items>§
sourcepub fn symbols(&self) -> &OrdMap<Ident, TyDeclaration>
pub fn symbols(&self) -> &OrdMap<Ident, TyDeclaration>
Immutable access to the inner symbol map.