pub struct DefinitionInfo {Show 13 fields
pub kind: DefKind,
pub name: Atom,
pub type_params: Vec<TypeParamInfo>,
pub body: Option<TypeId>,
pub instance_shape: Option<Arc<ObjectShape>>,
pub static_shape: Option<Arc<ObjectShape>>,
pub extends: Option<DefId>,
pub implements: Vec<DefId>,
pub enum_members: Vec<(Atom, EnumMemberValue)>,
pub exports: Vec<(Atom, DefId)>,
pub file_id: Option<u32>,
pub span: Option<(u32, u32)>,
pub symbol_id: Option<u32>,
}Expand description
Complete information about a type definition.
This is stored in DefinitionStore and retrieved by DefId.
Fields§
§kind: DefKindKind of definition (affects evaluation strategy)
name: AtomName of the definition (for diagnostics)
type_params: Vec<TypeParamInfo>Type parameters for generic definitions
body: Option<TypeId>The body TypeId (structural representation)
For lazy definitions, this may be computed on demand
instance_shape: Option<Arc<ObjectShape>>For classes: the instance type’s structural shape
static_shape: Option<Arc<ObjectShape>>For classes: the static type’s structural shape
extends: Option<DefId>For classes: parent class DefId (if extends)
implements: Vec<DefId>For classes/interfaces: implemented interfaces
enum_members: Vec<(Atom, EnumMemberValue)>For enums: member names and values
exports: Vec<(Atom, DefId)>For namespaces/modules: exported members
Maps export name to the DefId of the exported type
file_id: Option<u32>Optional file identifier for debugging
span: Option<(u32, u32)>Optional span for source location
symbol_id: Option<u32>The binder SymbolId that this DefId was created from.
Used for cross-context cycle detection: the same interface may get
different DefIds in different checker contexts, but the SymbolId
stays the same. This enables coinductive cycle detection for recursive
generic interfaces (e.g., Promise<T> vs PromiseLike<T>).
Implementations§
Source§impl DefinitionInfo
impl DefinitionInfo
Sourcepub const fn type_alias(
name: Atom,
type_params: Vec<TypeParamInfo>,
body: TypeId,
) -> Self
pub const fn type_alias( name: Atom, type_params: Vec<TypeParamInfo>, body: TypeId, ) -> Self
Create a new type alias definition.
Sourcepub fn interface(
name: Atom,
type_params: Vec<TypeParamInfo>,
properties: Vec<PropertyInfo>,
) -> Self
pub fn interface( name: Atom, type_params: Vec<TypeParamInfo>, properties: Vec<PropertyInfo>, ) -> Self
Create a new interface definition.
Sourcepub fn class(
name: Atom,
type_params: Vec<TypeParamInfo>,
instance_properties: Vec<PropertyInfo>,
static_properties: Vec<PropertyInfo>,
) -> Self
pub fn class( name: Atom, type_params: Vec<TypeParamInfo>, instance_properties: Vec<PropertyInfo>, static_properties: Vec<PropertyInfo>, ) -> Self
Create a new class definition.
Sourcepub const fn enumeration(
name: Atom,
members: Vec<(Atom, EnumMemberValue)>,
) -> Self
pub const fn enumeration( name: Atom, members: Vec<(Atom, EnumMemberValue)>, ) -> Self
Create a new enum definition.
Sourcepub const fn namespace(name: Atom, exports: Vec<(Atom, DefId)>) -> Self
pub const fn namespace(name: Atom, exports: Vec<(Atom, DefId)>) -> Self
Create a new namespace definition.
Sourcepub const fn with_extends(self, parent: DefId) -> Self
pub const fn with_extends(self, parent: DefId) -> Self
Set the extends parent for a class.
Sourcepub fn with_implements(self, interfaces: Vec<DefId>) -> Self
pub fn with_implements(self, interfaces: Vec<DefId>) -> Self
Set implemented interfaces.
Sourcepub fn with_exports(self, exports: Vec<(Atom, DefId)>) -> Self
pub fn with_exports(self, exports: Vec<(Atom, DefId)>) -> Self
Set exports for a namespace/module.
Sourcepub fn add_export(&mut self, name: Atom, def_id: DefId)
pub fn add_export(&mut self, name: Atom, def_id: DefId)
Add an export to the namespace/module.
Sourcepub fn get_export(&self, name: Atom) -> Option<DefId>
pub fn get_export(&self, name: Atom) -> Option<DefId>
Look up an export by name.
Sourcepub const fn with_file_id(self, file_id: u32) -> Self
pub const fn with_file_id(self, file_id: u32) -> Self
Set file ID for debugging.
Trait Implementations§
Source§impl Clone for DefinitionInfo
impl Clone for DefinitionInfo
Source§fn clone(&self) -> DefinitionInfo
fn clone(&self) -> DefinitionInfo
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more