xo-reader2: support if-then-else expressions. + detailed utest

This commit is contained in:
Roland Conybeare 2026-01-27 15:50:10 -05:00
commit a69023096d
2 changed files with 55 additions and 8 deletions

View file

@ -59,6 +59,12 @@ namespace xo {
obj<AExpression> when_true,
obj<AExpression> when_false);
/** create empty if-else expression using memory from @p mm **/
static obj<AExpression,DIfElseExpr> make_empty(obj<AAllocator> mm);
/** create empty if-else expression using memory from @p mm **/
static DIfElseExpr * _make_empty(obj<AAllocator> mm);
///@}
/** @defgroup scm-ifelseexpr-access-methods **/
///@{
@ -67,6 +73,10 @@ namespace xo {
obj<AExpression> when_true() const noexcept { return when_true_; }
obj<AExpression> when_false() const noexcept { return when_false_; }
void assign_test(obj<AExpression> x) { this->test_ = x; }
void assign_when_true(obj<AExpression> x) { this->when_true_ = x; }
void assign_when_false(obj<AExpression> x) { this->when_false_ = x; }
///@}
/** @defgroup scm-ifelseexpr-expression-facet **/
///@{