summaryrefslogtreecommitdiff
path: root/src/hir/dump.cpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@ucc.asn.au>2017-11-01 20:46:36 +0800
committerJohn Hodge <tpg@ucc.asn.au>2017-11-01 20:46:36 +0800
commitcb271f8ea98d1a5c65a5e636a0e73a85710027b4 (patch)
tree9694427c074c0e0d581cde6e01b6167016e0f844 /src/hir/dump.cpp
parent8306f43ccdf0414b48891aa5eb04d8901899c052 (diff)
downloadmrust-cb271f8ea98d1a5c65a5e636a0e73a85710027b4.tar.gz
HIR - Refactor enums to only embed a single field (and give variants types)
Diffstat (limited to 'src/hir/dump.cpp')
-rw-r--r--src/hir/dump.cpp45
1 files changed, 17 insertions, 28 deletions
diff --git a/src/hir/dump.cpp b/src/hir/dump.cpp
index 75dde59f..3bbbdd95 100644
--- a/src/hir/dump.cpp
+++ b/src/hir/dump.cpp
@@ -158,38 +158,27 @@ namespace {
}
m_os << indent() << "{\n";
inc_indent();
- for(const auto& var : item.m_variants)
+ if(const auto* e = item.m_data.opt_Value())
{
- m_os << indent() << var.first;
- TU_MATCHA( (var.second), (e),
- (Unit,
- ),
- (Value,
- m_os << " = ";
- if( e.val.is_Invalid() ) {
- m_os << "?";
- }
- else {
- m_os << e.val;
+ for(const auto& var : e->variants)
+ {
+ m_os << indent() << var.name;
+ }
+ }
+ else
+ {
+ for(const auto& var : item.m_data.as_Data())
+ {
+ m_os << indent() << var.name;
+ if( var.type == ::HIR::TypeRef::new_unit() )
+ {
+
}
- ),
- (Tuple,
- m_os << "(";
- for(const auto& fld : e)
- m_os << fld.ent << ", ";
- m_os << ")";
- ),
- (Struct,
- m_os << "{\n";
- inc_indent();
- for(const auto& fld : e)
+ else
{
- m_os << indent() << fld.first << ": " << fld.second.ent << ",\n";
+ m_os << " " << var.type << (var.is_struct ? "/*struct*/" : "");
}
- m_os << indent() << "}";
- dec_indent();
- )
- )
+ }
m_os << ",\n";
}
dec_indent();