Skip to main content

TypeDatabase

Trait TypeDatabase 

Source
pub trait TypeDatabase {
Show 59 methods // Required methods fn intern(&self, key: TypeData) -> TypeId; fn lookup(&self, id: TypeId) -> Option<TypeData>; fn intern_string(&self, s: &str) -> Atom; fn resolve_atom(&self, atom: Atom) -> String; fn resolve_atom_ref(&self, atom: Atom) -> Arc<str>; fn type_list(&self, id: TypeListId) -> Arc<[TypeId]>; fn tuple_list(&self, id: TupleListId) -> Arc<[TupleElement]>; fn template_list(&self, id: TemplateLiteralId) -> Arc<[TemplateSpan]>; fn object_shape(&self, id: ObjectShapeId) -> Arc<ObjectShape>; fn object_property_index( &self, shape_id: ObjectShapeId, name: Atom, ) -> PropertyLookup; fn function_shape(&self, id: FunctionShapeId) -> Arc<FunctionShape>; fn callable_shape(&self, id: CallableShapeId) -> Arc<CallableShape>; fn conditional_type(&self, id: ConditionalTypeId) -> Arc<ConditionalType>; fn mapped_type(&self, id: MappedTypeId) -> Arc<MappedType>; fn type_application(&self, id: TypeApplicationId) -> Arc<TypeApplication>; fn literal_string(&self, value: &str) -> TypeId; fn literal_number(&self, value: f64) -> TypeId; fn literal_boolean(&self, value: bool) -> TypeId; fn literal_bigint(&self, value: &str) -> TypeId; fn literal_bigint_with_sign(&self, negative: bool, digits: &str) -> TypeId; fn union(&self, members: Vec<TypeId>) -> TypeId; fn union_from_sorted_vec(&self, flat: Vec<TypeId>) -> TypeId; fn union2(&self, left: TypeId, right: TypeId) -> TypeId; fn union3(&self, first: TypeId, second: TypeId, third: TypeId) -> TypeId; fn intersection(&self, members: Vec<TypeId>) -> TypeId; fn intersection2(&self, left: TypeId, right: TypeId) -> TypeId; fn intersect_types_raw2(&self, left: TypeId, right: TypeId) -> TypeId; fn array(&self, element: TypeId) -> TypeId; fn tuple(&self, elements: Vec<TupleElement>) -> TypeId; fn object(&self, properties: Vec<PropertyInfo>) -> TypeId; fn object_with_flags( &self, properties: Vec<PropertyInfo>, flags: ObjectFlags, ) -> TypeId; fn object_with_flags_and_symbol( &self, properties: Vec<PropertyInfo>, flags: ObjectFlags, symbol: Option<SymbolId>, ) -> TypeId; fn object_with_index(&self, shape: ObjectShape) -> TypeId; fn function(&self, shape: FunctionShape) -> TypeId; fn callable(&self, shape: CallableShape) -> TypeId; fn template_literal(&self, spans: Vec<TemplateSpan>) -> TypeId; fn conditional(&self, conditional: ConditionalType) -> TypeId; fn mapped(&self, mapped: MappedType) -> TypeId; fn reference(&self, symbol: SymbolRef) -> TypeId; fn lazy(&self, def_id: DefId) -> TypeId; fn bound_parameter(&self, index: u32) -> TypeId; fn recursive(&self, depth: u32) -> TypeId; fn type_param(&self, info: TypeParamInfo) -> TypeId; fn type_query(&self, symbol: SymbolRef) -> TypeId; fn enum_type(&self, def_id: DefId, structural_type: TypeId) -> TypeId; fn application(&self, base: TypeId, args: Vec<TypeId>) -> TypeId; fn literal_string_atom(&self, atom: Atom) -> TypeId; fn union_preserve_members(&self, members: Vec<TypeId>) -> TypeId; fn readonly_type(&self, inner: TypeId) -> TypeId; fn keyof(&self, inner: TypeId) -> TypeId; fn index_access(&self, object_type: TypeId, index_type: TypeId) -> TypeId; fn this_type(&self) -> TypeId; fn no_infer(&self, inner: TypeId) -> TypeId; fn unique_symbol(&self, symbol: SymbolRef) -> TypeId; fn infer(&self, info: TypeParamInfo) -> TypeId; fn string_intrinsic( &self, kind: StringIntrinsicKind, type_arg: TypeId, ) -> TypeId; fn get_class_base_type(&self, symbol_id: SymbolId) -> Option<TypeId>; fn is_unit_type(&self, type_id: TypeId) -> bool; // Provided method fn object_fresh(&self, properties: Vec<PropertyInfo>) -> TypeId { ... }
}
Expand description

Query interface for the solver.

This keeps solver components generic and prevents them from reaching into concrete storage structures directly.

Required Methods§

Source

fn intern(&self, key: TypeData) -> TypeId

Source

fn lookup(&self, id: TypeId) -> Option<TypeData>

Source

fn intern_string(&self, s: &str) -> Atom

Source

fn resolve_atom(&self, atom: Atom) -> String

Source

