xo-expression: minor print logging fixes

This commit is contained in:
Roland Conybeare 2024-08-28 00:57:17 -04:00
commit 24d9d504b5
2 changed files with 13 additions and 7 deletions

View file

@ -66,10 +66,13 @@ namespace xo {
}
virtual void display(std::ostream & os) const override {
os << "<Constant"
<< xtag("type", value_td_->short_name())
<< xtag("value", value_)
<< ">";
os << "<Constant";
if (value_td_)
os << xtag("type", value_td_->short_name());
else
os << xtag("type", "nullptr");;
os << xtag("value", value_);
os << ">";
}
private:

View file

@ -18,9 +18,12 @@ namespace xo {
void
Variable::display(std::ostream & os) const {
os << "<Variable"
<< xtag("name", name_)
<< xtag("type", this->valuetype()->short_name())
<< ">";
<< xtag("name", name_);
if (this->valuetype())
os << xtag("type", this->valuetype()->short_name());
else
os << xtag("type", "nullptr");
os << ">";
} /*display*/
} /*namespace ast*/
} /*namespace xo*/