diff --git a/src/comp/middle/alias.rs b/src/comp/middle/alias.rs index 5e80f7b3dbb..959f5e02e17 100644 --- a/src/comp/middle/alias.rs +++ b/src/comp/middle/alias.rs @@ -61,7 +61,7 @@ fn check_crate(tcx: ty::ctxt, crate: @ast::crate) -> (copy_map, ref_map) { copy_map: std::map::new_int_hash(), ref_map: std::map::new_int_hash(), mutable silent: false}; - let v = @{visit_fn_body: bind visit_fn_body(cx, _, _, _, _, _, _, _), + let v = @{visit_fn: bind visit_fn(cx, _, _, _, _, _, _, _, _), visit_expr: bind visit_expr(cx, _, _, _), visit_block: bind visit_block(cx, _, _, _) with *visit::default_visitor::()}; @@ -71,9 +71,9 @@ fn check_crate(tcx: ty::ctxt, crate: @ast::crate) -> (copy_map, ref_map) { ret (cx.copy_map, cx.ref_map); } -fn visit_fn_body(cx: @ctx, decl: ast::fn_decl, body: ast::blk, - sp: span, _name: ast::fn_ident, - id: ast::node_id, sc: scope, v: vt) { +fn visit_fn(cx: @ctx, decl: ast::fn_decl, _ts: [ast::ty_param], + body: ast::blk, sp: span, _name: ast::fn_ident, + id: ast::node_id, sc: scope, v: vt) { visit::visit_fn_decl(decl, sc, v); let fty = ty::node_id_to_type(cx.tcx, id); let args = ty::ty_fn_args(cx.tcx, fty); diff --git a/src/comp/middle/ast_map.rs b/src/comp/middle/ast_map.rs index 0b0d0337d2d..995c16ddb2c 100644 --- a/src/comp/middle/ast_map.rs +++ b/src/comp/middle/ast_map.rs @@ -32,7 +32,7 @@ fn map_crate(c: crate) -> map { (@{visit_item: bind map_item(cx, _), visit_native_item: bind map_native_item(cx, _), visit_expr: bind map_expr(cx, _), - visit_fn_body: bind map_fn_body(cx, _, _, _, _, _), + visit_fn: bind map_fn(cx, _, _, _, _, _, _), visit_local: bind map_local(cx, _), visit_arm: bind map_arm(cx, _) with *visit::default_simple_visitor()}); @@ -40,8 +40,8 @@ fn map_crate(c: crate) -> map { ret cx.map; } -fn map_fn_body(cx: ctx, decl: fn_decl, _body: blk, - _sp: codemap::span, _n: fn_ident, _id: node_id) { +fn map_fn(cx: ctx, decl: fn_decl, _tps: [ty_param], _body: blk, + _sp: codemap::span, _n: fn_ident, _id: node_id) { for a in decl.inputs { cx.map.insert(a.id, node_arg(a, cx.local_id)); cx.local_id += 1u; diff --git a/src/comp/middle/freevars.rs b/src/comp/middle/freevars.rs index 9490b9e9ac1..9e18bae4a2e 100644 --- a/src/comp/middle/freevars.rs +++ b/src/comp/middle/freevars.rs @@ -82,15 +82,15 @@ fn annotate_freevars(def_map: resolve::def_map, crate: @ast::crate) -> freevar_map { let freevars = new_int_hash(); - let walk_fn_body = lambda (_decl: ast::fn_decl, blk: ast::blk, - _sp: span, _nm: ast::fn_ident, - nid: ast::node_id) { + let walk_fn = lambda (_decl: ast::fn_decl, _tps: [ast::ty_param], + blk: ast::blk, _sp: span, _nm: ast::fn_ident, + nid: ast::node_id) { let vars = collect_freevars(def_map, blk); freevars.insert(nid, vars); }; let visitor = - visit::mk_simple_visitor(@{visit_fn_body: walk_fn_body + visit::mk_simple_visitor(@{visit_fn: walk_fn with *visit::default_simple_visitor()}); visit::visit_crate(*crate, (), visitor); diff --git a/src/comp/middle/kind.rs b/src/comp/middle/kind.rs index 241ca951e24..2c9952ddec9 100644 --- a/src/comp/middle/kind.rs +++ b/src/comp/middle/kind.rs @@ -43,7 +43,7 @@ fn check_crate(tcx: ty::ctxt, method_map: typeck::method_map, let visit = visit::mk_vt(@{ visit_expr: check_expr, visit_stmt: check_stmt, - visit_fn_body: check_fn_body + visit_fn: check_fn with *visit::default_visitor() }); visit::visit_crate(*crate, ctx, visit); @@ -66,8 +66,8 @@ fn with_closure_check_fn(cx: ctx, id: node_id, // Check that the free variables used in a shared/sendable closure conform // to the copy/move kind bounds. Then recursively check the function body. -fn check_fn_body(decl: fn_decl, body: blk, sp: span, i: fn_ident, id: node_id, - cx: ctx, v: visit::vt) { +fn check_fn(decl: fn_decl, tps: [ty_param], body: blk, sp: span, + i: fn_ident, id: node_id, cx: ctx, v: visit::vt) { // n.b.: This could be the body of either a fn decl or a fn expr. In the // former case, the prototype will be proto_bare and no check occurs. In @@ -87,7 +87,7 @@ fn check_fn_body(decl: fn_decl, body: blk, sp: span, i: fn_ident, id: node_id, } } - visit::visit_fn_body(decl, body, sp, i, id, cx, v); + visit::visit_fn(decl, tps, body, sp, i, id, cx, v); } fn check_fn_cap_clause(cx: ctx, diff --git a/src/comp/middle/last_use.rs b/src/comp/middle/last_use.rs index 3f5454700c1..7b1a0b6c0a3 100644 --- a/src/comp/middle/last_use.rs +++ b/src/comp/middle/last_use.rs @@ -43,7 +43,7 @@ type ctx = {last_uses: std::map::hashmap, fn find_last_uses(c: @crate, def_map: resolve::def_map, ref_map: alias::ref_map, tcx: ty::ctxt) -> last_uses { let v = visit::mk_vt(@{visit_expr: visit_expr, - visit_fn_body: visit_fn_body + visit_fn: visit_fn with *visit::default_visitor()}); let cx = {last_uses: std::map::new_int_hash(), def_map: def_map, @@ -153,19 +153,19 @@ fn visit_expr(ex: @expr, cx: ctx, v: visit::vt) { } } -fn visit_fn_body(decl: fn_decl, body: blk, - sp: span, nm: fn_ident, id: node_id, - cx: ctx, v: visit::vt) { +fn visit_fn(decl: fn_decl, tps: [ty_param], body: blk, + sp: span, nm: fn_ident, id: node_id, + cx: ctx, v: visit::vt) { let fty = ty::node_id_to_type(cx.tcx, id); let proto = ty::ty_fn_proto(cx.tcx, fty); if proto == proto_block { visit_block(func, cx, {|| - visit::visit_fn_body(decl, body, sp, nm, id, cx, v); + visit::visit_fn(decl, tps, body, sp, nm, id, cx, v); }); } else { let old = nil; cx.blocks <-> old; - visit::visit_fn_body(decl, body, sp, nm, id, cx, v); + visit::visit_fn(decl, tps, body, sp, nm, id, cx, v); cx.blocks <-> old; leave_fn(cx); } diff --git a/src/comp/middle/resolve.rs b/src/comp/middle/resolve.rs index 3a2b6ef966c..3c633e0e9ff 100644 --- a/src/comp/middle/resolve.rs +++ b/src/comp/middle/resolve.rs @@ -336,8 +336,7 @@ fn resolve_names(e: @env, c: @ast::crate) { visit_expr: bind walk_expr(e, _, _, _), visit_ty: bind walk_ty(e, _, _, _), visit_constr: bind walk_constr(e, _, _, _, _, _), - visit_fn_proto: - bind visit_fn_proto_with_scope(e, _, _, _, _, _, _, _, _) + visit_fn: bind visit_fn_with_scope(e, _, _, _, _, _, _, _, _) with *visit::default_visitor()}; visit::visit_crate(*c, cons(scope_crate, @nil), visit::mk_vt(v)); e.used_imports.track = false; @@ -403,8 +402,8 @@ fn visit_item_with_scope(i: @ast::item, sc: scopes, v: vt) { alt ifce { some(ty) { v.visit_ty(ty, sc, v); } _ {} } v.visit_ty(sty, sc, v); for m in methods { - v.visit_fn_proto(m.decl, tps + m.tps, m.body, m.span, - some(m.ident), m.id, sc, v); + v.visit_fn(m.decl, tps + m.tps, m.body, m.span, + some(m.ident), m.id, sc, v); } } _ { visit::visit_item(i, sc, v); } @@ -416,9 +415,9 @@ fn visit_native_item_with_scope(ni: @ast::native_item, sc: scopes, visit::visit_native_item(ni, cons(scope_native_item(ni), @sc), v); } -fn visit_fn_proto_with_scope(e: @env, decl: ast::fn_decl, tp: [ast::ty_param], - body: ast::blk, sp: span, name: fn_ident, - id: node_id, sc: scopes, v: vt) { +fn visit_fn_with_scope(e: @env, decl: ast::fn_decl, tp: [ast::ty_param], + body: ast::blk, sp: span, name: fn_ident, + id: node_id, sc: scopes, v: vt) { // is this a main fn declaration? alt name { some(nm) { @@ -439,7 +438,7 @@ fn visit_fn_proto_with_scope(e: @env, decl: ast::fn_decl, tp: [ast::ty_param], _ { scope_fn_expr(decl, id, tp) } }; - visit::visit_fn_proto(decl, tp, body, sp, name, id, cons(scope, @sc), v); + visit::visit_fn(decl, tp, body, sp, name, id, cons(scope, @sc), v); } fn visit_block_with_scope(b: ast::blk, sc: scopes, v: vt) { diff --git a/src/comp/middle/tstate/annotate.rs b/src/comp/middle/tstate/annotate.rs index 65988ef917e..cc1360114cd 100644 --- a/src/comp/middle/tstate/annotate.rs +++ b/src/comp/middle/tstate/annotate.rs @@ -56,8 +56,8 @@ fn visit_fn(ccx: crate_ctxt, num_constraints: uint, body: blk) { init_vecs(ccx, node_id_vec, num_constraints); } -fn annotate_in_fn_body(ccx: crate_ctxt, _decl: fn_decl, body: blk, - _sp: span, _n: fn_ident, id: node_id) { +fn annotate_in_fn(ccx: crate_ctxt, _decl: fn_decl, _ts: [ty_param], body: blk, + _sp: span, _n: fn_ident, id: node_id) { let f_info = get_fn_info(ccx, id); visit_fn(ccx, num_constraints(f_info), body); } @@ -65,7 +65,7 @@ fn annotate_in_fn_body(ccx: crate_ctxt, _decl: fn_decl, body: blk, fn annotate_crate(ccx: crate_ctxt, crate: crate) { let do_ann = visit::mk_simple_visitor( - @{visit_fn_body: bind annotate_in_fn_body(ccx, _, _, _, _, _) + @{visit_fn: bind annotate_in_fn(ccx, _, _, _, _, _, _) with *visit::default_simple_visitor()}); visit::visit_crate(crate, (), do_ann); } diff --git a/src/comp/middle/tstate/auxiliary.rs b/src/comp/middle/tstate/auxiliary.rs index fe9a7b496db..340b2264354 100644 --- a/src/comp/middle/tstate/auxiliary.rs +++ b/src/comp/middle/tstate/auxiliary.rs @@ -1008,7 +1008,7 @@ fn op_to_oper_ty(io: init_op) -> oper_type { } // default function visitor -fn do_nothing(_decl: fn_decl, _body: blk, +fn do_nothing(_decl: fn_decl, _ts: [ty_param], _body: blk, _sp: span, _i: fn_ident, _id: node_id, _t: T, _v: visit::vt) { } diff --git a/src/comp/middle/tstate/bitvectors.rs b/src/comp/middle/tstate/bitvectors.rs index 10f5cfa10fe..120e33d9254 100644 --- a/src/comp/middle/tstate/bitvectors.rs +++ b/src/comp/middle/tstate/bitvectors.rs @@ -151,7 +151,7 @@ fn relax_precond_block(fcx: fn_ctxt, i: node_id, b: blk) { visit_stmt: relax_precond_stmt, visit_item: fn (_i: @item, _cx: relax_ctxt, _vt: visit::vt) { }, - visit_fn_body: bind do_nothing(_, _, _, _, _, _, _) + visit_fn: bind do_nothing(_, _, _, _, _, _, _, _) with *visitor}; let v1 = visit::mk_vt(visitor); v1.visit_block(b, cx, v1); diff --git a/src/comp/middle/tstate/ck.rs b/src/comp/middle/tstate/ck.rs index 0b2f9a3e9a5..f790334fbc4 100644 --- a/src/comp/middle/tstate/ck.rs +++ b/src/comp/middle/tstate/ck.rs @@ -106,9 +106,9 @@ fn check_states_against_conditions(fcx: fn_ctxt, let visitor = visit::mk_vt( @{visit_stmt: check_states_stmt, visit_expr: check_states_expr, - visit_fn_body: bind do_nothing::(_, _, _, _, _, _, _) + visit_fn: bind do_nothing::(_, _, _, _, _, _, _, _) with *visit::default_visitor::()}); - visit::visit_fn_body(f_decl, f_body, sp, nm, id, fcx, visitor); + visit::visit_fn(f_decl, [], f_body, sp, nm, id, fcx, visitor); /* Check that the return value is initialized */ let post = aux::block_poststate(fcx.ccx, f_body); @@ -158,10 +158,10 @@ fn check_fn_states(fcx: fn_ctxt, check_states_against_conditions(fcx, f_decl, f_body, sp, nm, id); } -fn fn_states(f_decl: ast::fn_decl, f_body: ast::blk, +fn fn_states(f_decl: ast::fn_decl, tps: [ast::ty_param], f_body: ast::blk, sp: span, i: ast::fn_ident, id: node_id, ccx: crate_ctxt, v: visit::vt) { - visit::visit_fn_body(f_decl, f_body, sp, i, id, ccx, v); + visit::visit_fn(f_decl, tps, f_body, sp, i, id, ccx, v); /* Look up the var-to-bit-num map for this function */ assert (ccx.fm.contains_key(id)); @@ -182,13 +182,13 @@ fn check_crate(cx: ty::ctxt, crate: @crate) { /* Compute the pre and postcondition for every subexpression */ let vtor = visit::default_visitor::(); - vtor = @{visit_fn_body: fn_pre_post with *vtor}; + vtor = @{visit_fn: fn_pre_post with *vtor}; visit::visit_crate(*crate, ccx, visit::mk_vt(vtor)); /* Check the pre- and postcondition against the pre- and poststate for every expression */ let vtor = visit::default_visitor::(); - vtor = @{visit_fn_body: fn_states with *vtor}; + vtor = @{visit_fn: fn_states with *vtor}; visit::visit_crate(*crate, ccx, visit::mk_vt(vtor)); } // diff --git a/src/comp/middle/tstate/collect_locals.rs b/src/comp/middle/tstate/collect_locals.rs index b853643362b..457a6ca0173 100644 --- a/src/comp/middle/tstate/collect_locals.rs +++ b/src/comp/middle/tstate/collect_locals.rs @@ -46,6 +46,7 @@ fn collect_pred(e: @expr, cx: ctxt, v: visit::vt) { fn find_locals(tcx: ty::ctxt, f_decl: fn_decl, + tps: [ty_param], f_body: blk, sp: span, n: fn_ident, @@ -56,10 +57,10 @@ fn find_locals(tcx: ty::ctxt, visitor = @{visit_local: collect_local, visit_expr: collect_pred, - visit_fn_body: bind do_nothing(_, _, _, _, _, _, _) + visit_fn: bind do_nothing(_, _, _, _, _, _, _, _) with *visitor}; - visit::visit_fn_body(f_decl, f_body, sp, - n, id, cx, visit::mk_vt(visitor)); + visit::visit_fn(f_decl, tps, f_body, sp, + n, id, cx, visit::mk_vt(visitor)); ret cx; } @@ -98,6 +99,7 @@ fn add_constraint(tcx: ty::ctxt, c: sp_constr, next: uint, tbl: constr_map) -> to a bit number in the precondition/postcondition vectors */ fn mk_fn_info(ccx: crate_ctxt, f_decl: fn_decl, + tps: [ty_param], f_body: blk, f_sp: span, f_name: fn_ident, @@ -106,7 +108,8 @@ fn mk_fn_info(ccx: crate_ctxt, let res_map = @new_def_hash::(); let next: uint = 0u; - let cx: ctxt = find_locals(ccx.tcx, f_decl, f_body, f_sp, f_name, id); + let cx: ctxt = find_locals(ccx.tcx, f_decl, tps, f_body, f_sp, + f_name, id); /* now we have to add bit nums for both the constraints and the variables... */ @@ -163,8 +166,8 @@ fn mk_fn_info(ccx: crate_ctxt, to bit number) */ fn mk_f_to_fn_info(ccx: crate_ctxt, c: @crate) { let visitor = - visit::mk_simple_visitor(@{visit_fn_body: - bind mk_fn_info(ccx, _, _, _, _, _) + visit::mk_simple_visitor(@{visit_fn: + bind mk_fn_info(ccx, _, _, _, _, _, _) with *visit::default_simple_visitor()}); visit::visit_crate(*c, (), visitor); } diff --git a/src/comp/middle/tstate/pre_post_conditions.rs b/src/comp/middle/tstate/pre_post_conditions.rs index 8f960eea6c0..9a3100e7bb2 100644 --- a/src/comp/middle/tstate/pre_post_conditions.rs +++ b/src/comp/middle/tstate/pre_post_conditions.rs @@ -727,10 +727,10 @@ fn find_pre_post_fn(fcx: fn_ctxt, body: blk) { } } -fn fn_pre_post(decl: fn_decl, body: blk, sp: span, +fn fn_pre_post(decl: fn_decl, tps: [ty_param], body: blk, sp: span, i: fn_ident, id: node_id, ccx: crate_ctxt, v: visit::vt) { - visit::visit_fn_body(decl, body, sp, i, id, ccx, v); + visit::visit_fn(decl, tps, body, sp, i, id, ccx, v); assert (ccx.fm.contains_key(id)); let fcx = {enclosing: ccx.fm.get(id), diff --git a/src/comp/middle/typeck.rs b/src/comp/middle/typeck.rs index 3a137bab2ce..16a1801fd89 100644 --- a/src/comp/middle/typeck.rs +++ b/src/comp/middle/typeck.rs @@ -1124,16 +1124,16 @@ fn gather_locals(ccx: @crate_ctxt, }; // Don't descend into fns and items - fn visit_fn_body(_decl: ast::fn_decl, _body: ast::blk, - _sp: span, _nm: ast::fn_ident, _id: ast::node_id, - _t: T, _v: visit::vt) { + fn visit_fn(_decl: ast::fn_decl, _ts: [ast::ty_param], _body: ast::blk, + _sp: span, _nm: ast::fn_ident, _id: ast::node_id, + _t: T, _v: visit::vt) { } fn visit_item(_i: @ast::item, _e: E, _v: visit::vt) { } let visit = @{visit_local: visit_local, visit_pat: visit_pat, - visit_fn_body: bind visit_fn_body(_, _, _, _, _, _, _), + visit_fn: bind visit_fn(_, _, _, _, _, _, _, _), visit_item: bind visit_item(_, _, _) with *visit::default_visitor()}; diff --git a/src/comp/syntax/visit.rs b/src/comp/syntax/visit.rs index 3c77db09d49..22c3d104f3b 100644 --- a/src/comp/syntax/visit.rs +++ b/src/comp/syntax/visit.rs @@ -31,14 +31,8 @@ type visitor = visit_expr: fn@(@expr, E, vt), visit_ty: fn@(@ty, E, vt), visit_constr: fn@(@path, span, node_id, E, vt), - - // A function with a fully specified prototype: - visit_fn_proto: fn@(fn_decl, [ty_param], blk, span, fn_ident, node_id, - E, vt), - - // Invoked by both visit_fn_proto above. - // Intended to be a common flow point for all fn decls in AST. - visit_fn_body: fn@(fn_decl, blk, span, fn_ident, node_id, E, vt)}; + visit_fn: fn@(fn_decl, [ty_param], blk, span, fn_ident, node_id, + E, vt)}; fn default_visitor() -> visitor { ret @{visit_mod: bind visit_mod::(_, _, _, _), @@ -54,8 +48,7 @@ fn default_visitor() -> visitor { visit_expr: bind visit_expr::(_, _, _), visit_ty: bind skip_ty::(_, _, _), visit_constr: bind visit_constr::(_, _, _, _, _), - visit_fn_proto: bind visit_fn_proto::(_, _, _, _, _, _, _, _), - visit_fn_body: bind visit_fn_body::(_, _, _, _, _, _, _)}; + visit_fn: bind visit_fn::(_, _, _, _, _, _, _, _)}; } fn visit_crate(c: crate, e: E, v: vt) { @@ -92,7 +85,7 @@ fn visit_item(i: @item, e: E, v: vt) { alt i.node { item_const(t, ex) { v.visit_ty(t, e, v); v.visit_expr(ex, e, v); } item_fn(decl, tp, body) { - v.visit_fn_proto(decl, tp, body, i.span, some(i.ident), i.id, e, v); + v.visit_fn(decl, tp, body, i.span, some(i.ident), i.id, e, v); } item_mod(m) { v.visit_mod(m, i.span, e, v); } item_native_mod(nm) { @@ -101,8 +94,8 @@ fn visit_item(i: @item, e: E, v: vt) { } item_ty(t, _) { v.visit_ty(t, e, v); } item_res(decl, tps, body, dtor_id, _) { - v.visit_fn_proto(decl, tps, body, i.span, some(i.ident), dtor_id, - e, v); + v.visit_fn(decl, tps, body, i.span, some(i.ident), dtor_id, + e, v); } item_tag(variants, _) { for vr: variant in variants { @@ -112,16 +105,16 @@ fn visit_item(i: @item, e: E, v: vt) { item_obj(ob, _, _) { for f: obj_field in ob.fields { v.visit_ty(f.ty, e, v); } for m: @method in ob.methods { - v.visit_fn_proto(m.decl, m.tps, m.body, m.span, - some(m.ident), m.id, e, v); + v.visit_fn(m.decl, m.tps, m.body, m.span, + some(m.ident), m.id, e, v); } } item_impl(_, ifce, ty, methods) { alt ifce { some(ty) { v.visit_ty(ty, e, v); } _ {} } v.visit_ty(ty, e, v); for m in methods { - v.visit_fn_proto(m.decl, m.tps, m.body, m.span, - some(m.ident), m.id, e, v); + v.visit_fn(m.decl, m.tps, m.body, m.span, + some(m.ident), m.id, e, v); } } item_iface(_, methods) { @@ -211,14 +204,8 @@ fn visit_fn_decl(fd: fn_decl, e: E, v: vt) { v.visit_ty(fd.output, e, v); } -fn visit_fn_proto(decl: fn_decl, _tp: [ty_param], body: blk, sp: span, - i: fn_ident, id: node_id, e: E, v: vt) { - v.visit_fn_body(decl, body, sp, i, id, e, v); -} - -fn visit_fn_body(decl: fn_decl, body: blk, _sp: span, - _name: fn_ident, _id: node_id, - e: E, v: vt) { +fn visit_fn(decl: fn_decl, _tp: [ty_param], body: blk, _sp: span, + _i: fn_ident, _id: node_id, e: E, v: vt) { visit_fn_decl(decl, e, v); v.visit_block(body, e, v); } @@ -309,10 +296,10 @@ fn visit_expr(ex: @expr, e: E, v: vt) { for a: arm in arms { v.visit_arm(a, e, v); } } expr_fn(decl, body, _) { - v.visit_fn_proto(decl, [], body, ex.span, none, ex.id, e, v); + v.visit_fn(decl, [], body, ex.span, none, ex.id, e, v); } expr_fn_block(decl, body) { - v.visit_fn_proto(decl, [], body, ex.span, none, ex.id, e, v); + v.visit_fn(decl, [], body, ex.span, none, ex.id, e, v); } expr_block(b) { v.visit_block(b, e, v); } expr_assign(a, b) { v.visit_expr(b, e, v); v.visit_expr(a, e, v); } @@ -355,8 +342,8 @@ fn visit_expr(ex: @expr, e: E, v: vt) { some(ex) { v.visit_expr(ex, e, v); } } for m: @method in anon_obj.methods { - v.visit_fn_proto(m.decl, m.tps, m.body, m.span, - some(m.ident), m.id, e, v); + v.visit_fn(m.decl, m.tps, m.body, m.span, + some(m.ident), m.id, e, v); } } expr_mac(mac) { visit_mac(mac, e, v); } @@ -388,8 +375,7 @@ type simple_visitor = visit_expr: fn@(@expr), visit_ty: fn@(@ty), visit_constr: fn@(@path, span, node_id), - visit_fn_proto: fn@(fn_decl, [ty_param], blk, span, fn_ident, node_id), - visit_fn_body: fn@(fn_decl, blk, span, fn_ident, node_id)}; + visit_fn: fn@(fn_decl, [ty_param], blk, span, fn_ident, node_id)}; fn simple_ignore_ty(_t: @ty) {} @@ -407,12 +393,8 @@ fn default_simple_visitor() -> simple_visitor { visit_expr: fn(_e: @expr) { }, visit_ty: simple_ignore_ty, visit_constr: fn(_p: @path, _sp: span, _id: node_id) { }, - visit_fn_proto: - fn(_d: fn_decl, _tps: [ty_param], _b: blk, _sp: span, - _ident: fn_ident, _id: node_id) { }, - visit_fn_body: - fn(_f: fn_decl, _b: blk, _sp: span, - _nm: fn_ident, _node_id: node_id) { } + visit_fn: fn(_d: fn_decl, _tps: [ty_param], _b: blk, _sp: span, + _ident: fn_ident, _id: node_id) { } }; } @@ -475,14 +457,7 @@ fn mk_simple_visitor(v: simple_visitor) -> vt<()> { decl: fn_decl, tps: [ty_param], body: blk, sp: span, ident: fn_ident, id: node_id, &&e: (), v: vt<()>) { f(decl, tps, body, sp, ident, id); - visit_fn_proto(decl, tps, body, sp, ident, id, e, v); - } - fn v_fn_body(f: fn@(fn_decl, blk, span, fn_ident, node_id), - fn_decl: fn_decl, blk: blk, - sp: span, name: fn_ident, node_id: node_id, - &&e: (), v: vt<()>) { - f(fn_decl, blk, sp, name, node_id); - visit_fn_body(fn_decl, blk, sp, name, node_id, e, v); + visit_fn(decl, tps, body, sp, ident, id, e, v); } let visit_ty = if v.visit_ty == simple_ignore_ty { bind skip_ty(_, _, _) @@ -503,10 +478,7 @@ fn mk_simple_visitor(v: simple_visitor) -> vt<()> { visit_expr: bind v_expr(v.visit_expr, _, _, _), visit_ty: visit_ty, visit_constr: bind v_constr(v.visit_constr, _, _, _, _, _), - visit_fn_proto: - bind v_fn(v.visit_fn_proto, _, _, _, _, _, _, _, _), - visit_fn_body: - bind v_fn_body(v.visit_fn_body, _, _, _, _, _, _, _), + visit_fn: bind v_fn(v.visit_fn, _, _, _, _, _, _, _, _) }); }