Make { || ... } sugar for any type of closure, inferred

This commit is contained in:
Niko Matsakis 2011-12-20 11:03:21 -08:00
parent 1e4de33374
commit 6a90140941
21 changed files with 392 additions and 242 deletions

View file

@ -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: bind map_fn(cx, _, _, _, _, _),
visit_fn_body: bind map_fn_body(cx, _, _, _, _, _),
visit_local: bind map_local(cx, _),
visit_arm: bind map_arm(cx, _)
with *visit::default_simple_visitor()});
@ -40,9 +40,9 @@ fn map_crate(c: crate) -> map {
ret cx.map;
}
fn map_fn(cx: ctx, f: _fn, _tp: [ty_param], _sp: codemap::span,
_name: fn_ident, _id: node_id) {
for a in f.decl.inputs {
fn map_fn_body(cx: ctx, decl: fn_decl, _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;
}