File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,9 @@ use middle::astencode;
14
14
use middle:: ty;
15
15
use middle;
16
16
17
- use syntax:: { ast, ast_map, ast_util, oldvisit} ;
17
+ use syntax:: { ast, ast_map, ast_util} ;
18
+ use syntax:: visit;
19
+ use syntax:: visit:: Visitor ;
18
20
use syntax:: ast:: * ;
19
21
20
22
use std:: float;
@@ -265,13 +267,18 @@ pub fn lookup_constness(tcx: ty::ctxt, e: &expr) -> constness {
265
267
}
266
268
}
267
269
270
+ struct ConstEvalVisitor { tcx : ty:: ctxt }
271
+
272
+ impl Visitor < ( ) > for ConstEvalVisitor {
273
+ fn visit_expr_post ( & mut self , e: @expr, _: ( ) ) {
274
+ classify ( e, self . tcx ) ;
275
+ }
276
+ }
277
+
268
278
pub fn process_crate ( crate : & ast:: Crate ,
269
279
tcx : ty:: ctxt ) {
270
- let v = oldvisit:: mk_simple_visitor ( @oldvisit:: SimpleVisitor {
271
- visit_expr_post : |e| { classify ( e, tcx) ; } ,
272
- .. * oldvisit:: default_simple_visitor ( )
273
- } ) ;
274
- oldvisit:: visit_crate ( crate , ( ( ) , v) ) ;
280
+ let mut v = ConstEvalVisitor { tcx : tcx } ;
281
+ visit:: walk_crate ( & mut v, crate , ( ) ) ;
275
282
tcx. sess . abort_if_errors ( ) ;
276
283
}
277
284
You can’t perform that action at this time.
0 commit comments