diff options
author | John Hodge <tpg@mutabah.net> | 2018-12-29 16:55:27 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2018-12-29 16:55:27 +0800 |
commit | cdedfd8738aa488f7b87fd65ac8ab160c0947b18 (patch) | |
tree | 8aede68f2c1a317adac1e69e7ea757dce8c1310e /src/resolve/index.cpp | |
parent | be45bb67e1cbcb3c68cdf6f5c9353ce98c67ee2e (diff) | |
download | mrust-cdedfd8738aa488f7b87fd65ac8ab160c0947b18.tar.gz |
Resolve/HIR - Rough handling of `pub use macro_path;`
Diffstat (limited to 'src/resolve/index.cpp')
-rw-r--r-- | src/resolve/index.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/resolve/index.cpp b/src/resolve/index.cpp index bbcd7e58..48f2d0da 100644 --- a/src/resolve/index.cpp +++ b/src/resolve/index.cpp @@ -212,7 +212,7 @@ void Resolve_Index_Module_Base(const AST::Crate& crate, AST::Module& mod) _add_item_type(sp, mod, i.name, i.is_pub, i_data.path, !allow_collide); }} // - Values - TU_MATCH_HDRA( (i_data.path.m_bindings.value), {) + {TU_MATCH_HDRA( (i_data.path.m_bindings.value), {) TU_ARMA(Unbound, _e) { DEBUG(i.name << " - Not a value"); } @@ -226,7 +226,23 @@ void Resolve_Index_Module_Base(const AST::Crate& crate, AST::Module& mod) _add_item_value(sp, mod, i.name, i.is_pub, i_data.path, !allow_collide); TU_ARMA(Function, e) _add_item_value(sp, mod, i.name, i.is_pub, i_data.path, !allow_collide); - } + }} + // - Macros + {TU_MATCH_HDRA( (i_data.path.m_bindings.macro), {) + TU_ARMA(Unbound, _e) { + DEBUG(i.name << " - Not a macro"); + } + TU_ARMA(MacroRules, e) { + ::std::vector<::std::string> path; + path.push_back( i_data.path.m_class.as_Absolute().crate ); + for(const auto& node : i_data.path.m_class.as_Absolute().nodes ) + path.push_back( node.name() ); + mod.m_macro_imports.push_back({ + i.is_pub, i.name, mv$(path), e.mac + }); + } + // TODO: Other imports (e.g. derives, which have different naming structures) + }} } else { |