diff options
author | John Hodge <tpg@mutabah.net> | 2016-09-01 14:41:52 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-09-01 14:41:52 +0800 |
commit | ea65072638924847a61981f058d1f02af9fbe31d (patch) | |
tree | 6a8ba7a6da4b69c52c8d3764d5a86a2e2478daca | |
parent | 7e0eb7625025bc88812ef04432290cd5599c9904 (diff) | |
download | mrust-ea65072638924847a61981f058d1f02af9fbe31d.tar.gz |
HIR Conv - Fix case where crate name was ignored
-rw-r--r-- | src/hir_conv/bind.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/hir_conv/bind.cpp b/src/hir_conv/bind.cpp index c6e8fa5d..e296cead 100644 --- a/src/hir_conv/bind.cpp +++ b/src/hir_conv/bind.cpp @@ -144,8 +144,15 @@ namespace { TU_IFLET( ::HIR::Pattern::Value, val, Named, ve, TU_IFLET( ::HIR::Path::Data, ve.path.m_data, Generic, pe, const ::HIR::Enum* enm = nullptr; - const ::HIR::Module* mod = &m_crate.m_root_module; const auto& path = pe.m_path; + const ::HIR::Module* mod; + if( path.m_crate_name != "" ) { + ASSERT_BUG(sp, m_crate.m_ext_crates.count(path.m_crate_name) > 0, "Crate '" << path.m_crate_name << "' not loaded"); + mod = &m_crate.m_ext_crates.at(path.m_crate_name)->m_root_module; + } + else { + mod = &m_crate.m_root_module; + } for(unsigned int i = 0; i < path.m_components.size() - 1; i ++ ) { const auto& pc = path.m_components[i]; |