9 #include <unordered_map> 12 #include <hilti/ast/node_ref.h> 13 #include <hilti/base/intrusive-ptr.h> 48 bool has(
const ID&
id)
const {
return ! _findID(
id).empty(); }
58 std::vector<Referee>
lookupAll(
const ID&
id)
const {
return _findID(
id); }
61 std::optional<Referee>
lookup(
const ID&
id)
const {
62 if (
auto ids = _findID(
id); ! ids.empty() )
69 void clear() { _items.clear(); }
72 const auto&
items()
const {
return _items; }
78 for (
const auto& i : _items )
79 dst->_items.insert(i);
88 for (
const auto& i : _items )
89 dst->_items.insert(i);
100 void render(std::ostream& out,
const std::string& prefix =
"")
const;
104 Scope& operator=(
const Scope& other) =
delete;
108 using ItemMap = std::map<std::string, std::vector<NodeRef>>;
110 std::vector<Referee> _findID(
const ID&
id,
bool external =
false)
const;
111 std::vector<Referee> _findID(
const Scope* scope,
const ID&
id,
bool external =
false)
const;
114 std::vector<std::shared_ptr<Node>> _nodes;
void insert(const ID &id, NodeRef n)
Definition: scope.cc:13
void moveInto(Scope *dst)
Definition: scope.h:86
bool has(const ID &id) const
Definition: scope.h:48
Definition: intrusive-ptr.h:28
NodeRef node
Definition: scope.h:52
const auto & items() const
Definition: scope.h:72
std::optional< Referee > lookup(const ID &id) const
Definition: scope.h:61
std::string qualified
Definition: scope.h:53
void clear()
Definition: scope.h:69
Definition: node_ref.h:44
void copyInto(Scope *dst) const
Definition: scope.h:77
void render(std::ostream &out, const std::string &prefix="") const
Definition: scope.cc:89
std::vector< Referee > lookupAll(const ID &id) const
Definition: scope.h:58
bool external
Definition: scope.h:54