Struct sway_core::semantic_analysis::Namespace
source · pub struct Namespace { /* private fields */ }
Expand description
The set of items that represent the namespace context passed throughout type checking.
Implementations§
source§impl Namespace
impl Namespace
sourcepub fn init_root(init: Module) -> Self
pub fn init_root(init: Module) -> Self
Initialise the namespace at its root from the given initial namespace.
sourcepub fn mod_path(&self) -> &Path
pub fn mod_path(&self) -> &Path
A reference to the path of the module currently being type-checked.
sourcepub fn find_module_path<'a>(
&'a self,
prefixes: impl IntoIterator<Item = &'a Ident>
) -> PathBuf
pub fn find_module_path<'a>( &'a self, prefixes: impl IntoIterator<Item = &'a Ident> ) -> PathBuf
Find the module that these prefixes point to
sourcepub fn root_mut(&mut self) -> &mut Root
pub fn root_mut(&mut self) -> &mut Root
A mutable reference to the root of the project namespace.
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.
pub fn apply_storage_load( &self, engines: Engines<'_>, fields: Vec<Ident>, storage_fields: &[TyStorageField], access_span: &Span ) -> CompileResult<(TyStorageAccess, TypeId)>
pub fn set_storage_declaration(&mut self, decl_ref: DeclRef) -> CompileResult<()>
pub fn get_all_declared_symbols(&self) -> impl Iterator<Item = &Ident>
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Namespace
impl Send for Namespace
impl Sync for Namespace
impl Unpin for Namespace
impl UnwindSafe for Namespace
Blanket Implementations§
source§impl<T> AnyDebug for Twhere
T: Any + Debug,
impl<T> AnyDebug for Twhere T: Any + Debug,
source§fn as_any_ref(&self) -> &(dyn Any + 'static)
fn as_any_ref(&self) -> &(dyn Any + 'static)
Returns a reference to the underlying type as
Any
.§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.