xo-expression: + Expression::get_free_variables()
This commit is contained in:
parent
28884e1f4f
commit
b7db7c5454
7 changed files with 59 additions and 0 deletions
|
|
@ -40,6 +40,21 @@ namespace xo {
|
|||
|
||||
// ----- Expression -----
|
||||
|
||||
virtual std::set<std::string> get_free_variables() const override {
|
||||
std::set<std::string> retval = test_->get_free_variables();
|
||||
|
||||
std::set<std::string> free_vars;
|
||||
free_vars = when_true_->get_free_variables();
|
||||
for (const auto & s : free_vars)
|
||||
retval.insert(s);
|
||||
|
||||
free_vars = when_false_->get_free_variables();
|
||||
for (const auto & s : free_vars)
|
||||
retval.insert(s);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
virtual std::size_t visit_preorder(VisitFn visitor_fn) override {
|
||||
std::size_t n = 1;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue