xo-reader2: streamline DDefineExpr printing using xo::print::cond

This commit is contained in:
Roland Conybeare 2026-01-20 16:54:27 -05:00
commit e69db9eb8d

View file

@ -8,6 +8,7 @@
#include <xo/printable2/Printable.hpp> #include <xo/printable2/Printable.hpp>
#include <xo/facet/FacetRegistry.hpp> #include <xo/facet/FacetRegistry.hpp>
#include <xo/indentlog/scope.hpp> #include <xo/indentlog/scope.hpp>
#include <xo/indentlog/print/cond.hpp>
namespace xo { namespace xo {
using xo::print::APrintable; using xo::print::APrintable;
@ -73,21 +74,11 @@ namespace xo {
auto rhs = FacetRegistry::instance().try_variant<APrintable, auto rhs = FacetRegistry::instance().try_variant<APrintable,
AExpression>(rhs_); AExpression>(rhs_);
if (rhs_) { return ppii.pps()->pretty_struct
assert(rhs); (ppii,
"DDefineExpr",
return ppii.pps()->pretty_struct refrtag("lhs", lhs),
(ppii, refrtag("rhs", cond(rhs_, rhs, "nullptr")));
"DDefineExpr",
refrtag("lhs", lhs),
refrtag("rhs", rhs));
} else {
return ppii.pps()->pretty_struct
(ppii,
"DDefineExpr",
refrtag("lhs", lhs),
refrtag("rhs", "nullptr"));
}
} }
} /*namespace scm*/ } /*namespace scm*/