@@ -82,7 +82,7 @@ pub trait Visitor<E:Clone> {
8282 fn visit_decl ( & mut self , d : @Decl , e : E ) { walk_decl ( self , d, e) }
8383 fn visit_expr ( & mut self , ex : @Expr , e : E ) { walk_expr ( self , ex, e) }
8484 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 ) }
8686 fn visit_generics ( & mut self , g : & Generics , e : E ) { walk_generics ( self , g, e) }
8787 fn visit_fn ( & mut self , fk : & fn_kind , fd : & fn_decl , b : P < Block > , s : Span , n : NodeId , e : E ) {
8888 walk_fn ( self , fk, fd, b, s, n , e)
@@ -120,6 +120,9 @@ pub trait Visitor<E:Clone> {
120120 fn visit_mac ( & mut self , macro : & mac , e : E ) {
121121 walk_mac ( self , macro, e)
122122 }
123+ fn visit_path ( & mut self , path : & Path , _id : ast:: NodeId , e : E ) {
124+ walk_path ( self , path, e)
125+ }
123126}
124127
125128pub 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
143146 }
144147 view_item_use( ref paths) => {
145148 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 ) => {
148151 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 ( ) ) ;
150156 }
151- view_path_glob( ref path, _) => path,
152157 view_path_list( ref path, ref list, _) => {
153158 for id in list. iter ( ) {
154159 visitor. visit_ident ( id. span , id. node . name , env. clone ( ) )
155160 }
156- path
161+ walk_path ( visitor , path, env . clone ( ) ) ;
157162 }
158- } ;
159-
160- walk_path ( visitor, path, env. clone ( ) ) ;
163+ }
161164 }
162165 }
163166 }
@@ -187,7 +190,7 @@ fn walk_explicit_self<E:Clone, V:Visitor<E>>(visitor: &mut V,
187190fn walk_trait_ref < E : Clone , V : Visitor < E > > ( visitor : & mut V ,
188191 trait_ref : & ast:: trait_ref ,
189192 env : E ) {
190- walk_path ( visitor, & trait_ref. path , env)
193+ visitor. visit_path ( & trait_ref. path , trait_ref . ref_id , env)
191194}
192195
193196pub 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) {
248251 item_trait( ref generics, ref trait_paths, ref methods) => {
249252 visitor. visit_generics ( generics, env. clone ( ) ) ;
250253 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 ( ) )
252257 }
253258 for method in methods. iter ( ) {
254259 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) {
331336 walk_lifetime_decls ( visitor, & function_declaration. lifetimes ,
332337 env. clone ( ) ) ;
333338 }
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 ( ) ) ;
336341 for bounds in bounds. iter ( ) {
337342 walk_ty_param_bounds ( visitor, bounds, env. clone ( ) )
338343 }
@@ -372,15 +377,15 @@ pub fn walk_path<E:Clone, V:Visitor<E>>(visitor: &mut V, path: &Path, env: E) {
372377pub fn walk_pat < E : Clone , V : Visitor < E > > ( visitor : & mut V , pattern : & Pat , env : E ) {
373378 match pattern. node {
374379 PatEnum ( ref path, ref children) => {
375- walk_path ( visitor, path , env. clone ( ) ) ;
380+ visitor. visit_path ( path , pattern . id , env. clone ( ) ) ;
376381 for children in children. iter ( ) {
377382 for child in children. iter ( ) {
378383 visitor. visit_pat ( * child, env. clone ( ) )
379384 }
380385 }
381386 }
382387 PatStruct ( ref path, ref fields, _) => {
383- walk_path ( visitor, path , env. clone ( ) ) ;
388+ visitor. visit_path ( path , pattern . id , env. clone ( ) ) ;
384389 for field in fields. iter ( ) {
385390 visitor. visit_pat ( field. pat , env. clone ( ) )
386391 }
@@ -396,7 +401,7 @@ pub fn walk_pat<E:Clone, V:Visitor<E>>(visitor: &mut V, pattern: &Pat, env: E) {
396401 visitor. visit_pat ( subpattern, env)
397402 }
398403 PatIdent ( _, ref path, ref optional_subpattern) => {
399- walk_path ( visitor, path , env. clone ( ) ) ;
404+ visitor. visit_path ( path , pattern . id , env. clone ( ) ) ;
400405 match * optional_subpattern {
401406 None => { }
402407 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:
617622 visitor. visit_expr ( count, env. clone ( ) )
618623 }
619624 ExprStruct ( ref path, ref fields, optional_base) => {
620- walk_path ( visitor, path , env. clone ( ) ) ;
625+ visitor. visit_path ( path , expression . id , env. clone ( ) ) ;
621626 for field in fields. iter ( ) {
622627 visitor. visit_expr ( field. expr , env. clone ( ) )
623628 }
@@ -711,7 +716,9 @@ pub fn walk_expr<E:Clone, V:Visitor<E>>(visitor: &mut V, expression: @Expr, env:
711716 visitor. visit_expr ( main_expression, env. clone ( ) ) ;
712717 visitor. visit_expr ( index_expression, env. clone ( ) )
713718 }
714- ExprPath ( ref path) => walk_path ( visitor, path, env. clone ( ) ) ,
719+ ExprPath ( ref path) => {
720+ visitor. visit_path ( path, expression. id , env. clone ( ) )
721+ }
715722 ExprSelf | ExprBreak ( _) | ExprAgain ( _) => { }
716723 ExprRet ( optional_expression) => {
717724 walk_expr_opt ( visitor, optional_expression, env. clone ( ) )
0 commit comments