fn resolve_atom_ref(&self, atom: Atom) -> Arc<str>

Source

fn type_list(&self, id: TypeListId) -> Arc<[TypeId]>

Source

fn tuple_list(&self, id: TupleListId) -> Arc<[TupleElement]>

Source

fn template_list(&self, id: TemplateLiteralId) -> Arc<[TemplateSpan]>

Source

fn object_shape(&self, id: ObjectShapeId) -> Arc<ObjectShape>

Source

fn object_property_index( &self, shape_id: ObjectShapeId, name: Atom, ) -> PropertyLookup

Source

fn function_shape(&self, id: FunctionShapeId) -> Arc<FunctionShape>

Source

fn callable_shape(&self, id: CallableShapeId) -> Arc<CallableShape>

Source

fn conditional_type(&self, id: ConditionalTypeId) -> Arc<ConditionalType>

Source

fn mapped_type(&self, id: MappedTypeId) -> Arc<MappedType>

Source

fn type_application(&self, id: TypeApplicationId) -> Arc<TypeApplication>

Source

fn literal_string(&self, value: &str) -> TypeId

Source

fn literal_number(&self, value: f64) -> TypeId

Source

fn literal_boolean(&self, value: bool) -> TypeId

Source

fn literal_bigint(&self, value: &str) -> TypeId

Source

fn literal_bigint_with_sign(&self, negative: bool, digits: &str) -> TypeId

Source

fn union(&self, members: Vec<TypeId>) -> TypeId

Source

fn union_from_sorted_vec(&self, flat: Vec<TypeId>) -> TypeId

Source

fn union2(&self, left: TypeId, right: TypeId) -> TypeId

Source

fn union3(&self, first: TypeId, second: TypeId, third: TypeId) -> TypeId

Source

fn intersection(&self, members: Vec<TypeId>) -> TypeId

Source

fn intersection2(&self, left: TypeId, right: TypeId) -> TypeId

Source

fn intersect_types_raw2(&self, left: TypeId, right: TypeId) -> TypeId

Raw intersection without normalization (used to avoid infinite recursion)

Source

fn array(&self, element: TypeId) -> TypeId

Source

fn tuple(&self, elements: Vec<TupleElement>) -> TypeId

Source

fn object(&self, properties: Vec<PropertyInfo>) -> TypeId

Source

fn object_with_flags( &self, properties: Vec<PropertyInfo>, flags: ObjectFlags, ) -> TypeId

Source

fn object_with_flags_and_symbol( &self, properties: Vec<PropertyInfo>, flags: ObjectFlags, symbol: Option<SymbolId>, ) -> TypeId

Source

fn object_with_index(&self, shape: ObjectShape) -> TypeId

Source

fn function(&self, shape: FunctionShape) -> TypeId

Source

fn callable(&self, shape: CallableShape) -> TypeId

Source

fn template_literal(&self, spans: Vec<TemplateSpan>) -> TypeId

Source

fn conditional(&self, conditional: ConditionalType) -> TypeId

Source

fn mapped(&self, mapped: MappedType) -> TypeId

Source

fn reference(&self, symbol: SymbolRef) -> TypeId

Source

fn lazy(&self, def_id: DefId) -> TypeId

Source

fn bound_parameter(&self, index: u32) -> TypeId

Source

fn recursive(&self, depth: u32) -> TypeId

Source

fn type_param(&self, info: TypeParamInfo) -> TypeId

Source

fn type_query(&self, symbol: SymbolRef) -> TypeId

Source

fn enum_type(&self, def_id: DefId, structural_type: TypeId) -> TypeId

Source

fn application(&self, base: TypeId, args: Vec<TypeId>) -> TypeId

Source

fn literal_string_atom(&self, atom: Atom) -> TypeId

Source

fn union_preserve_members(&self, members: Vec<TypeId>) -> TypeId

Source

fn readonly_type(&self, inner: TypeId) -> TypeId

Source

fn keyof(&self, inner: TypeId) -> TypeId

Source

fn index_access(&self, object_type: TypeId, index_type: TypeId) -> TypeId

Source

fn this_type(&self) -> TypeId

Source

fn no_infer(&self, inner: TypeId) -> TypeId

Source

fn unique_symbol(&self, symbol: SymbolRef) -> TypeId

Source

fn infer(&self, info: TypeParamInfo) -> TypeId

Source

fn string_intrinsic( &self, kind: StringIntrinsicKind, type_arg: TypeId, ) -> TypeId

Source

fn get_class_base_type(&self, symbol_id: SymbolId) -> Option<TypeId>

Get the base class type for a symbol (class/interface). Returns the TypeId of the extends clause, or None if the symbol doesn’t extend anything. This is used by the BCT algorithm to find common base classes.

Source

fn is_unit_type(&self, type_id: TypeId) -> bool

Check if a type is a “unit type” (represents exactly one value). Unit types include literals, enum members, unique symbols, null, undefined, void, never, and tuples composed entirely of unit types. Results are cached for O(1) lookup after first computation.

Provided Methods§

Source

fn object_fresh(&self, properties: Vec<PropertyInfo>) -> TypeId

Implementors§