pub struct ClassTypeBuilder<'a> { /* private fields */ }Expand description
Builder for constructing class instance types.
This is a pure type computation - it knows nothing about AST nodes. It takes a base type and a list of member properties, and produces the merged instance type.
Implementations§
Source§impl<'a> ClassTypeBuilder<'a>
impl<'a> ClassTypeBuilder<'a>
pub fn new(db: &'a dyn TypeDatabase) -> Self
Sourcepub fn create_instance_type(
&self,
base_type: TypeId,
own_members: Vec<PropertyInfo>,
symbol: SymbolId,
) -> TypeId
pub fn create_instance_type( &self, base_type: TypeId, own_members: Vec<PropertyInfo>, symbol: SymbolId, ) -> TypeId
Creates a class instance type by merging base class properties with own members.
§Arguments
base_type- TheTypeIdof the base class (orTypeId::ANYif no base)own_members- Properties/methods declared directly in this classsymbol- TheSymbolIdof the class (for creating Ref type if needed)
§Returns
The TypeId representing the merged instance type.
Sourcepub fn create_constructor_type(
&self,
static_members: Vec<PropertyInfo>,
instance_type: TypeId,
constructor_params: Vec<ParamInfo>,
type_params: Vec<TypeParamInfo>,
symbol: SymbolId,
) -> TypeId
pub fn create_constructor_type( &self, static_members: Vec<PropertyInfo>, instance_type: TypeId, constructor_params: Vec<ParamInfo>, type_params: Vec<TypeParamInfo>, symbol: SymbolId, ) -> TypeId
Creates a class constructor type.
The constructor type is a callable type with:
- A construct signature that returns the instance type
- Static properties as own properties
- Optional nominal identity via the class symbol
Auto Trait Implementations§
impl<'a> Freeze for ClassTypeBuilder<'a>
impl<'a> !RefUnwindSafe for ClassTypeBuilder<'a>
impl<'a> !Send for ClassTypeBuilder<'a>
impl<'a> !Sync for ClassTypeBuilder<'a>
impl<'a> Unpin for ClassTypeBuilder<'a>
impl<'a> UnsafeUnpin for ClassTypeBuilder<'a>
impl<'a> !UnwindSafe for ClassTypeBuilder<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more