diff options
author | John Hodge <tpg@mutabah.net> | 2016-09-25 13:30:22 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-09-25 13:30:22 +0800 |
commit | 423327162381b78599ffee6d200198665deaff26 (patch) | |
tree | 0e6647e971291426e3a2ecf10c873e1c9235a106 | |
parent | 5722f6aa867e5d979e524abd9c685094b6d8e203 (diff) | |
download | mrust-423327162381b78599ffee6d200198665deaff26.tar.gz |
Resolve Use - Visit code blocks in trait defaults
-rw-r--r-- | src/resolve/use.cpp | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/src/resolve/use.cpp b/src/resolve/use.cpp index 6f2db9d8..09c1cee9 100644 --- a/src/resolve/use.cpp +++ b/src/resolve/use.cpp @@ -145,7 +145,7 @@ void Resolve_Use_Mod(const ::AST::Crate& crate, ::AST::Module& mod, ::AST::Path Resolve_Use_Mod(crate, i.data.as_Module(), path + i.name); } } - // - Handle anon modules by iterating code (allowing correct item mappings) + // - NOTE: Handle anon modules by iterating code (allowing correct item mappings) struct NV: public AST::NodeVisitorDef @@ -173,12 +173,34 @@ void Resolve_Use_Mod(const ::AST::Crate& crate, ::AST::Module& mod, ::AST::Path } } expr_iter(crate, mod); - // TODO: Check that all code blocks are covered by these two + // TODO: Check that all code blocks are covered by these for(auto& i : mod.items()) { TU_MATCH_DEF( AST::Item, (i.data), (e), ( ), + (Trait, + for(auto& ti : e.items()) + { + TU_MATCH_DEF( AST::Item, (ti.data), (e), + ( + BUG(Span(), "Unexpected item in trait - " << ti.data.tag_str()); + ), + (Type, + ), + (Function, + if(e.code().is_valid()) { + e.code().node().visit( expr_iter ); + } + ), + (Static, + if( e.value().is_valid() ) { + e.value().node().visit( expr_iter ); + } + ) + ) + } + ), (Function, if( e.code().is_valid() ) { e.code().node().visit( expr_iter ); |