slang::ast::ClassType class

Represents a class definition type.

Base classes

class Type
class Scope

Public functions

auto getBaseClass() const -> const Type*
If this class derives from a base class, returns that type. Otherwise returns null.
auto getImplementedInterfaces() const -> std::span<const Type*const>
auto getDeclaredInterfaces() const -> std::span<const Type*const>
auto getBaseConstructorCall() const -> const Expression*
void checkForwardDecls() const

Public variables

const GenericClassDefSymbol* genericClass
bool isAbstract
bool isInterface
Set to true if the class is an interface class.

Function documentation

std::span<const Type*const> slang::ast::ClassType::getImplementedInterfaces() const

Gets the list of interface classes that this class implements. If this class is itself an interface class, this is instead the list of interface classes that it extends from, if any.

Note that this list is flattened from the full set of all interfaces implemented by any base classes or interface class parents, up the inheritance hierarchy.

std::span<const Type*const> slang::ast::ClassType::getDeclaredInterfaces() const

Gets the list of interface classes that this class implements, as declared in the class type declaration (i.e. it does not include any parent interfaces inherited from the ones in the declaration). If this class is itself an interface class, this is instead the list of interface classes that it extends from, if any.

const Expression* slang::ast::ClassType::getBaseConstructorCall() const

If this class has a base class with a constructor, gets the expression used to invoke that method. Otherwise returns nullptr.

void slang::ast::ClassType::checkForwardDecls() const

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

Variable documentation

const GenericClassDefSymbol* slang::ast::ClassType::genericClass

If the class type was specialized from a generic class, this is a pointer to that generic class definition.

bool slang::ast::ClassType::isAbstract

Set to true if the class is an abstract class (declared with the "virtual" keyword).