diff options
author | John Hodge <tpg@ucc.asn.au> | 2017-11-01 20:46:36 +0800 |
---|---|---|
committer | John Hodge <tpg@ucc.asn.au> | 2017-11-01 20:46:36 +0800 |
commit | cb271f8ea98d1a5c65a5e636a0e73a85710027b4 (patch) | |
tree | 9694427c074c0e0d581cde6e01b6167016e0f844 /src/mir/mir.cpp | |
parent | 8306f43ccdf0414b48891aa5eb04d8901899c052 (diff) | |
download | mrust-cb271f8ea98d1a5c65a5e636a0e73a85710027b4.tar.gz |
HIR - Refactor enums to only embed a single field (and give variants types)
Diffstat (limited to 'src/mir/mir.cpp')
-rw-r--r-- | src/mir/mir.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/mir/mir.cpp b/src/mir/mir.cpp index 6af64001..18557304 100644 --- a/src/mir/mir.cpp +++ b/src/mir/mir.cpp @@ -384,8 +384,6 @@ namespace MIR { (Struct, if( are.path != bre.path ) return false; - if( are.variant_idx != bre.variant_idx ) - return false; return are.vals == bre.vals; ) ) @@ -610,13 +608,13 @@ namespace MIR { (Variant, return ::MIR::RValue::make_Variant({ e.path.clone(), e.index, e.val.clone() }); ), - // Create a new instance of a struct (or enum) + // Create a new instance of a struct (Struct, decltype(e.vals) ret; ret.reserve(e.vals.size()); for(const auto& v : e.vals) ret.push_back( v.clone() ); - return ::MIR::RValue::make_Struct({ e.path.clone(), e.variant_idx, mv$(ret) }); + return ::MIR::RValue::make_Struct({ e.path.clone(), mv$(ret) }); ) ) throw ""; |