@@ -61,23 +61,23 @@ impl MarkSymbolVisitor {
61
61
}
62
62
}
63
63
64
- fn lookup_and_handle_definition ( & mut self , id : & ast:: NodeId ,
65
- span : codemap:: Span ) {
66
- let def = match self . tcx . def_map . find ( id) {
67
- Some ( & def) => def,
68
- None => self . tcx . sess . span_bug ( span, "def ID not in def map?!" ) ,
69
- } ;
70
- let def_id = match def {
71
- ast:: DefVariant ( enum_id, _, _) => Some ( enum_id) ,
72
- ast:: DefPrimTy ( _) => None ,
73
- _ => Some ( def_id_of_def ( def) ) ,
74
- } ;
75
- match def_id {
76
- Some ( def_id) => {
77
- if should_explore ( self . tcx , def_id) {
78
- self . worklist . push ( def_id. node ) ;
64
+ fn lookup_and_handle_definition ( & mut self , id : & ast:: NodeId ) {
65
+ match self . tcx . def_map . find ( id) {
66
+ Some ( & def) => {
67
+ let def_id = match def {
68
+ ast:: DefVariant ( enum_id, _, _) => Some ( enum_id) ,
69
+ ast:: DefPrimTy ( _) => None ,
70
+ _ => Some ( def_id_of_def ( def) ) ,
71
+ } ;
72
+ match def_id {
73
+ Some ( def_id) => {
74
+ if should_explore ( self . tcx , def_id) {
75
+ self . worklist . push ( def_id. node ) ;
76
+ }
77
+ self . live_symbols . insert ( def_id. node ) ;
78
+ }
79
+ None => ( ) ,
79
80
}
80
- self . live_symbols . insert ( def_id. node ) ;
81
81
}
82
82
None => ( ) ,
83
83
}
@@ -129,9 +129,6 @@ impl Visitor<()> for MarkSymbolVisitor {
129
129
130
130
fn visit_expr ( & mut self , expr : @ast:: Expr , _: ( ) ) {
131
131
match expr. node {
132
- ast:: ExprPath ( _) | ast:: ExprStruct ( ..) => {
133
- self . lookup_and_handle_definition ( & expr. id , expr. span ) ;
134
- }
135
132
ast:: ExprMethodCall ( ..) => {
136
133
match self . method_map . find ( & expr. id ) {
137
134
Some ( & typeck:: method_map_entry {
@@ -160,12 +157,16 @@ impl Visitor<()> for MarkSymbolVisitor {
160
157
fn visit_ty ( & mut self , typ : & ast:: Ty , _: ( ) ) {
161
158
match typ. node {
162
159
ast:: ty_path( _, _, ref id) => {
163
- self . lookup_and_handle_definition ( id, typ . span ) ;
160
+ self . lookup_and_handle_definition ( id) ;
164
161
}
165
162
_ => visit:: walk_ty ( self , typ, ( ) ) ,
166
163
}
167
164
}
168
165
166
+ fn visit_path ( & mut self , _: & ast:: Path , id : ast:: NodeId , _: ( ) ) {
167
+ self . lookup_and_handle_definition ( & id) ;
168
+ }
169
+
169
170
fn visit_item ( & mut self , _item : @ast:: item , _: ( ) ) {
170
171
// Do not recurse into items. These items will be added to the
171
172
// worklist and recursed into manually if necessary.
0 commit comments