@@ -82,7 +82,7 @@ pub trait Visitor<E:Clone> {
82
82
fn visit_decl ( & mut self , d : @Decl , e : E ) { walk_decl ( self , d, e) }
83
83
fn visit_expr ( & mut self , ex : @Expr , e : E ) { walk_expr ( self , ex, e) }
84
84
fn visit_expr_post ( & mut self , _ex : @Expr , _e : E ) { }
85
- fn visit_ty ( & mut self , _t : & Ty , _e : E ) { }
85
+ fn visit_ty ( & mut self , t : & Ty , e : E ) { walk_ty ( self , t , e ) }
86
86
fn visit_generics ( & mut self , g : & Generics , e : E ) { walk_generics ( self , g, e) }
87
87
fn visit_fn ( & mut self , fk : & fn_kind , fd : & fn_decl , b : P < Block > , s : Span , n : NodeId , e : E ) {
88
88
walk_fn ( self , fk, fd, b, s, n , e)
@@ -120,6 +120,9 @@ pub trait Visitor<E:Clone> {
120
120
fn visit_mac ( & mut self , macro : & mac , e : E ) {
121
121
walk_mac ( self , macro, e)
122
122
}
123
+ fn visit_path ( & mut self , path : & Path , _id : ast:: NodeId , e : E ) {
124
+ walk_path ( self , path, e)
125
+ }
123
126
}
124
127
125
128
pub fn walk_crate < E : Clone , V : Visitor < E > > ( visitor : & mut V , crate : & Crate , env : E ) {
@@ -143,21 +146,21 @@ pub fn walk_view_item<E:Clone, V:Visitor<E>>(visitor: &mut V, vi: &view_item, en
143
146
}
144
147
view_item_use( ref paths) => {
145
148
for vp in paths. iter ( ) {
146
- let path = match vp. node {
147
- view_path_simple( ident, ref path, _ ) => {
149
+ match vp. node {
150
+ view_path_simple( ident, ref path, id ) => {
148
151
visitor. visit_ident ( vp. span , ident, env. clone ( ) ) ;
149
- path
152
+ visitor. visit_path ( path, id, env. clone ( ) ) ;
153
+ }
154
+ view_path_glob( ref path, id) => {
155
+ visitor. visit_path ( path, id, env. clone ( ) ) ;
150
156
}
151
- view_path_glob( ref path, _) => path,
152
157
view_path_list( ref path, ref list, _) => {
153
158
for id in list. iter ( ) {
154
159
visitor. visit_ident ( id. span , id. node . name , env. clone ( ) )
155
160
}
156
- path
161
+ walk_path ( visitor , path, env . clone ( ) ) ;
157
162
}
158
- } ;
159
-
160
- walk_path ( visitor, path, env. clone ( ) ) ;
163
+ }
161
164
}
162
165
}
163
166
}
@@ -187,7 +190,7 @@ fn walk_explicit_self<E:Clone, V:Visitor<E>>(visitor: &mut V,
187
190
fn walk_trait_ref < E : Clone , V : Visitor < E > > ( visitor : & mut V ,
188
191
trait_ref : & ast:: trait_ref ,
189
192
env : E ) {
190
- walk_path ( visitor, & trait_ref. path , env)
193
+ visitor. visit_path ( & trait_ref. path , trait_ref . ref_id , env)
191
194
}
192
195
193
196
pub fn walk_item < E : Clone , V : Visitor < E > > ( visitor : & mut V , item : & item , env : E ) {
@@ -248,7 +251,9 @@ pub fn walk_item<E:Clone, V:Visitor<E>>(visitor: &mut V, item: &item, env: E) {
248
251
item_trait( ref generics, ref trait_paths, ref methods) => {
249
252
visitor. visit_generics ( generics, env. clone ( ) ) ;
250
253
for trait_path in trait_paths. iter ( ) {
251
- walk_path ( visitor, & trait_path. path , env. clone ( ) )
254
+ visitor. visit_path ( & trait_path. path ,
255
+ trait_path. ref_id ,
256
+ env. clone ( ) )
252
257
}
253
258
for method in methods. iter ( ) {
254
259
visitor. visit_trait_method ( method, env. clone ( ) )
@@ -331,8 +336,8 @@ pub fn walk_ty<E:Clone, V:Visitor<E>>(visitor: &mut V, typ: &Ty, env: E) {
331
336
walk_lifetime_decls ( visitor, & function_declaration. lifetimes ,
332
337
env. clone ( ) ) ;
333
338
}
334
- ty_path( ref path, ref bounds, _ ) => {
335
- walk_path ( visitor, path , env. clone ( ) ) ;
339
+ ty_path( ref path, ref bounds, id ) => {
340
+ visitor. visit_path ( path , id , env. clone ( ) ) ;
336
341
for bounds in bounds. iter ( ) {
337
342
walk_ty_param_bounds ( visitor, bounds, env. clone ( ) )
338
343
}
@@ -372,15 +377,15 @@ pub fn walk_path<E:Clone, V:Visitor<E>>(visitor: &mut V, path: &Path, env: E) {
372
377
pub fn walk_pat < E : Clone , V : Visitor < E > > ( visitor : & mut V , pattern : & Pat , env : E ) {
373
378
match pattern. node {
374
379
PatEnum ( ref path, ref children) => {
375
- walk_path ( visitor, path , env. clone ( ) ) ;
380
+ visitor. visit_path ( path , pattern . id , env. clone ( ) ) ;
376
381
for children in children. iter ( ) {
377
382
for child in children. iter ( ) {
378
383
visitor. visit_pat ( * child, env. clone ( ) )
379
384
}
380
385
}
381
386
}
382
387
PatStruct ( ref path, ref fields, _) => {
383
- walk_path ( visitor, path , env. clone ( ) ) ;
388
+ visitor. visit_path ( path , pattern . id , env. clone ( ) ) ;
384
389
for field in fields. iter ( ) {
385
390
visitor. visit_pat ( field. pat , env. clone ( ) )
386
391
}
@@ -396,7 +401,7 @@ pub fn walk_pat<E:Clone, V:Visitor<E>>(visitor: &mut V, pattern: &Pat, env: E) {
396
401
visitor. visit_pat ( subpattern, env)
397
402
}
398
403
PatIdent ( _, ref path, ref optional_subpattern) => {
399
- walk_path ( visitor, path , env. clone ( ) ) ;
404
+ visitor. visit_path ( path , pattern . id , env. clone ( ) ) ;
400
405
match * optional_subpattern {
401
406
None => { }
402
407
Some ( subpattern) => visitor. visit_pat ( subpattern, env) ,
@@ -617,7 +622,7 @@ pub fn walk_expr<E:Clone, V:Visitor<E>>(visitor: &mut V, expression: @Expr, env:
617
622
visitor. visit_expr ( count, env. clone ( ) )
618
623
}
619
624
ExprStruct ( ref path, ref fields, optional_base) => {
620
- walk_path ( visitor, path , env. clone ( ) ) ;
625
+ visitor. visit_path ( path , expression . id , env. clone ( ) ) ;
621
626
for field in fields. iter ( ) {
622
627
visitor. visit_expr ( field. expr , env. clone ( ) )
623
628
}
@@ -711,7 +716,9 @@ pub fn walk_expr<E:Clone, V:Visitor<E>>(visitor: &mut V, expression: @Expr, env:
711
716
visitor. visit_expr ( main_expression, env. clone ( ) ) ;
712
717
visitor. visit_expr ( index_expression, env. clone ( ) )
713
718
}
714
- ExprPath ( ref path) => walk_path ( visitor, path, env. clone ( ) ) ,
719
+ ExprPath ( ref path) => {
720
+ visitor. visit_path ( path, expression. id , env. clone ( ) )
721
+ }
715
722
ExprSelf | ExprBreak ( _) | ExprAgain ( _) => { }
716
723
ExprRet ( optional_expression) => {
717
724
walk_expr_opt ( visitor, optional_expression, env. clone ( ) )
0 commit comments