xo-reader2 xo-expression2: streamline pretty w/ presence flag
This commit is contained in:
parent
8cca5db5a1
commit
8c93134cfe
2 changed files with 21 additions and 45 deletions
|
|
@ -93,33 +93,17 @@ namespace xo {
|
|||
= FacetRegistry::instance().try_variant<APrintable,
|
||||
AExpression>(when_false_);
|
||||
|
||||
if (when_false) {
|
||||
return ppii.pps()->pretty_struct
|
||||
(ppii,
|
||||
"DIfElseExpr",
|
||||
refrtag("typeref", typeref_),
|
||||
refrtag("test", test),
|
||||
refrtag("when_true", when_true),
|
||||
refrtag("when_false", when_false));
|
||||
} else if (when_true) {
|
||||
return ppii.pps()->pretty_struct
|
||||
(ppii,
|
||||
"DIfElseExpr",
|
||||
refrtag("typeref", typeref_),
|
||||
refrtag("test", test),
|
||||
refrtag("when_true", when_true));
|
||||
} else if (test) {
|
||||
return ppii.pps()->pretty_struct
|
||||
(ppii,
|
||||
"DIfElseExpr",
|
||||
refrtag("typeref", typeref_),
|
||||
refrtag("test", test));
|
||||
} else {
|
||||
return ppii.pps()->pretty_struct
|
||||
(ppii,
|
||||
"DIfElseExpr",
|
||||
refrtag("typeref", typeref_));
|
||||
}
|
||||
bool test_present = test;
|
||||
bool when_true_present = when_true;
|
||||
bool when_false_present = when_false;
|
||||
|
||||
return ppii.pps()->pretty_struct
|
||||
(ppii,
|
||||
"DIfElseExpr",
|
||||
refrtag("typeref", typeref_),
|
||||
refrtag("test", test, test_present),
|
||||
refrtag("when_true", when_true, when_true_present),
|
||||
refrtag("when_false", when_false, when_false_present));
|
||||
}
|
||||
|
||||
// GCObject facet
|
||||
|
|
|
|||
|
|
@ -1041,24 +1041,16 @@ namespace xo {
|
|||
obj<APrintable> rhs
|
||||
= FacetRegistry::instance().try_variant<APrintable,AExpression>(rhs_);
|
||||
|
||||
if (rhs) {
|
||||
return ppii.pps()->pretty_struct
|
||||
(ppii,
|
||||
"DProgressSsm",
|
||||
refrtag("lhs", lhs),
|
||||
refrtag("op", op_type_),
|
||||
refrtag("rhs", rhs),
|
||||
refrtag("expect", this->get_expect_str())
|
||||
);
|
||||
} else {
|
||||
return ppii.pps()->pretty_struct
|
||||
(ppii,
|
||||
"DProgressSsm",
|
||||
refrtag("lhs", lhs),
|
||||
refrtag("op", op_type_),
|
||||
refrtag("expect", this->get_expect_str())
|
||||
);
|
||||
}
|
||||
bool rhs_present = rhs;
|
||||
|
||||
return ppii.pps()->pretty_struct
|
||||
(ppii,
|
||||
"DProgressSsm",
|
||||
refrtag("lhs", lhs),
|
||||
refrtag("op", op_type_),
|
||||
refrtag("rhs", rhs, rhs_present),
|
||||
refrtag("expect", this->get_expect_str())
|
||||
);
|
||||
}
|
||||
|
||||
obj<AExpression>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue