Skip to content

Commit 68db3c2

Browse files
committed
---
yaml --- r: 144111 b: refs/heads/try2 c: 6986361 h: refs/heads/master i: 144109: 3d16176 144107: 0f23165 144103: f439d69 144095: 988254e v: v3
1 parent 8b2a8b3 commit 68db3c2

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
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: 78dd07b729375119d1fa020427fc064c045524ed
8+
refs/heads/try2: 6986361776ea2734886f161496281c692c283450
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/entry.rs

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ use syntax::ast::{Crate, NodeId, item, item_fn};
1515
use syntax::ast_map;
1616
use syntax::attr;
1717
use syntax::codemap::span;
18-
use syntax::oldvisit::{default_visitor, mk_vt, vt, Visitor, visit_crate};
19-
use syntax::oldvisit::{visit_item};
2018
use syntax::parse::token::special_idents;
19+
use syntax::visit;
20+
use syntax::visit::Visitor;
2121
use std::util;
2222

2323
struct EntryContext {
@@ -39,7 +39,13 @@ struct EntryContext {
3939
non_main_fns: ~[(NodeId, span)],
4040
}
4141

42-
type EntryVisitor = vt<@mut EntryContext>;
42+
struct EntryVisitor;
43+
44+
impl Visitor<@mut EntryContext> for EntryVisitor {
45+
fn visit_item(&mut self, item:@item, ctxt:@mut EntryContext) {
46+
find_item(item, ctxt, self);
47+
}
48+
}
4349

4450
pub fn find_entry_point(session: Session, crate: &Crate, ast_map: ast_map::map) {
4551

@@ -65,15 +71,14 @@ pub fn find_entry_point(session: Session, crate: &Crate, ast_map: ast_map::map)
6571
non_main_fns: ~[],
6672
};
6773

68-
visit_crate(crate, (ctxt, mk_vt(@Visitor {
69-
visit_item: |item, (ctxt, visitor)| find_item(item, ctxt, visitor),
70-
.. *default_visitor()
71-
})));
74+
let mut v = EntryVisitor;
75+
76+
visit::walk_crate(&mut v, crate, ctxt);
7277

7378
configure_main(ctxt);
7479
}
7580

76-
fn find_item(item: @item, ctxt: @mut EntryContext, visitor: EntryVisitor) {
81+
fn find_item(item: @item, ctxt: @mut EntryContext, visitor: &mut EntryVisitor) {
7782
match item.node {
7883
item_fn(*) => {
7984
if item.ident == special_idents::main {
@@ -120,7 +125,7 @@ fn find_item(item: @item, ctxt: @mut EntryContext, visitor: EntryVisitor) {
120125
_ => ()
121126
}
122127

123-
visit_item(item, (ctxt, visitor));
128+
visit::walk_item(visitor, item, ctxt);
124129
}
125130

126131
fn configure_main(ctxt: @mut EntryContext) {

0 commit comments

Comments
 (0)