Spicy
Classes | Public Member Functions | List of all members
hilti::Scope Class Reference

#include <scope.h>

Inheritance diagram for hilti::Scope:
hilti::rt::intrusive_ptr::ManagedObject

Classes

struct  Referee
 

Public Member Functions

void insert (NodeRef &&n)
 
void insert (ID id, NodeRef &&n)
 
void insertNotFound (ID id)
 
bool has (const ID &id) const
 
std::vector< RefereelookupAll (const ID &id) const
 
std::optional< Refereelookup (const ID &id) const
 
void clear ()
 
const auto & items () const
 
void render (std::ostream &out, const std::string &prefix="") const
 
 Scope (const Scope &other)=delete
 
 Scope (Scope &&other)=delete
 
Scopeoperator= (const Scope &other)=delete
 
Scopeoperator= (Scope &&other)=delete
 

Detailed Description

Identifier scope. A scope maps identifiers to AST nodes (more precisely: to references to AST nodes). An identifier can be mapped to more than one node.

Member Function Documentation

◆ clear()

void hilti::Scope::clear ( )
inline

Empties the scope.

◆ has()

bool hilti::Scope::has ( const ID id) const
inline

Returns if there's at least one mapping for an ID.

◆ items()

const auto& hilti::Scope::items ( ) const
inline

Returns all mappings of the scope.

◆ lookup()

std::optional<Referee> hilti::Scope::lookup ( const ID id) const
inline

Returns first mapping for an ID.

◆ lookupAll()

std::vector<Referee> hilti::Scope::lookupAll ( const ID id) const
inline

Returns all mappings for an ID.

◆ render()

void Scope::render ( std::ostream &  out,
const std::string &  prefix = "" 
) const

Prints out a debugging representation of the scope's content.

Parameters
outstream to print to
prefixstring to prefix each printed scope item with

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