xo-expression: + Expression::nested_layer()

This commit is contained in:
Roland Conybeare 2024-07-03 16:18:26 -04:00
commit 91a5a2b844
10 changed files with 61 additions and 2 deletions

View file

@ -67,6 +67,18 @@ namespace xo {
return n;
}
virtual std::size_t visit_layer(VisitFn visitor_fn) override {
std::size_t n = 1;
visitor_fn(this);
n += this->test_->visit_layer(visitor_fn);
n += this->when_true_->visit_layer(visitor_fn);
n += this->when_false_->visit_layer(visitor_fn);
return n;
}
virtual ref::rp<Expression> xform_layer(TransformFn xform_fn) override {
this->test_ = this->test_->xform_layer(xform_fn);
this->when_true_ = this->when_true_->xform_layer(xform_fn);