sun::semantic_analysis::DeclarationTable
class · Source (opens in a new tab)
class sun::semantic_analysis::DeclarationTableAllocate and retain declarations independently of symbol spelling.
Public Functions
- DeclarationTable
- add
- bindAstNode
- bindPortable
- findGlobal
- findPortable
- get
- hasGlobalNamed
- importLibraryDeclaration
- importLibraryDeclarationRecords
- importedSyntax
- module
- operator=
- registerGlobal
- session
- size
DeclarationTable
DeclarationTable()=default
public · function · Source (opens in a new tab)
sun::semantic_analysis::DeclarationTable::DeclarationTable()=defaultStart an independent table whose identities cannot be copied.
DeclarationTable(DeclarationTable &&)=default
public · function · Source (opens in a new tab)
sun::semantic_analysis::DeclarationTable::DeclarationTable(DeclarationTable &&)=defaultCreates an instance with its default state.
DeclarationTable(const DeclarationTable &)=delete
public · function · Source (opens in a new tab)
sun::semantic_analysis::DeclarationTable::DeclarationTable(const DeclarationTable &)=deleteDisallows copying so the owned state cannot be duplicated.
add
public · function · Source (opens in a new tab)
DeclarationId sun::semantic_analysis::DeclarationTable::add(DeclarationKind kind, std::string name, DeclarationId owner={}, DeclarationId module={}, std::shared_ptr< const SpecializationKey > specialization={}, DeclarationId origin={}, std::string generatedRole={}, uint64_t generatedSlot=0)Allocate an identity without making the declaration visible in a scope.
Related: DeclarationId, DeclarationKind, SpecializationKey
bindAstNode
public · function · Source (opens in a new tab)
void sun::semantic_analysis::DeclarationTable::bindAstNode(DeclarationId id, const sun::ast::ExprAST *astNode)Links a declaration to the syntax node that declares it.
Related: DeclarationId, sun::ast::ExprAST
bindPortable
public · function · Source (opens in a new tab)
void sun::semantic_analysis::DeclarationTable::bindPortable(DeclarationId id, const PortableDeclarationKey &key, const std::string &bundleHash={})Bind a portable identity exactly once, rejecting conflicting declarations.
Related: DeclarationId, PortableDeclarationKey
findGlobal
public · function · Source (opens in a new tab)
DeclarationId sun::semantic_analysis::DeclarationTable::findGlobal(const QualifiedName &name) constThe global variable with this qualified name, or an empty id.
Related: DeclarationId, QualifiedName
findPortable
public · function · Source (opens in a new tab)
DeclarationId sun::semantic_analysis::DeclarationTable::findPortable(const PortableDeclarationKey &key) constFind the session identity already assigned to an imported declaration.
Related: DeclarationId, PortableDeclarationKey
get
public · function · Source (opens in a new tab)
const DeclarationRecord & sun::semantic_analysis::DeclarationTable::get(DeclarationId id) constFind a declaration in this session; unassigned identities are errors.
Related: DeclarationRecord, DeclarationId
hasGlobalNamed
public · function · Source (opens in a new tab)
bool sun::semantic_analysis::DeclarationTable::hasGlobalNamed(const std::string &baseName) constReports whether any registered global has this unqualified name.
importLibraryDeclaration
public · function · Source (opens in a new tab)
DeclarationId sun::semantic_analysis::DeclarationTable::importLibraryDeclaration(const PortableDeclarationKey &key, DeclarationKind kind, const std::string &name, DeclarationId owner, DeclarationId module, const std::string &bundleHash={})Intern a source declaration from an artifact, validating its ownership.
Related: DeclarationId, PortableDeclarationKey, DeclarationKind
importLibraryDeclarationRecords
public · function · Source (opens in a new tab)
void sun::semantic_analysis::DeclarationTable::importLibraryDeclarationRecords(const std::vector< LibraryDeclarationRecord > &records)Restore an artifact's ownership graph before registering its syntax.
Related: LibraryDeclarationRecord
importedSyntax
public · function · Source (opens in a new tab)
DeclarationId sun::semantic_analysis::DeclarationTable::importedSyntax(const std::string &encoded, DeclarationKind kind, const std::string &name) constAttach imported syntax to its previously interned original declaration.
Related: DeclarationId, DeclarationKind
module
public · function · Source (opens in a new tab)
DeclarationId sun::semantic_analysis::DeclarationTable::module(const std::string &name, DeclarationId owner={})Intern reopened module fragments under their existing module entity.
Related: DeclarationId
operator=
operator=(const DeclarationTable &)=delete
public · function · Source (opens in a new tab)
DeclarationTable & sun::semantic_analysis::DeclarationTable::operator=(const DeclarationTable &)=deleteDisallows assignment so ownership and object identity cannot be duplicated.
Related: DeclarationTable
operator=(DeclarationTable &&)=default
public · function · Source (opens in a new tab)
DeclarationTable & sun::semantic_analysis::DeclarationTable::operator=(DeclarationTable &&)=defaultTransfers the stored state from another instance during move assignment.
Related: DeclarationTable
registerGlobal
public · function · Source (opens in a new tab)
void sun::semantic_analysis::DeclarationTable::registerGlobal(const QualifiedName &name, DeclarationId id)Records a global variable under its qualified name, so a use that comes before the declaration can find it.
Only variables declared in this program's source are recorded: those of a library and of C code have no initializer to analyze.
Related: QualifiedName, DeclarationId
session
public · function · Source (opens in a new tab)
const std::shared_ptr< const int > & sun::semantic_analysis::DeclarationTable::session() constIdentify this session even after a previous table has been destroyed.
size
public · function · Source (opens in a new tab)
size_t sun::semantic_analysis::DeclarationTable::size() constReturn how many declarations this session has allocated.
Private Fields
globalBaseNames_
private · variable · Source (opens in a new tab)
std::unordered_set<std::string> sun::semantic_analysis::DeclarationTable::globalBaseNames_No documentation comment.
globals_
private · variable · Source (opens in a new tab)
std::unordered_map<QualifiedName, DeclarationId> sun::semantic_analysis::DeclarationTable::globals_No documentation comment.
Related: QualifiedName, DeclarationId
modules_
private · variable · Source (opens in a new tab)
std::map<std::pair<DeclarationId, std::string>, DeclarationId> sun::semantic_analysis::DeclarationTable::modules_No documentation comment.
Related: DeclarationId
portableDeclarations_
private · variable · Source (opens in a new tab)
std::map<PortableDeclarationKey, DeclarationId> sun::semantic_analysis::DeclarationTable::portableDeclarations_No documentation comment.
Related: PortableDeclarationKey, DeclarationId
records_
private · variable · Source (opens in a new tab)
std::deque<DeclarationRecord> sun::semantic_analysis::DeclarationTable::records_No documentation comment.
Related: DeclarationRecord
session_
private · variable · Source (opens in a new tab)
std::shared_ptr<const int> sun::semantic_analysis::DeclarationTable::session_ = std::make_shared<const int>(0)No documentation comment.