slang::GenericClassDefSymbol class

Represents a generic class definition, which is a parameterized class that has not yet had its parameter values specified. This is a not a type – the generic class must first be specialized in order to be a type usable in expressions and declarations.

Base classes

class Symbol

Public types

class iterator
An iterator for specializations of the generic class.

Public functions

auto getDefaultSpecialization() const -> const Type*
auto getSpecialization(const BindContext& context, const ParameterValueAssignmentSyntax& syntax) const -> const Type&
auto getInvalidSpecialization() const -> const Type&
auto numSpecializations() const -> size_t
Gets the number of specializations that have been made for this generic class.
void checkForwardDecls() const
void addParameterDecl(const Definition::ParameterDecl& decl)
auto specializations() const -> iterator_range<iterator>
Gets an iterator to the specializations created for the generic class.

Public variables

bool isInterface
Set to true if the generic class is an interface class.

Function documentation

const Type* slang::GenericClassDefSymbol::getDefaultSpecialization() const

Gets the default specialization for the class, or nullptr if the generic class has no default specialization (because some parameters are not defaulted).

const Type& slang::GenericClassDefSymbol::getSpecialization(const BindContext& context, const ParameterValueAssignmentSyntax& syntax) const

Gets the specialization for the class given the specified parameter value assignments. The result is cached and reused if requested more than once.

const Type& slang::GenericClassDefSymbol::getInvalidSpecialization() const

Forces a specialization with all parameters set to invalid values. This allows determining members that aren't dependent on parameters.

void slang::GenericClassDefSymbol::checkForwardDecls() const

Checks all forward declarations for validity when considering the target type of this alias. Any inconsistencies will issue diagnostics.

void slang::GenericClassDefSymbol::addParameterDecl(const Definition::ParameterDecl& decl)

Adds a new parameter declaration to the generic class. This is only used for programmatically constructed generic classes (not sourced from syntax). Behavior is undefined if this generic class has already been instantiated and used.