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 auto fromLookup(Compilation& compilation, const LookupResult& result) -> HierarchicalReference
Constructs a HierarchicalReference from a lookup result.

Constructors, destructors, conversion operators

HierarchicalReference() defaulted
Default constructor.

Public functions

auto isViaIfacePort() const -> bool
Returns true if the hierarchical reference was resolved via an interface port connection.
auto isUpward() const -> bool
Returns true if the hierarchical reference traverses upward through the hierarchy.
auto join(BumpAllocator& alloc, const HierarchicalReference& other) const -> const HierarchicalReference&
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.