Skip to content

Commit dac89db

Browse files
committed
---
yaml --- r: 5277 b: refs/heads/master c: a3c449d h: refs/heads/master i: 5275: 033e5bf v: v3
1 parent 5dbc465 commit dac89db

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

[refs]

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: cd0e7fc041695596865b5bb875c8f4b93ffd57ba
2+
refs/heads/master: a3c449df7426ea2f34be15fb5312a2620f871668

trunk/src/comp/middle/ast_map.rs

+16-12
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ tag ast_node {
88
node_obj_ctor(@item);
99
node_native_item(@native_item);
1010
node_expr(@expr);
11+
node_arg(arg);
1112
}
1213

1314
type map = std::map::hashmap<node_id, ast_node>;
@@ -18,32 +19,35 @@ fn map_crate(c: crate) -> map {
1819
// convert everything to use the smallintmap.
1920
let map = new_smallintmap_int_adapter::<ast_node>();
2021

21-
let v_map =
22-
@{visit_item: bind map_item(map, _, _, _),
23-
visit_native_item: bind map_native_item(map, _, _, _),
24-
visit_expr: bind map_expr(map, _, _, _)
25-
with *visit::default_visitor::<()>()};
26-
visit::visit_crate(c, (), visit::mk_vt(v_map));
22+
let v_map = visit::mk_simple_visitor
23+
(@{visit_item: bind map_item(map, _),
24+
visit_native_item: bind map_native_item(map, _),
25+
visit_expr: bind map_expr(map, _),
26+
visit_fn: bind map_fn(map, _, _, _, _, _)
27+
with *visit::default_simple_visitor()});
28+
visit::visit_crate(c, (), v_map);
2729
ret map;
2830
}
2931

30-
fn map_item(map: map, i: @item, e: (), v: vt<()>) {
32+
fn map_fn(map: map, f: _fn, _tp: [ty_param], _sp: codemap::span,
33+
_name: fn_ident, _id: node_id) {
34+
for a in f.decl.inputs { map.insert(a.id, node_arg(a)); }
35+
}
36+
37+
fn map_item(map: map, i: @item) {
3138
map.insert(i.id, node_item(i));
3239
alt i.node {
3340
item_obj(_, _, ctor_id) { map.insert(ctor_id, node_obj_ctor(i)); }
3441
_ { }
3542
}
36-
visit::visit_item(i, e, v);
3743
}
3844

39-
fn map_native_item(map: map, i: @native_item, e: (), v: vt<()>) {
45+
fn map_native_item(map: map, i: @native_item) {
4046
map.insert(i.id, node_native_item(i));
41-
visit::visit_native_item(i, e, v);
4247
}
4348

44-
fn map_expr(map: map, ex: @expr, e: (), v: vt<()>) {
49+
fn map_expr(map: map, ex: @expr) {
4550
map.insert(ex.id, node_expr(ex));
46-
visit::visit_expr(ex, e, v);
4751
}
4852

4953
fn new_smallintmap_int_adapter<@V>() -> std::map::hashmap<int, V> {

0 commit comments

Comments
 (0)