diff options
author | John Hodge <tpg@mutabah.net> | 2017-01-11 21:37:00 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2017-01-11 21:37:00 +0800 |
commit | d8e1c31c2158f60ce19a09723904ab0b71f7c27a (patch) | |
tree | d17b4fc061bbb0fd7ec8b8f3efca10139c6f51c6 /src/hir/hir.cpp | |
parent | 04b6360ff879a70a42fcd5f09cccc23cc2dd2d9f (diff) | |
download | mrust-d8e1c31c2158f60ce19a09723904ab0b71f7c27a.tar.gz |
All - Enable library codegen (and use crate name everywhere)
Diffstat (limited to 'src/hir/hir.cpp')
-rw-r--r-- | src/hir/hir.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/hir/hir.cpp b/src/hir/hir.cpp index f5d75101..d4a4c9be 100644 --- a/src/hir/hir.cpp +++ b/src/hir/hir.cpp @@ -733,9 +733,9 @@ const ::HIR::TypeItem& ::HIR::Crate::get_typeitem_by_path(const Span& sp, const ASSERT_BUG(sp, path.m_components.size() > (ignore_last_node ? 1 : 0), "get_typeitem_by_path received invlaid path - " << path); const ::HIR::Module* mod; - if( !ignore_crate_name && path.m_crate_name != "" ) { - ASSERT_BUG(sp, m_ext_crates.count(path.m_crate_name) > 0, "Crate '" << path.m_crate_name << "' not loaded"); - mod = &m_ext_crates.at(path.m_crate_name)->m_root_module; + if( !ignore_crate_name && path.m_crate_name != m_crate_name ) { + ASSERT_BUG(sp, m_ext_crates.count(path.m_crate_name) > 0, "Crate '" << path.m_crate_name << "' not loaded for " << path); + mod = &m_ext_crates.at(path.m_crate_name).m_data->m_root_module; } else { mod = &this->m_root_module; @@ -766,10 +766,10 @@ const ::HIR::Module& ::HIR::Crate::get_mod_by_path(const Span& sp, const ::HIR:: { if( path.m_components.size() == 0 ) { - if( path.m_crate_name != "" ) + if( path.m_crate_name != m_crate_name ) { ASSERT_BUG(sp, m_ext_crates.count(path.m_crate_name) > 0, "Crate '" << path.m_crate_name << "' not loaded"); - return m_ext_crates.at(path.m_crate_name)->m_root_module; + return m_ext_crates.at(path.m_crate_name).m_data->m_root_module; } else { @@ -834,9 +834,9 @@ const ::HIR::ValueItem& ::HIR::Crate::get_valitem_by_path(const Span& sp, const BUG(sp, "get_valitem_by_path received invalid path"); } const ::HIR::Module* mod; - if( !ignore_crate_name && path.m_crate_name != "" ) { + if( !ignore_crate_name && path.m_crate_name != m_crate_name ) { ASSERT_BUG(sp, m_ext_crates.count(path.m_crate_name) > 0, "Crate '" << path.m_crate_name << "' not loaded"); - mod = &m_ext_crates.at(path.m_crate_name)->m_root_module; + mod = &m_ext_crates.at(path.m_crate_name).m_data->m_root_module; } else { mod = &this->m_root_module; @@ -887,7 +887,7 @@ bool ::HIR::Crate::find_trait_impls(const ::HIR::SimplePath& trait, const ::HIR: } for( const auto& ec : this->m_ext_crates ) { - if( ec.second->find_trait_impls(trait, type, ty_res, callback) ) { + if( ec.second.m_data->find_trait_impls(trait, type, ty_res, callback) ) { return true; } } @@ -907,7 +907,7 @@ bool ::HIR::Crate::find_auto_trait_impls(const ::HIR::SimplePath& trait, const : } for( const auto& ec : this->m_ext_crates ) { - if( ec.second->find_auto_trait_impls(trait, type, ty_res, callback) ) { + if( ec.second.m_data->find_auto_trait_impls(trait, type, ty_res, callback) ) { return true; } } @@ -927,7 +927,7 @@ bool ::HIR::Crate::find_type_impls(const ::HIR::TypeRef& type, t_cb_resolve_type for( const auto& ec : this->m_ext_crates ) { //DEBUG("- " << ec.first); - if( ec.second->find_type_impls(type, ty_res, callback) ) { + if( ec.second.m_data->find_type_impls(type, ty_res, callback) ) { return true; } } |