From 82f1e61a2560a5f7e734e434eb80f01cc9424d86 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sun, 18 Feb 2018 11:29:40 +0800 Subject: MIR Gen - Store enum path with params in RValue::Variant --- src/mir/from_hir.cpp | 16 ++++++++-------- 1 file 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; -- cgit v1.2.3