slang::ast::HierarchicalReference class

Represents a hierarchical reference to a symbol.

Public types

struct Element
An element in the hierarchical path.

Public static functions

static HierarchicalReference fromLookup(Compilation& compilation, const LookupResult& result)
Constructs a HierarchicalReference from a lookup result.

Constructors, destructors, conversion operators

HierarchicalReference() defaulted
Default constructor.

Public functions

bool isViaIfacePort() const
Returns true if the hierarchical reference was resolved via an interface port connection.
bool isUpward() const
Returns true if the hierarchical reference traverses upward through the hierarchy.
const HierarchicalReference& join(BumpAllocator& alloc, const HierarchicalReference& other) const
Returns a new HierarchicalReference that represents the joined path of this reference and another.

Public variables

const Symbol* target
The target symbol of the hierarchical reference.
const Expression* expr
The expression that was used to start the lookup, typically a HierarchicalValueExpression.
std::span<const Element> path
The resolved path to the target symbol.
size_t upwardCount
The number of times the path traverses upward before going back down the hierarchy to reach the target symbol.