summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-09-25 13:30:22 +0800
committerJohn Hodge <tpg@mutabah.net>2016-09-25 13:30:22 +0800
commit423327162381b78599ffee6d200198665deaff26 (patch)
tree0e6647e971291426e3a2ecf10c873e1c9235a106
parent5722f6aa867e5d979e524abd9c685094b6d8e203 (diff)
downloadmrust-423327162381b78599ffee6d200198665deaff26.tar.gz
Resolve Use - Visit code blocks in trait defaults
-rw-r--r--src/resolve/use.cpp26
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 );