sun::semantic_analysis::FunctionTable
class · Source (opens in a new tab)
class sun::semantic_analysis::FunctionTableIndexed function table: O(1) name-based overload lookup + O(1) exact sig lookup.
Replaces std::map<string, FunctionInfo> which required O(n) prefix scans to find overloads by name.
Public Functions
- FunctionTable
- begin
- contains
- empty
- end
- find
- getOverloads
- hasName
- hasNameOrQualified
- operator=
- operator[]
- size
FunctionTable
FunctionTable(FunctionTable &&)=default
public · function · Source (opens in a new tab)
sun::semantic_analysis::FunctionTable::FunctionTable(FunctionTable &&)=defaultMove operations can use defaults.
FunctionTable(const FunctionTable &other)
public · function · Source (opens in a new tab)
sun::semantic_analysis::FunctionTable::FunctionTable(const FunctionTable &other)Copy constructor - rebuild byName_ with valid pointers.
FunctionTable()=default
public · function · Source (opens in a new tab)
sun::semantic_analysis::FunctionTable::FunctionTable()=defaultCreates an instance with its default state.
begin
begin()
public · function · Source (opens in a new tab)
iterator sun::semantic_analysis::FunctionTable::begin()Returns an iterator to the first stored entry.
Related: iterator
begin() const
public · function · Source (opens in a new tab)
const_iterator sun::semantic_analysis::FunctionTable::begin() constReturns an iterator to the first stored entry.
Related: const_iterator
contains
public · function · Source (opens in a new tab)
bool sun::semantic_analysis::FunctionTable::contains(const sun::semantic_analysis::CallableSignature &sig) constReports whether the scope contains an overload with the supplied signature.
Related: sun::semantic_analysis::CallableSignature
empty
public · function · Source (opens in a new tab)
bool sun::semantic_analysis::FunctionTable::empty() constReports whether this object contains no entries.
end
end()
public · function · Source (opens in a new tab)
iterator sun::semantic_analysis::FunctionTable::end()Returns the iterator marking the end of the stored entries.
Related: iterator
end() const
public · function · Source (opens in a new tab)
const_iterator sun::semantic_analysis::FunctionTable::end() constReturns the iterator marking the end of the stored entries.
Related: const_iterator
find
public · function · Source (opens in a new tab)
const_iterator sun::semantic_analysis::FunctionTable::find(const sun::semantic_analysis::CallableSignature &sig) constLooks up a visible by name in the accessible scopes.
Related: const_iterator, sun::semantic_analysis::CallableSignature
getOverloads
public · function · Source (opens in a new tab)
const std::vector< FunctionInfo * > * sun::semantic_analysis::FunctionTable::getOverloads(const std::string &name) constGet all overloads for a given base name (O(1) lookup).
Related: FunctionInfo
hasName
public · function · Source (opens in a new tab)
bool sun::semantic_analysis::FunctionTable::hasName(const std::string &name) constCheck if any function with this base name exists (O(1)).
hasNameOrQualified
public · function · Source (opens in a new tab)
bool sun::semantic_analysis::FunctionTable::hasNameOrQualified(const std::string &name, const std::string &qualifiedName) constCheck if any function with this base name exists, also trying qualified.
operator=
operator=(const FunctionTable &other)
public · function · Source (opens in a new tab)
FunctionTable & sun::semantic_analysis::FunctionTable::operator=(const FunctionTable &other)Copy assignment - rebuild byName_ with valid pointers.
Related: FunctionTable
operator=(FunctionTable &&)=default
public · function · Source (opens in a new tab)
FunctionTable & sun::semantic_analysis::FunctionTable::operator=(FunctionTable &&)=defaultTransfers the stored state from another instance during move assignment.
Related: FunctionTable
operator[]
public · function · Source (opens in a new tab)
FunctionInfo & sun::semantic_analysis::FunctionTable::operator[](const sun::semantic_analysis::CallableSignature &sig)Provides indexed access to the stored elements.
Related: FunctionInfo, sun::semantic_analysis::CallableSignature
size
public · function · Source (opens in a new tab)
size_t sun::semantic_analysis::FunctionTable::size() constReturns the number of stored entries.
Public Type Aliases
const_iterator
public · typedef · Source (opens in a new tab)
using sun::semantic_analysis::FunctionTable::const_iterator = std::unordered_map<
sun::semantic_analysis::CallableSignature, FunctionInfo,
sun::semantic_analysis::CallableSignatureHash>::const_iteratorAn iterator that reads entries in the scope collection.
Related: sun::semantic_analysis::CallableSignature, FunctionInfo, sun::semantic_analysis::CallableSignatureHash
iterator
public · typedef · Source (opens in a new tab)
using sun::semantic_analysis::FunctionTable::iterator = std::unordered_map<
sun::semantic_analysis::CallableSignature, FunctionInfo,
sun::semantic_analysis::CallableSignatureHash>::iteratorAn iterator that permits updating entries in the scope collection.
Related: sun::semantic_analysis::CallableSignature, FunctionInfo, sun::semantic_analysis::CallableSignatureHash
Private Functions
rebuildByName
private · function · Source (opens in a new tab)
void sun::semantic_analysis::FunctionTable::rebuildByName()Rebuild byName_ index from bySig_ (used after copy).
Private Fields
byName_
private · variable · Source (opens in a new tab)
std::unordered_map<std::string, std::vector<FunctionInfo*> > sun::semantic_analysis::FunctionTable::byName_No documentation comment.
Related: FunctionInfo
bySig_
private · variable · Source (opens in a new tab)
std::unordered_map<sun::semantic_analysis::CallableSignature, FunctionInfo, sun::semantic_analysis::CallableSignatureHash> sun::semantic_analysis::FunctionTable::bySig_No documentation comment.
Related: sun::semantic_analysis::CallableSignature, FunctionInfo, sun::semantic_analysis::CallableSignatureHash