Skip to content

Commit b5a0ef8

Browse files
committed
---
yaml --- r: 144100 b: refs/heads/try2 c: 3281d58 h: refs/heads/master v: v3
1 parent 4f7818d commit b5a0ef8

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 92907216258e26d70cd49371f74e6bab511b5332
8+
refs/heads/try2: 3281d58a5d6b719219c451b490d2758a8770e16a
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/librustc/middle/typeck/collect.rs

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,26 @@ use syntax::ast_util::{local_def, split_trait_methods};
5656
use syntax::codemap::span;
5757
use syntax::codemap;
5858
use syntax::print::pprust::{path_to_str, explicit_self_to_str};
59-
use syntax::oldvisit;
59+
use syntax::visit;
6060
use syntax::opt_vec::OptVec;
6161
use syntax::opt_vec;
6262
use syntax::parse::token::special_idents;
6363

64+
struct CollectItemTypesVisitor {
65+
ccx: @mut CrateCtxt
66+
}
67+
68+
impl visit::Visitor<()> for CollectItemTypesVisitor {
69+
fn visit_item(&mut self, i:@ast::item, _:()) {
70+
convert(self.ccx, i);
71+
visit::walk_item(self, i, ());
72+
}
73+
fn visit_foreign_item(&mut self, i:@ast::foreign_item, _:()) {
74+
convert_foreign(self.ccx, i);
75+
visit::walk_foreign_item(self, i, ());
76+
}
77+
}
78+
6479
pub fn collect_item_types(ccx: @mut CrateCtxt, crate: &ast::Crate) {
6580
fn collect_intrinsic_type(ccx: &CrateCtxt,
6681
lang_item: ast::def_id) {
@@ -76,13 +91,8 @@ pub fn collect_item_types(ccx: @mut CrateCtxt, crate: &ast::Crate) {
7691
Some(id) => { collect_intrinsic_type(ccx, id); } None => {}
7792
}
7893

79-
oldvisit::visit_crate(
80-
crate, ((),
81-
oldvisit::mk_simple_visitor(@oldvisit::SimpleVisitor {
82-
visit_item: |a| convert(ccx, a),
83-
visit_foreign_item: |a|convert_foreign(ccx, a),
84-
.. *oldvisit::default_simple_visitor()
85-
})));
94+
let mut visitor = CollectItemTypesVisitor{ ccx: ccx };
95+
visit::walk_crate(&mut visitor, crate, ());
8696
}
8797

8898
pub trait ToTy {

0 commit comments

Comments
 (0)