xo-reader2: streamline DDefineExpr printing using xo::print::cond
This commit is contained in:
parent
1b6775d032
commit
e69db9eb8d
1 changed files with 6 additions and 15 deletions
|
|
@ -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*/
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue