summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2018-02-18 11:29:40 +0800
committerJohn Hodge <tpg@mutabah.net>2018-02-18 11:29:40 +0800
commit82f1e61a2560a5f7e734e434eb80f01cc9424d86 (patch)
treeeb4a40816769603a457b5cd2a65ff75eca24b21a
parent0650f7867c2ef3a867c94df0a0dd361b6055c833 (diff)
downloadmrust-82f1e61a2560a5f7e734e434eb80f01cc9424d86.tar.gz
MIR Gen - Store enum path with params in RValue::Variant
-rw-r--r--src/mir/from_hir.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/mir/from_hir.cpp b/src/mir/from_hir.cpp
index a6af0450..c2b80202 100644
--- a/src/mir/from_hir.cpp
+++ b/src/mir/from_hir.cpp
@@ -1707,10 +1707,10 @@ namespace {
else
{
// Get the variant index from the enum.
- auto enum_path = node.m_path.m_path;
- enum_path.m_components.pop_back();
+ auto enum_path = node.m_path.clone();
+ enum_path.m_path.m_components.pop_back();
const auto& var_name = node.m_path.m_path.m_components.back();
- const auto& enm = m_builder.crate().get_enum_by_path(sp, enum_path);
+ const auto& enm = m_builder.crate().get_enum_by_path(sp, enum_path.m_path);
size_t idx = enm.find_variant(var_name);
ASSERT_BUG(sp, idx != SIZE_MAX, "Variant " << node.m_path.m_path << " isn't present");
@@ -1980,11 +1980,11 @@ namespace {
if( !node.m_is_struct )
{
// Get the variant index from the enum.
- auto enum_path = node.m_path.m_path;
- enum_path.m_components.pop_back();
+ auto enum_path = node.m_path.clone();
+ enum_path.m_path.m_components.pop_back();
const auto& var_name = node.m_path.m_path.m_components.back();
- const auto& enm = m_builder.crate().get_enum_by_path(sp, enum_path);
+ const auto& enm = m_builder.crate().get_enum_by_path(sp, enum_path.m_path);
auto idx = enm.find_variant(var_name);
ASSERT_BUG(sp, idx != SIZE_MAX, "Variant " << node.m_path.m_path << " isn't present");
@@ -2232,8 +2232,8 @@ namespace {
(Unbound, ),
(Opaque, ),
(Enum,
- auto enum_path = node.m_path.m_path;
- enum_path.m_components.pop_back();
+ auto enum_path = node.m_path.clone();
+ enum_path.m_path.m_components.pop_back();
const auto& var_name = node.m_path.m_path.m_components.back();
const auto& enm = *e;