@@ -29,7 +29,8 @@ use syntax::ast;
29
29
use syntax:: ast_util;
30
30
use syntax:: codemap:: span;
31
31
use syntax:: print:: pprust:: expr_to_str;
32
- use syntax:: oldvisit;
32
+ use syntax:: visit;
33
+ use syntax:: visit:: Visitor ;
33
34
34
35
// vtable resolution looks for places where trait bounds are
35
36
// substituted in and figures out which vtable is used. There is some
@@ -712,11 +713,11 @@ pub fn early_resolve_expr(ex: @ast::expr,
712
713
}
713
714
}
714
715
715
- fn resolve_expr ( ex : @ast :: expr ,
716
- ( fcx , v ) : ( @ mut FnCtxt ,
717
- oldvisit :: vt < @mut FnCtxt > ) ) {
716
+ fn resolve_expr ( v : & mut VtableResolveVisitor ,
717
+ ex : @ast :: expr ,
718
+ fcx : @mut FnCtxt ) {
718
719
early_resolve_expr ( ex, fcx, false ) ;
719
- oldvisit :: visit_expr ( ex , ( fcx , v ) ) ;
720
+ visit :: walk_expr ( v , ex , fcx ) ;
720
721
}
721
722
722
723
pub fn resolve_impl ( ccx : @mut CrateCtxt , impl_item : @ast:: item ) {
@@ -763,12 +764,20 @@ pub fn resolve_impl(ccx: @mut CrateCtxt, impl_item: @ast::item) {
763
764
}
764
765
}
765
766
767
+ struct VtableResolveVisitor ;
768
+
769
+ impl visit:: Visitor < @mut FnCtxt > for VtableResolveVisitor {
770
+ fn visit_expr ( & mut self , ex : @ast:: expr , e : @mut FnCtxt ) {
771
+ resolve_expr ( self , ex, e) ;
772
+ }
773
+ fn visit_item ( & mut self , _: @ast:: item , _: @mut FnCtxt ) {
774
+ // no-op
775
+ }
776
+ }
777
+
766
778
// Detect points where a trait-bounded type parameter is
767
779
// instantiated, resolve the impls for the parameters.
768
780
pub fn resolve_in_block ( fcx : @mut FnCtxt , bl : & ast:: Block ) {
769
- oldvisit:: visit_block ( bl, ( fcx, oldvisit:: mk_vt ( @oldvisit:: Visitor {
770
- visit_expr : resolve_expr,
771
- visit_item : |_, _| { } ,
772
- .. * oldvisit:: default_visitor ( )
773
- } ) ) ) ;
781
+ let mut visitor = VtableResolveVisitor ;
782
+ visit:: walk_block ( & mut visitor, bl, fcx) ;
774
783
}
0 commit comments