slang::MethodBuilder class

A helper class for constructing method symbols programmatically.

Constructors, destructors, conversion operators

MethodBuilder(Compilation& compilation, string_view name, const Type& returnType, SubroutineKind kind = SubroutineKind::Function)
Constructs a new method symbol with the given properties.

Public functions

auto addArg(string_view name, const Type& type, ArgumentDirection direction = ArgumentDirection::In, optional<SVInt> defaultValue = {}) -> FormalArgumentSymbol&
void addFlags(bitmask<MethodFlags> flags)
Adds flags to the method.

Public variables

Compilation& compilation
The compilation used to construct symbols.
SubroutineSymbol& symbol
The method being constructed.

Function documentation

FormalArgumentSymbol& slang::MethodBuilder::addArg(string_view name, const Type& type, ArgumentDirection direction = ArgumentDirection::In, optional<SVInt> defaultValue = {})

Adds an argument to the method with the given properties. Note that if a defaultValue is provided, the type must be integral.