ClassBuilder class
#include <slang/ast/symbols/SymbolBuilders.h>
A helper class for constructing class types programmatically.
Constructors, destructors, conversion operators
-
ClassBuilder(Compilation& compilation,
std::
string_view name) - Constructs a new class type with the given name, which starts with the built-in methods that every class has (randomize, srandom, etc).
- ClassBuilder(Compilation& compilation, ClassType& existing)
- Adds the built-in methods that every class has to an existing class type, such as a specialization of a built-in generic class, which must not already have them.
Public functions
-
MethodBuilder addMethod(std::
string_view name, const Type& returnType, SubroutineKind kind = SubroutineKind:: Function) - Adds a method to the class with the given properties.
Public variables
- Compilation& compilation
- The compilation used to construct symbols.
- ClassType& type
- The class type being constructed.
Function documentation
MethodBuilder slang:: ast:: ClassBuilder:: addMethod(std:: string_view name,
const Type& returnType,
SubroutineKind kind = SubroutineKind:: Function)
Adds a method to the class with the given properties.
The returned builder object can be used to modify the method further.