replace lambda with fn@
This commit is contained in:
parent
8b911587df
commit
1592de0faf
4 changed files with 15 additions and 16 deletions
|
|
@ -36,8 +36,7 @@ fn collect_freevars(def_map: resolve::def_map, blk: ast::blk)
|
|||
|
||||
fn ignore_item(_i: @ast::item, &&_depth: int, _v: visit::vt<int>) { }
|
||||
|
||||
let walk_expr =
|
||||
fn@ (expr: @ast::expr, &&depth: int, v: visit::vt<int>) {
|
||||
let walk_expr = fn@(expr: @ast::expr, &&depth: int, v: visit::vt<int>) {
|
||||
alt expr.node {
|
||||
ast::expr_fn(proto, decl, _, captures) {
|
||||
if proto != ast::proto_bare {
|
||||
|
|
@ -89,8 +88,8 @@ fn annotate_freevars(def_map: resolve::def_map, crate: @ast::crate) ->
|
|||
freevar_map {
|
||||
let freevars = new_int_hash();
|
||||
|
||||
let walk_fn = fn@ (_fk: visit::fn_kind, _decl: ast::fn_decl,
|
||||
blk: ast::blk, _sp: span, nid: ast::node_id) {
|
||||
let walk_fn = fn@(_fk: visit::fn_kind, _decl: ast::fn_decl,
|
||||
blk: ast::blk, _sp: span, nid: ast::node_id) {
|
||||
let vars = collect_freevars(def_map, blk);
|
||||
freevars.insert(nid, vars);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -209,8 +209,8 @@ fn allocate_cbox(bcx: @block_ctxt,
|
|||
let ccx = bcx_ccx(bcx);
|
||||
|
||||
let alloc_in_heap = fn@(bcx: @block_ctxt,
|
||||
xchgheap: bool,
|
||||
&temp_cleanups: [ValueRef])
|
||||
xchgheap: bool,
|
||||
&temp_cleanups: [ValueRef])
|
||||
-> (@block_ctxt, ValueRef) {
|
||||
|
||||
// n.b. If you are wondering why we don't use
|
||||
|
|
|
|||
|
|
@ -1172,9 +1172,8 @@ fn gather_locals(ccx: @crate_ctxt,
|
|||
};
|
||||
let tcx = ccx.tcx;
|
||||
|
||||
let next_var_id = fn@ () -> int { let rv = *nvi; *nvi += 1; ret rv; };
|
||||
let assign =
|
||||
fn@ (nid: ast::node_id, ty_opt: option::t<ty::t>) {
|
||||
let next_var_id = fn@() -> int { let rv = *nvi; *nvi += 1; ret rv; };
|
||||
let assign = fn@(nid: ast::node_id, ty_opt: option::t<ty::t>) {
|
||||
let var_id = next_var_id();
|
||||
locals.insert(nid, var_id);
|
||||
alt ty_opt {
|
||||
|
|
@ -1205,16 +1204,14 @@ fn gather_locals(ccx: @crate_ctxt,
|
|||
}
|
||||
|
||||
// Add explicitly-declared locals.
|
||||
let visit_local =
|
||||
fn@ (local: @ast::local, &&e: (), v: visit::vt<()>) {
|
||||
let visit_local = fn@(local: @ast::local, &&e: (), v: visit::vt<()>) {
|
||||
let local_ty = ast_ty_to_ty_crate_infer(ccx, local.node.ty);
|
||||
assign(local.node.id, local_ty);
|
||||
visit::visit_local(local, e, v);
|
||||
};
|
||||
|
||||
// Add pattern bindings.
|
||||
let visit_pat =
|
||||
fn@ (p: @ast::pat, &&e: (), v: visit::vt<()>) {
|
||||
let visit_pat = fn@(p: @ast::pat, &&e: (), v: visit::vt<()>) {
|
||||
alt p.node {
|
||||
ast::pat_bind(_, _) { assign(p.id, none); }
|
||||
_ {/* no-op */ }
|
||||
|
|
@ -1725,8 +1722,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, expr: @ast::expr, unify: unifier,
|
|||
// functions. This is so that we have more information about the types
|
||||
// of arguments when we typecheck the functions. This isn't really the
|
||||
// right way to do this.
|
||||
let check_args =
|
||||
fn@ (check_blocks: bool) -> bool {
|
||||
let check_args = fn@(check_blocks: bool) -> bool {
|
||||
let i = 0u;
|
||||
let bot = false;
|
||||
for a_opt: option::t<@ast::expr> in args {
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ fn bad_expr_word_table() -> hashmap<str, ()> {
|
|||
let words = new_str_hash();
|
||||
for word in ["mod", "if", "else", "while", "do", "alt", "for", "break",
|
||||
"cont", "ret", "be", "fail", "type", "resource", "check",
|
||||
"assert", "claim", "native", "fn", "fn@", "pure",
|
||||
"assert", "claim", "native", "fn", "pure",
|
||||
"unsafe", "block", "import", "export", "let", "const",
|
||||
"log", "tag", "obj", "copy", "sendfn", "impl", "iface"] {
|
||||
words.insert(word, ());
|
||||
|
|
@ -515,8 +515,10 @@ fn parse_ty(p: parser, colons_before_params: bool) -> @ast::ty {
|
|||
} else if eat_word(p, "block") {
|
||||
t = parse_ty_fn(ast::proto_block, p);
|
||||
} else if eat_word(p, "lambda") {
|
||||
//(breaks prettyprinting!) p.warn("lambda is deprecated, use fn@");
|
||||
t = parse_ty_fn(ast::proto_box, p);
|
||||
} else if eat_word(p, "sendfn") {
|
||||
//(breaks prettyprinting!) p.warn("sendfn is deprecated, use fn~");
|
||||
t = parse_ty_fn(ast::proto_uniq, p);
|
||||
} else if eat_word(p, "obj") {
|
||||
t = ast::ty_obj(parse_ty_methods(p, false));
|
||||
|
|
@ -822,8 +824,10 @@ fn parse_bottom_expr(p: parser) -> pexpr {
|
|||
} else if eat_word(p, "block") {
|
||||
ret pexpr(parse_fn_expr(p, ast::proto_block));
|
||||
} else if eat_word(p, "lambda") {
|
||||
//(breaks prettyprinting!) p.warn("lambda is deprecated, use fn@");
|
||||
ret pexpr(parse_fn_expr(p, ast::proto_box));
|
||||
} else if eat_word(p, "sendfn") {
|
||||
//(breaks prettyprinting!) p.warn("sendfn is deprecated, use fn~");
|
||||
ret pexpr(parse_fn_expr(p, ast::proto_uniq));
|
||||
} else if eat_word(p, "unchecked") {
|
||||
ret pexpr(parse_block_expr(p, lo, ast::unchecked_blk));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue