class
#include <slang/ast/symbols/SymbolBuilders.h>
MethodBuilder A helper class for constructing method symbols programmatically.
Constructors, destructors, conversion operators
-
MethodBuilder(Compilation& compilation,
std::
string_view name, const Type& returnType, SubroutineKind kind = SubroutineKind::Function) - Constructs a new method symbol with the given properties.
Public functions
-
auto addArg(std::
string_view name, const Type& type, ArgumentDirection direction = ArgumentDirection::In, std:: optional<SVInt> defaultValue = {}) -> FormalArgumentSymbol& - Adds an argument to the method with the given properties.
- auto copyArg(const FormalArgumentSymbol& fromArg) -> FormalArgumentSymbol&
- Makes a copy of the given argument and adds it to this method.
- 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:: ast:: MethodBuilder:: addArg(std:: string_view name,
const Type& type,
ArgumentDirection direction = ArgumentDirection::In,
std:: 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.