diff options
author | John Hodge <tpg@ucc.asn.au> | 2019-08-24 16:50:04 +0800 |
---|---|---|
committer | John Hodge <tpg@ucc.asn.au> | 2019-08-24 16:50:04 +0800 |
commit | 47b61b93c2ac841fe44d6cc8ca8fd91bd00b0e10 (patch) | |
tree | 050cfe1f1e05efa9d0555a3d0b391c27b5f73086 /src/resolve | |
parent | e8526a24a7a05b113584ad12ac6ad35865dc9aef (diff) | |
download | mrust-47b61b93c2ac841fe44d6cc8ca8fd91bd00b0e10.tar.gz |
HIR/Expand - Hack in proc_macro re-exports (this needs to be cleaner)
Diffstat (limited to 'src/resolve')
-rw-r--r-- | src/resolve/index.cpp | 7 | ||||
-rw-r--r-- | src/resolve/use.cpp | 8 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/resolve/index.cpp b/src/resolve/index.cpp index 45fb58f5..bde59da8 100644 --- a/src/resolve/index.cpp +++ b/src/resolve/index.cpp @@ -456,6 +456,13 @@ void Resolve_Index_Module_Wildcard__use_stmt(AST::Crate& crate, AST::Module& dst DEBUG("Glob crate " << i_data.path); const auto& hmod = e.crate_->m_hir->m_root_module; Resolve_Index_Module_Wildcard__glob_in_hir_mod(sp, crate, dst_mod, hmod, i_data.path, is_pub); + // TODO: Macros too + for(const auto& pm : e.crate_->m_hir->m_proc_macros) + { + dst_mod.m_macro_imports.push_back({ + is_pub, pm.name, make_vec2(e.crate_->m_hir->m_crate_name, pm.name), nullptr + }); + } ) else TU_IFLET(::AST::PathBinding_Type, b, Module, e, DEBUG("Glob mod " << i_data.path); diff --git a/src/resolve/use.cpp b/src/resolve/use.cpp index d1b96280..8a9a3167 100644 --- a/src/resolve/use.cpp +++ b/src/resolve/use.cpp @@ -751,6 +751,14 @@ namespace { { rv.macro = ::AST::PathBinding_Macro::make_MacroRules({ &ec, &*it->second }); } + + { + auto it = ::std::find_if( ec.m_hir->m_proc_macros.begin(), ec.m_hir->m_proc_macros.end(), [&](const auto& pm){ return pm.name == name;} ); + if( it != ec.m_hir->m_proc_macros.end() ) + { + rv.macro = ::AST::PathBinding_Macro::make_ProcMacro({ &ec, name }); + } + } } return rv; } |