feat(kernel/environment): add for_each method for traversing environment declarations
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
9e55c8766f
commit
34a9c8304a
2 changed files with 7 additions and 0 deletions
|
@ -167,4 +167,8 @@ environment environment::update(unsigned id, std::shared_ptr<environment_extensi
|
|||
(*new_exts)[id] = ext;
|
||||
return environment(m_header, m_id, m_definitions, m_global_levels, new_exts);
|
||||
}
|
||||
|
||||
void environment::for_each(std::function<void(definition const & d)> const & f) const {
|
||||
m_definitions.for_each([&](name const &, definition const & d) { return f(d); });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -196,6 +196,9 @@ public:
|
|||
is not pointer equal to the result.
|
||||
*/
|
||||
environment forget() const;
|
||||
|
||||
/** \brief Apply the function \c f to each definition */
|
||||
void for_each(std::function<void(definition const & d)> const & f) const;
|
||||
};
|
||||
|
||||
class name_generator;
|
||||
|
|
Loading…
Reference in a new issue