LookupResult struct
#include <slang/ast/Lookup.h>
A structure that contains the results of a name lookup operation.
Public types
- struct MemberSelector
- A structure that represents a selection of a single member from the resulting symbol found during a lookup operation.
-
using Selector = std::
variant<const syntax:: ElementSelectSyntax*, MemberSelector> - A type that represents a kind of selector for picking a child member from a found symbol.
Public functions
- Diagnostic& addDiag(const Scope& scope, DiagCode code, SourceLocation location)
- Reports a diagnostic that occurred during lookup.
- Diagnostic& addDiag(const Scope& scope, DiagCode code, SourceRange sourceRange)
- Reports a diagnostic that occurred during lookup.
- const Diagnostics& getDiagnostics() const
- Gets the list of diagnostics that occurred during lookup.
- bool hasError() const
- Returns true if an error occurred during lookup.
- void clear()
- Clears the structure of all results, as if it had been default initialized.
- void reportDiags(const ASTContext& context) const
- Reports any diagnostics that have occurred during lookup to the given AST context, which will ensure they are visible to the compilation.
- void errorIfSelectors(const ASTContext& context) const
- Issues a diagnostic if there are selectors in the lookup result.
Public variables
- const Symbol* found
- The symbol that was found by the lookup, or nullptr if no symbol was found.
- const SystemSubroutine* systemSubroutine
- If the lookup found a system subroutine, a pointer to it is returned here and the found field will be nullptr.
- uint32_t upwardCount
- If the lookup was via hierarchical path, this indicates the number of steps upward through the hierarchy we had to take before we started traversing back down to the found symbol.
- bitmask<LookupResultFlags> flags
- Flags that specify additional information about the result of the lookup.
- const ClassType* classQualifier
- If the name was resolved via the class scope resolution operator (e.g.
- SourceRange nameRange
- The portion of the name lookup syntax that resulted in this symbol being found.
- SmallVector<Selector, 4> selectors
- A list of selectors that should be applied to the found symbol.
-
SmallVector<HierarchicalReference::
Element, 2> path - If this lookup was via a hierarchical reference, this value contains information about how the path was resolved.
Typedef documentation
using slang:: ast:: LookupResult:: Selector = std:: variant<const syntax:: ElementSelectSyntax*, MemberSelector>
A type that represents a kind of selector for picking a child member from a found symbol.
This can either be a dotted member select or an indexed element select (from an array).
Function documentation
Diagnostic& slang:: ast:: LookupResult:: addDiag(const Scope& scope,
DiagCode code,
SourceLocation location)
Reports a diagnostic that occurred during lookup.
The stored diagnostics are not automatically emitted to the compilation, letting them be suppressed if desired.
Diagnostic& slang:: ast:: LookupResult:: addDiag(const Scope& scope,
DiagCode code,
SourceRange sourceRange)
Reports a diagnostic that occurred during lookup.
The stored diagnostics are not automatically emitted to the compilation, letting them be suppressed if desired.
const Diagnostics& slang:: ast:: LookupResult:: getDiagnostics() const
Gets the list of diagnostics that occurred during lookup.
The stored diagnostics are not automatically emitted to the compilation, letting them be suppressed if desired.
Variable documentation
const ClassType* slang:: ast:: LookupResult:: classQualifier
If the name was resolved via the class scope resolution operator (e.g.
C::member) or the 'super' handle, this is the class named by the last such component. Note that this can differ from the class that declares the member if it is inherited, and if the name continues with dotted components after the class scope (e.g. C::member.field) it refers to the class qualifying the first of those components rather than the final found symbol.
SmallVector<Selector, 4> slang:: ast:: LookupResult:: selectors
A list of selectors that should be applied to the found symbol.
Only applicable if the found symbol is a value symbol.