Skip to main content

DefinitionInfo

Struct DefinitionInfo 

Source
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: DefKind

Kind of definition (affects evaluation strategy)

§name: Atom

Name 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

Source

pub const fn type_alias( name: Atom, type_params: Vec<TypeParamInfo>, body: TypeId, ) -> Self

Create a new type alias definition.

Source

pub fn interface( name: Atom, type_params: Vec<TypeParamInfo>, properties: Vec<PropertyInfo>, ) -> Self

Create a new interface definition.

Source

pub fn class( name: Atom, type_params: Vec<TypeParamInfo>, instance_properties: Vec<PropertyInfo>, static_properties: Vec<PropertyInfo>, ) -> Self

Create a new class definition.

Source

pub const fn enumeration( name: Atom, members: Vec<(Atom, EnumMemberValue)>, ) -> Self

Create a new enum definition.

Source

pub const fn namespace(name: Atom, exports: Vec<(Atom, DefId)>) -> Self

Create a new namespace definition.

Source

pub const fn with_extends(self, parent: DefId) -> Self

Set the extends parent for a class.

Source

pub fn with_implements(self, interfaces: Vec<DefId>) -> Self

Set implemented interfaces.

Source

pub fn with_exports(self, exports: Vec<(Atom, DefId)>) -> Self

Set exports for a namespace/module.

Source

pub fn add_export(&mut self, name: Atom, def_id: DefId)

Add an export to the namespace/module.

Source

pub fn get_export(&self, name: Atom) -> Option<DefId>

Look up an export by name.

Source

pub const fn with_file_id(self, file_id: u32) -> Self

Set file ID for debugging.

Source

pub const fn with_span(self, start: u32, end: u32) -> Self

Set source span.

Trait Implementations§

Source§

impl Clone for DefinitionInfo

Source§

fn clone(&self) -> DefinitionInfo

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DefinitionInfo

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more