diff options
author | John Hodge <tpg@mutabah.net> | 2017-01-09 23:10:22 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2017-01-09 23:10:22 +0800 |
commit | eccbff49c4e769710823b1bc2d3c85d4a161caff (patch) | |
tree | 53cea4b01474107e70c7ff392a4a1200946a78f2 | |
parent | e72371bc9780ff5fedd6ca3995e0016b7ee50858 (diff) | |
download | mrust-eccbff49c4e769710823b1bc2d3c85d4a161caff.tar.gz |
Trans Enumerate - Add inherent methods to libs
-rw-r--r-- | src/trans/enumerate.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/trans/enumerate.cpp b/src/trans/enumerate.cpp index e0f2609c..272d96f2 100644 --- a/src/trans/enumerate.cpp +++ b/src/trans/enumerate.cpp @@ -82,9 +82,10 @@ TransList Trans_Enumerate_Main(const ::HIR::Crate& crate) namespace { void Trans_Enumerate_Public_Mod(EnumState& state, const ::HIR::Module& mod, ::HIR::SimplePath mod_path) { + const bool EMIT_ALL = true; for(const auto& vi : mod.m_value_items) { - if( vi.second->is_public ) { + if( EMIT_ALL || vi.second->is_public ) { TU_MATCHA( (vi.second->ent), (e), (Import, ), @@ -113,7 +114,7 @@ namespace { for(const auto& ti : mod.m_mod_items) { - if( ti.second->is_public && ti.second->ent.is_Module() ) + if( (EMIT_ALL || ti.second->is_public) && ti.second->ent.is_Module() ) { Trans_Enumerate_Public_Mod(state, ti.second->ent.as_Module(), mod_path + ti.first); } @@ -150,7 +151,7 @@ TransList Trans_Enumerate_Public(const ::HIR::Crate& crate) ; else { - // TODO: Check Self bounds before queueing for codegen + // Check bounds before queueing for codegen if( vi.second.is_Function() ) { bool rv = true; @@ -182,6 +183,19 @@ TransList Trans_Enumerate_Public(const ::HIR::Crate& crate) } } } + for(const auto& impl : crate.m_type_impls) + { + if( impl.m_params.m_types.size() > 0 ) + continue ; + + for(const auto& fcn : impl.m_methods) + { + if( fcn.second.data.m_params.m_types.size() > 0 ) + continue ; + auto p = ::HIR::Path(impl.m_type.clone(), fcn.first); + Trans_Enumerate_FillFrom_Path(state, p, {}); + } + } auto rv = Trans_Enumerate_CommonPost(state); |