pub struct Table {Show 15 fields
root: Handle,
kinds: IndexMap<Handle, NodeKind>,
parents: IndexMap<Handle, Handle>,
pub(crate) children: Map<Handle, SymMap<Handle>>,
pub(crate) lazy_imports: Map<Handle, SymMap<Path>>,
pub(crate) glob_imports: Map<Handle, Vec<Path>>,
pub(crate) names: Map<Handle, Symbol>,
pub(crate) types: Map<Handle, TypeKind>,
pub(crate) metas: Map<Handle, Vec<Expr>>,
pub(crate) impls: Map<Handle, Vec<Handle>>,
pub(crate) impl_targets: Map<Handle, Handle>,
pub(crate) anon_types: HashMap<TypeKind, Handle>,
pub(crate) lang_items: Map<&'static str, Handle>,
pub(crate) unchecked_handles: Vec<Handle>,
pub(crate) pending_impls: Vec<Handle>,
}Expand description
The table is a monolithic data structure representing everything the type checker knows about a program.
See module documentation.
Fields§
§root: Handle§kinds: IndexMap<Handle, NodeKind>This is the source of truth for handles
parents: IndexMap<Handle, Handle>§children: Map<Handle, SymMap<Handle>>§lazy_imports: Map<Handle, SymMap<Path>>§glob_imports: Map<Handle, Vec<Path>>§names: Map<Handle, Symbol>§types: Map<Handle, TypeKind>§metas: Map<Handle, Vec<Expr>>§impls: Map<Handle, Vec<Handle>>§impl_targets: Map<Handle, Handle>§anon_types: HashMap<TypeKind, Handle>§lang_items: Map<&'static str, Handle>§unchecked_handles: Vec<Handle>§pending_impls: Vec<Handle>Implementations§
Source§impl Table
impl Table
pub fn new() -> Self
Sourcepub fn new_entry(&mut self, parent: Handle, kind: NodeKind) -> Handle
pub fn new_entry(&mut self, parent: Handle, kind: NodeKind) -> Handle
Creates a new entry in the table, and returns its Handle
Sourcepub fn mark_unchecked(&mut self, item: Handle)
pub fn mark_unchecked(&mut self, item: Handle)
Marks this item as not having been typechecked
Sourcepub fn mark_impl_item(&mut self, item: Handle)
pub fn mark_impl_item(&mut self, item: Handle)
Marks this item as an impl which hasn’t been linked.
Sourcepub fn mark_lang_item(&mut self, name: &'static str, item: Handle)
pub fn mark_lang_item(&mut self, name: &'static str, item: Handle)
Marks this item as a “lang item”, to be retrieved later
Sourcepub fn get_lang_item(&self, name: &str) -> Handle
pub fn get_lang_item(&self, name: &str) -> Handle
Gets a previously marked lang-item from the table.
Sourcepub fn handle_iter(&self) -> impl Iterator<Item = Handle> + use<>
pub fn handle_iter(&self) -> impl Iterator<Item = Handle> + use<>
Sourcepub fn debug_entry_iter(&self) -> impl Iterator<Item = Entry<'_>>
pub fn debug_entry_iter(&self) -> impl Iterator<Item = Entry<'_>>
Returns handles to all nodes sequentially by Entry
Sourcepub(crate) fn inferred_type(&mut self) -> Handle
pub(crate) fn inferred_type(&mut self) -> Handle
Gets a Handle to a new NodeKind::Type with TypeKind::Inferred
Sourcepub(crate) fn type_variable(&mut self) -> Handle
pub(crate) fn type_variable(&mut self) -> Handle
Gets a Handle to a new NodeKind::Type with TypeKind::Variable
Sourcepub const fn root_entry(&self) -> Entry<'_>
pub const fn root_entry(&self) -> Entry<'_>
Gets the root Entry in the table
Sourcepub fn root_entry_mut(&mut self) -> EntryMut<'_>
pub fn root_entry_mut(&mut self) -> EntryMut<'_>
Gets the root EntryMut in the table
Sourcepub fn children(&self, node: Handle) -> Option<&SymMap<Handle>>
pub fn children(&self, node: Handle) -> Option<&SymMap<Handle>>
Gets the child map of the given Handle
Sourcepub fn lazy_imports(&self, node: Handle) -> Option<&SymMap<Path>>
pub fn lazy_imports(&self, node: Handle) -> Option<&SymMap<Path>>
Gets the lazy import map of the given Handle
Sourcepub fn glob_imports(&self, node: Handle) -> Option<&[Path]>
pub fn glob_imports(&self, node: Handle) -> Option<&[Path]>
Gets the glob-import set of the given Handle
Sourcepub fn meta(&self, node: Handle) -> Option<&[Expr]>
pub fn meta(&self, node: Handle) -> Option<&[Expr]>
Gets the meta-expressions of the given Handle
Sourcepub fn impl_target(&self, node: Handle) -> Option<Handle>
pub fn impl_target(&self, node: Handle) -> Option<Handle>
Gets the impl target of the given Handle, if there is one
Sourcepub fn reparent(&mut self, node: Handle, parent: Handle) -> Handle
pub fn reparent(&mut self, node: Handle, parent: Handle) -> Handle
Replaces the parent Handle of the given node, returning the old one
Sourcepub fn add_import(&mut self, node: Handle, name: Sym, path: Path)
pub fn add_import(&mut self, node: Handle, name: Sym, path: Path)
Adds a lazy-import to the entry at the node Handle
Sourcepub fn set_name(&mut self, node: Handle, name: Sym) -> Option<Sym>
pub fn set_name(&mut self, node: Handle, name: Sym) -> Option<Sym>
Sets the preferred name of the given node
Sourcepub fn set_ty(&mut self, node: Handle, kind: TypeKind) -> Option<TypeKind>
pub fn set_ty(&mut self, node: Handle, kind: TypeKind) -> Option<TypeKind>
Sets the TypeKind of the given node
Sourcepub fn set_meta(&mut self, node: Handle, meta: Vec<Expr>)
pub fn set_meta(&mut self, node: Handle, meta: Vec<Expr>)
Sets the meta-expressions of the given node, returning the old expressions
pub fn add_meta(&mut self, node: Handle, meta: Expr)
Sourcepub fn set_impl_target(
&mut self,
node: Handle,
target: Handle,
) -> Option<Handle>
pub fn set_impl_target( &mut self, node: Handle, target: Handle, ) -> Option<Handle>
Sets the impl target of the given node
Sourcepub fn selfty(&self, node: Handle) -> Option<Handle>
pub fn selfty(&self, node: Handle) -> Option<Handle>
Gets a handle to the local Self type, if one exists
Sourcepub fn is_transparent(&self, node: Handle) -> bool
pub fn is_transparent(&self, node: Handle) -> bool
Returns true when name resolution is allowed to defer to the parent of this node
Sourcepub fn get_child(&self, node: Handle, name: &Sym) -> Option<Handle>
pub fn get_child(&self, node: Handle, name: &Sym) -> Option<Handle>
Gets the child of this node with the given name
Sourcepub fn get_import(&self, node: Handle, name: &Sym) -> Option<Handle>
pub fn get_import(&self, node: Handle, name: &Sym) -> Option<Handle>
Searches the import hierarchy for a particular name
pub fn get_by_sym(&self, node: Handle, name: &Sym) -> Option<Handle>
Does path traversal relative to the provided node.