Remove some rustboot-isms

Closes #464
This commit is contained in:
Marijn Haverbeke 2011-07-25 15:07:48 +02:00
parent 48013db5c5
commit e949aab10a
7 changed files with 18 additions and 36 deletions

View File

@ -585,19 +585,15 @@ fn encode_metadata(&@crate_ctxt cx, &@crate crate) -> str {
ebmlivec::start_tag(ebml_w, tag_paths);
auto paths_index = encode_item_paths(ebml_w, crate);
auto str_writer = write_str;
auto path_hasher = hash_path;
auto paths_buckets = create_index[str](paths_index, path_hasher);
encode_index[str](ebml_w, paths_buckets, str_writer);
auto paths_buckets = create_index(paths_index, hash_path);
encode_index(ebml_w, paths_buckets, write_str);
ebmlivec::end_tag(ebml_w);
// Encode and index the items.
ebmlivec::start_tag(ebml_w, tag_items);
auto items_index = encode_info_for_items(ecx, ebml_w);
auto int_writer = write_int;
auto item_hasher = hash_node_id;
auto items_buckets = create_index[int](items_index, item_hasher);
encode_index[int](ebml_w, items_buckets, int_writer);
auto items_buckets = create_index(items_index, hash_node_id);
encode_index(ebml_w, items_buckets, write_int);
ebmlivec::end_tag(ebml_w);
// Pad this, since something (LLVM, presumably) is cutting off the
// remaining % 4 bytes_ivec.

View File

@ -2261,10 +2261,9 @@ fn lazily_emit_tydesc_glue(&@block_ctxt cx, int field,
T_glue_fn(*lcx.ccx),
"copy");
ti.copy_glue = some[ValueRef](glue_fn);
auto tg = make_copy_glue;
make_generic_glue(lcx, cx.sp, ti.ty, glue_fn,
mgghf_single(tg), ti.ty_params,
"take");
mgghf_single(make_copy_glue),
ti.ty_params, "take");
log #fmt("--- lazily_emit_tydesc_glue TAKE %s",
ty_to_str(cx.fcx.lcx.ccx.tcx, ti.ty));
}
@ -2300,10 +2299,9 @@ fn lazily_emit_tydesc_glue(&@block_ctxt cx, int field,
T_glue_fn(*lcx.ccx),
"free");
ti.free_glue = some[ValueRef](glue_fn);
auto dg = make_free_glue;
make_generic_glue(lcx, cx.sp, ti.ty, glue_fn,
mgghf_single(dg), ti.ty_params,
"free");
mgghf_single(make_free_glue),
ti.ty_params, "free");
log #fmt("--- lazily_emit_tydesc_glue FREE %s",
ty_to_str(cx.fcx.lcx.ccx.tcx, ti.ty));
}

View File

@ -392,9 +392,7 @@ fn mk_rcache() -> creader_cache {
bool {
ret a._0 == b._0 && a._1 == b._1 && a._2 == b._2;
}
auto h = hash_cache_entry;
auto e = eq_cache_entries;
ret map::mk_hashmap[tup(int, uint, uint), t](h, e);
ret map::mk_hashmap(hash_cache_entry, eq_cache_entries);
}
@ -2618,8 +2616,7 @@ mod unify {
alt (unify_mut(expected_elem.mut,
actual_elem.mut)) {
case (none) {
auto err = terr_tuple_mutability;
ret ures_err(err);
ret ures_err(terr_tuple_mutability);
}
case (some(?m)) { mut = m; }
}

View File

@ -312,8 +312,8 @@ fn parse_ty_obj(&parser p, &mutable uint hi) -> ast::ty_ {
}
fail;
}
auto f = parse_method_sig;
auto meths = parse_seq(token::LBRACE, token::RBRACE, none, f, p);
auto meths = parse_seq(token::LBRACE, token::RBRACE, none,
parse_method_sig, p);
hi = meths.span.hi;
ret ast::ty_obj(meths.node);
}
@ -1505,9 +1505,8 @@ fn parse_pat(&parser p) -> @ast::pat {
let (@ast::pat)[] args;
alt (p.peek()) {
case (token::LPAREN) {
auto f = parse_pat;
auto a = parse_seq(token::LPAREN, token::RPAREN,
some(token::COMMA), f, p);
some(token::COMMA), parse_pat, p);
args = a.node;
hi = a.span.hi;
}

View File

@ -156,9 +156,8 @@ obj new_reader(buf_reader rdr) {
}
// FIXME deal with eof?
fn read_be_uint(uint size) -> uint {
fn read_be_uint(uint sz) -> uint {
auto val = 0u;
auto sz = size; // FIXME: trans::ml bug workaround
while (sz > 0u) {
sz -= 1u;

View File

@ -157,9 +157,8 @@ obj new_reader(buf_reader rdr) {
}
// FIXME deal with eof?
fn read_be_uint(uint size) -> uint {
fn read_be_uint(uint sz) -> uint {
auto val = 0u;
auto sz = size; // FIXME: trans::ml bug workaround
while (sz > 0u) {
sz -= 1u;

View File

@ -209,25 +209,19 @@ fn mk_hashmap[K, V](&hashfn[K] hasher, &eqfn[K] eqer) -> hashmap[K, V] {
// Hash map constructors for basic types
fn new_str_hash[V]() -> hashmap[str, V] {
let hashfn[str] hasher = str::hash;
let eqfn[str] eqer = str::eq;
ret mk_hashmap[str, V](hasher, eqer);
ret mk_hashmap(str::hash, str::eq);
}
fn new_int_hash[V]() -> hashmap[int, V] {
fn hash_int(&int x) -> uint { ret x as uint; }
fn eq_int(&int a, &int b) -> bool { ret a == b; }
auto hasher = hash_int;
auto eqer = eq_int;
ret mk_hashmap[int, V](hasher, eqer);
ret mk_hashmap[int, V](hash_int, eq_int);
}
fn new_uint_hash[V]() -> hashmap[uint, V] {
fn hash_uint(&uint x) -> uint { ret x; }
fn eq_uint(&uint a, &uint b) -> bool { ret a == b; }
auto hasher = hash_uint;
auto eqer = eq_uint;
ret mk_hashmap[uint, V](hasher, eqer);
ret mk_hashmap[uint, V](hash_uint, eq_uint);
}
// Local Variables: