about summary refs log tree commit diff
path: root/src/comp
diff options
context:
space:
mode:
authorMarijn Haverbeke <marijnh@gmail.com>2011-09-14 15:30:59 +0200
committerMarijn Haverbeke <marijnh@gmail.com>2011-09-14 15:30:59 +0200
commita3c449df7426ea2f34be15fb5312a2620f871668 (patch)
tree9c48a799c22e3e6afd52e3056018c6e62c76a999 /src/comp
parentcd0e7fc041695596865b5bb875c8f4b93ffd57ba (diff)
downloadrust-a3c449df7426ea2f34be15fb5312a2620f871668.tar.gz
rust-a3c449df7426ea2f34be15fb5312a2620f871668.zip
Make ast_map.rs index function args, switch it over to simple_visitor
Diffstat (limited to 'src/comp')
-rw-r--r--src/comp/middle/ast_map.rs28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/comp/middle/ast_map.rs b/src/comp/middle/ast_map.rs
index 53274625298..40e73781126 100644
--- a/src/comp/middle/ast_map.rs
+++ b/src/comp/middle/ast_map.rs
@@ -8,6 +8,7 @@ tag ast_node {
     node_obj_ctor(@item);
     node_native_item(@native_item);
     node_expr(@expr);
+    node_arg(arg);
 }
 
 type map = std::map::hashmap<node_id, ast_node>;
@@ -18,32 +19,35 @@ fn map_crate(c: crate) -> map {
     // convert everything to use the smallintmap.
     let map = new_smallintmap_int_adapter::<ast_node>();
 
-    let v_map =
-        @{visit_item: bind map_item(map, _, _, _),
-          visit_native_item: bind map_native_item(map, _, _, _),
-          visit_expr: bind map_expr(map, _, _, _)
-             with *visit::default_visitor::<()>()};
-    visit::visit_crate(c, (), visit::mk_vt(v_map));
+    let v_map = visit::mk_simple_visitor
+        (@{visit_item: bind map_item(map, _),
+           visit_native_item: bind map_native_item(map, _),
+           visit_expr: bind map_expr(map, _),
+           visit_fn: bind map_fn(map, _, _, _, _, _)
+               with *visit::default_simple_visitor()});
+    visit::visit_crate(c, (), v_map);
     ret map;
 }
 
-fn map_item(map: map, i: @item, e: (), v: vt<()>) {
+fn map_fn(map: map, f: _fn, _tp: [ty_param], _sp: codemap::span,
+          _name: fn_ident, _id: node_id) {
+    for a in f.decl.inputs { map.insert(a.id, node_arg(a)); }
+}
+
+fn map_item(map: map, i: @item) {
     map.insert(i.id, node_item(i));
     alt i.node {
       item_obj(_, _, ctor_id) { map.insert(ctor_id, node_obj_ctor(i)); }
       _ { }
     }
-    visit::visit_item(i, e, v);
 }
 
-fn map_native_item(map: map, i: @native_item, e: (), v: vt<()>) {
+fn map_native_item(map: map, i: @native_item) {
     map.insert(i.id, node_native_item(i));
-    visit::visit_native_item(i, e, v);
 }
 
-fn map_expr(map: map, ex: @expr, e: (), v: vt<()>) {
+fn map_expr(map: map, ex: @expr) {
     map.insert(ex.id, node_expr(ex));
-    visit::visit_expr(ex, e, v);
 }
 
 fn new_smallintmap_int_adapter<@V>() -> std::map::hashmap<int, V> {