sun::semantic_analysis::FunctionTable

sun::semantic_analysis::FunctionTable

class · Source (opens in a new tab)

class sun::semantic_analysis::FunctionTable

Indexed 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

FunctionTable(FunctionTable &&)=default

public · function · Source (opens in a new tab)

sun::semantic_analysis::FunctionTable::FunctionTable(FunctionTable &&)=default

Move 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()=default

Creates 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() const

Returns 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) const

Reports 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() const

Reports 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() const

Returns 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) const

Looks 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) const

Get 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) const

Check 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) const

Check 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 &&)=default

Transfers 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() const

Returns 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_iterator

An 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>::iterator

An 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