Spicy
Public Member Functions | Static Public Member Functions | List of all members
hilti::operator_::Registry Class Reference

#include <operator-registry.h>

Public Member Functions

const auto & byBuiltinFunctionID (const ID &id)
 
const auto & byKind (Kind kind)
 
const auto & byMethodID (const ID &id)
 
const auto & byName (const std::string_view &name)
 
std::pair< bool, std::optional< std::vector< const Operator * > > > functionCallCandidates (const expression::UnresolvedOperator *op)
 
const auto & operators () const
 
void register_ (std::unique_ptr< Operator > op)
 
void initPending (Builder *builder)
 
bool havePending () const
 
void clear ()
 
void debugEnforceBuiltInsAreResolved (Builder *builder) const
 

Static Public Member Functions

static auto & singleton ()
 

Detailed Description

Singleton registering available operators.

Member Function Documentation

◆ byBuiltinFunctionID()

const auto& hilti::operator_::Registry::byBuiltinFunctionID ( const ID id)
inline

Returns all available built-on operators of kind function call matching a given function name.

◆ byKind()

const auto& hilti::operator_::Registry::byKind ( Kind  kind)
inline

Returns all available operators of a given kind.

◆ byMethodID()

const auto& hilti::operator_::Registry::byMethodID ( const ID id)
inline

Returns all available operators of kind member call matching a given method ID.

◆ byName()

const auto& hilti::operator_::Registry::byName ( const std::string_view &  name)
inline

Returns all available operators of a given operator name.

◆ clear()

void Registry::clear ( )

Removes all registered operators, releasing their memory.

◆ debugEnforceBuiltInsAreResolved()

void Registry::debugEnforceBuiltInsAreResolved ( Builder builder) const

Aborts with an internal error if any registered built-in operators remain uninitialized. If this happens after an AST has otherwise be fully resolved, something's wrong those operator definitions (like an unknown type).

◆ functionCallCandidates()

std::pair< bool, std::optional< std::vector< const Operator * > > > Registry::functionCallCandidates ( const expression::UnresolvedOperator op)

Returns any function call operators defining a static name matching a given unresolved operator.

Parameters
opunresolved operator to match against
Returns
tuple where the 1st element is a boolean indicating if the caller should proceed checking the candidates returned as the 2nd element; if not, a match has been found but is valid for calling, and hence the caller should abort resolution

◆ havePending()

bool hilti::operator_::Registry::havePending ( ) const
inline

Returns true if any registered operators remain uninitialized.

◆ initPending()

void Registry::initPending ( Builder builder)

Attempts to initialize all pending operators. Initialization will succeed for all operators for which argument types can be fully resolved at this time; these will then be available through the registry going forward. Any operators that cannot be initialized yet will remain pending and won't be available for lookup for the time being.

Parameters
builderbuilder to use for operator initialization

◆ operators()

const auto& hilti::operator_::Registry::operators ( ) const
inline

Returns all available operators.

◆ register_()

void Registry::register_ ( std::unique_ptr< Operator op)

Registers an operator with the registry. It will not immediately become available but remain pending until initialized later.

◆ singleton()

static auto& hilti::operator_::Registry::singleton ( )
inlinestatic

Returns a singleton instance of the current class.


The documentation for this class was generated from the following files: