Skip to content

Commit 1592de0

Browse files
committed
replace lambda with fn@
1 parent 8b91158 commit 1592de0

File tree

4 files changed

+15
-16
lines changed

4 files changed

+15
-16
lines changed

src/comp/middle/freevars.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ fn collect_freevars(def_map: resolve::def_map, blk: ast::blk)
3636

3737
fn ignore_item(_i: @ast::item, &&_depth: int, _v: visit::vt<int>) { }
3838

39-
let walk_expr =
40-
fn@ (expr: @ast::expr, &&depth: int, v: visit::vt<int>) {
39+
let walk_expr = fn@(expr: @ast::expr, &&depth: int, v: visit::vt<int>) {
4140
alt expr.node {
4241
ast::expr_fn(proto, decl, _, captures) {
4342
if proto != ast::proto_bare {
@@ -89,8 +88,8 @@ fn annotate_freevars(def_map: resolve::def_map, crate: @ast::crate) ->
8988
freevar_map {
9089
let freevars = new_int_hash();
9190

92-
let walk_fn = fn@ (_fk: visit::fn_kind, _decl: ast::fn_decl,
93-
blk: ast::blk, _sp: span, nid: ast::node_id) {
91+
let walk_fn = fn@(_fk: visit::fn_kind, _decl: ast::fn_decl,
92+
blk: ast::blk, _sp: span, nid: ast::node_id) {
9493
let vars = collect_freevars(def_map, blk);
9594
freevars.insert(nid, vars);
9695
};

src/comp/middle/trans_closure.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,8 @@ fn allocate_cbox(bcx: @block_ctxt,
209209
let ccx = bcx_ccx(bcx);
210210

211211
let alloc_in_heap = fn@(bcx: @block_ctxt,
212-
xchgheap: bool,
213-
&temp_cleanups: [ValueRef])
212+
xchgheap: bool,
213+
&temp_cleanups: [ValueRef])
214214
-> (@block_ctxt, ValueRef) {
215215

216216
// n.b. If you are wondering why we don't use

src/comp/middle/typeck.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,9 +1172,8 @@ fn gather_locals(ccx: @crate_ctxt,
11721172
};
11731173
let tcx = ccx.tcx;
11741174

1175-
let next_var_id = fn@ () -> int { let rv = *nvi; *nvi += 1; ret rv; };
1176-
let assign =
1177-
fn@ (nid: ast::node_id, ty_opt: option::t<ty::t>) {
1175+
let next_var_id = fn@() -> int { let rv = *nvi; *nvi += 1; ret rv; };
1176+
let assign = fn@(nid: ast::node_id, ty_opt: option::t<ty::t>) {
11781177
let var_id = next_var_id();
11791178
locals.insert(nid, var_id);
11801179
alt ty_opt {
@@ -1205,16 +1204,14 @@ fn gather_locals(ccx: @crate_ctxt,
12051204
}
12061205

12071206
// Add explicitly-declared locals.
1208-
let visit_local =
1209-
fn@ (local: @ast::local, &&e: (), v: visit::vt<()>) {
1207+
let visit_local = fn@(local: @ast::local, &&e: (), v: visit::vt<()>) {
12101208
let local_ty = ast_ty_to_ty_crate_infer(ccx, local.node.ty);
12111209
assign(local.node.id, local_ty);
12121210
visit::visit_local(local, e, v);
12131211
};
12141212

12151213
// Add pattern bindings.
1216-
let visit_pat =
1217-
fn@ (p: @ast::pat, &&e: (), v: visit::vt<()>) {
1214+
let visit_pat = fn@(p: @ast::pat, &&e: (), v: visit::vt<()>) {
12181215
alt p.node {
12191216
ast::pat_bind(_, _) { assign(p.id, none); }
12201217
_ {/* no-op */ }
@@ -1725,8 +1722,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, expr: @ast::expr, unify: unifier,
17251722
// functions. This is so that we have more information about the types
17261723
// of arguments when we typecheck the functions. This isn't really the
17271724
// right way to do this.
1728-
let check_args =
1729-
fn@ (check_blocks: bool) -> bool {
1725+
let check_args = fn@(check_blocks: bool) -> bool {
17301726
let i = 0u;
17311727
let bot = false;
17321728
for a_opt: option::t<@ast::expr> in args {

src/comp/syntax/parse/parser.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ fn bad_expr_word_table() -> hashmap<str, ()> {
168168
let words = new_str_hash();
169169
for word in ["mod", "if", "else", "while", "do", "alt", "for", "break",
170170
"cont", "ret", "be", "fail", "type", "resource", "check",
171-
"assert", "claim", "native", "fn", "fn@", "pure",
171+
"assert", "claim", "native", "fn", "pure",
172172
"unsafe", "block", "import", "export", "let", "const",
173173
"log", "tag", "obj", "copy", "sendfn", "impl", "iface"] {
174174
words.insert(word, ());
@@ -515,8 +515,10 @@ fn parse_ty(p: parser, colons_before_params: bool) -> @ast::ty {
515515
} else if eat_word(p, "block") {
516516
t = parse_ty_fn(ast::proto_block, p);
517517
} else if eat_word(p, "lambda") {
518+
//(breaks prettyprinting!) p.warn("lambda is deprecated, use fn@");
518519
t = parse_ty_fn(ast::proto_box, p);
519520
} else if eat_word(p, "sendfn") {
521+
//(breaks prettyprinting!) p.warn("sendfn is deprecated, use fn~");
520522
t = parse_ty_fn(ast::proto_uniq, p);
521523
} else if eat_word(p, "obj") {
522524
t = ast::ty_obj(parse_ty_methods(p, false));
@@ -822,8 +824,10 @@ fn parse_bottom_expr(p: parser) -> pexpr {
822824
} else if eat_word(p, "block") {
823825
ret pexpr(parse_fn_expr(p, ast::proto_block));
824826
} else if eat_word(p, "lambda") {
827+
//(breaks prettyprinting!) p.warn("lambda is deprecated, use fn@");
825828
ret pexpr(parse_fn_expr(p, ast::proto_box));
826829
} else if eat_word(p, "sendfn") {
830+
//(breaks prettyprinting!) p.warn("sendfn is deprecated, use fn~");
827831
ret pexpr(parse_fn_expr(p, ast::proto_uniq));
828832
} else if eat_word(p, "unchecked") {
829833
ret pexpr(parse_block_expr(p, lo, ast::unchecked_blk));

0 commit comments

Comments
 (0)