slang::ast::ASTContext::RandomizeDetails struct

A collection of information needed to bind names inside inline constraint blocks for class and scope randomize function calls.

Public variables

const Scope* classType
The scope of the class type itself, if randomizing a class.
const VariableSymbol* thisVar
If randomizing a class via a dotted handle access, this is a variable that refers to the object being randomized.
std::span<const std::string_view> nameRestrictions
A list of names to which class-scoped lookups are restricted.
flat_hash_set<const Symbol*> randVarArgs
A set of variables that were named in the arguments of the randomize call and should be treated as rand variables, even if not declared that way.
bool isRestricted
True if the constraint block has a parenthesized identifier list, in which case only names in that list (which may be empty) are looked up in class-scope.
bool inConstraintBlock
True when binding the inline constraint block, as opposed to the arguments of the randomize call.

Variable documentation

const VariableSymbol* slang::ast::ASTContext::RandomizeDetails::thisVar

If randomizing a class via a dotted handle access, this is a variable that refers to the object being randomized.

Non-static members of the class referenced in the constraint block are accessed through it.

std::span<const std::string_view> slang::ast::ASTContext::RandomizeDetails::nameRestrictions

A list of names to which class-scoped lookups are restricted.

Only used if isRestricted is true.

bool slang::ast::ASTContext::RandomizeDetails::isRestricted

True if the constraint block has a parenthesized identifier list, in which case only names in that list (which may be empty) are looked up in class-scope.

Otherwise all names are tried there first.