core: Make range follow the for loop protocol
This commit is contained in:
parent
5281db2bc2
commit
432c6cbde9
46 changed files with 102 additions and 88 deletions
|
|
@ -137,7 +137,7 @@ fn get_relative_to(abs1: path::path, abs2: path::path) -> path::path {
|
|||
}
|
||||
|
||||
let mut path = [];
|
||||
uint::range(start_idx, len1 - 1u) {|_i| path += [".."]; };
|
||||
for uint::range(start_idx, len1 - 1u) {|_i| path += [".."]; };
|
||||
|
||||
path += vec::slice(split2, start_idx, len2 - 1u);
|
||||
|
||||
|
|
|
|||
|
|
@ -840,7 +840,7 @@ fn encode_info_for_items(ecx: @encode_ctxt, ebml_w: ebml::writer,
|
|||
fn create_index<T: copy>(index: [entry<T>], hash_fn: fn@(T) -> uint) ->
|
||||
[@[entry<T>]] {
|
||||
let mut buckets: [@mut [entry<T>]] = [];
|
||||
uint::range(0u, 256u) {|_i| buckets += [@mut []]; };
|
||||
for uint::range(0u, 256u) {|_i| buckets += [@mut []]; };
|
||||
for index.each {|elt|
|
||||
let h = hash_fn(elt.val);
|
||||
*buckets[h % 256u] += [elt];
|
||||
|
|
|
|||
|
|
@ -595,7 +595,7 @@ class liveness {
|
|||
|
||||
fn indices(ln: live_node, op: fn(uint)) {
|
||||
let node_base_idx = self.idx(ln, variable(0u));
|
||||
uint::range(0u, self.ir.num_vars) { |var_idx|
|
||||
for uint::range(0u, self.ir.num_vars) { |var_idx|
|
||||
op(node_base_idx + var_idx)
|
||||
}
|
||||
}
|
||||
|
|
@ -604,7 +604,7 @@ class liveness {
|
|||
op: fn(uint, uint)) {
|
||||
let node_base_idx = self.idx(ln, variable(0u));
|
||||
let succ_base_idx = self.idx(succ_ln, variable(0u));
|
||||
uint::range(0u, self.ir.num_vars) { |var_idx|
|
||||
for uint::range(0u, self.ir.num_vars) { |var_idx|
|
||||
op(node_base_idx + var_idx, succ_base_idx + var_idx);
|
||||
}
|
||||
}
|
||||
|
|
@ -613,7 +613,7 @@ class liveness {
|
|||
ln: live_node,
|
||||
test: fn(uint) -> live_node) {
|
||||
let node_base_idx = self.idx(ln, variable(0u));
|
||||
uint::range(0u, self.ir.num_vars) { |var_idx|
|
||||
for uint::range(0u, self.ir.num_vars) { |var_idx|
|
||||
let idx = node_base_idx + var_idx;
|
||||
if test(idx).is_valid() {
|
||||
wr.write_str(" ");
|
||||
|
|
@ -743,7 +743,7 @@ class liveness {
|
|||
// hack to skip the loop unless #debug is enabled:
|
||||
#debug["^^ liveness computation results for body %d (entry=%s)",
|
||||
{
|
||||
uint::range(0u, self.ir.num_live_nodes) { |ln_idx|
|
||||
for uint::range(0u, self.ir.num_live_nodes) { |ln_idx|
|
||||
#debug["%s", self.ln_str(live_node(ln_idx))];
|
||||
}
|
||||
body.node.id
|
||||
|
|
|
|||
|
|
@ -945,7 +945,7 @@ fn trans_crust_fn(ccx: @crate_ctxt, path: ast_map::path, decl: ast::fn_decl,
|
|||
_ {
|
||||
let llretptr = alloca(bcx, tys.ret_ty);
|
||||
let n = vec::len(tys.arg_tys);
|
||||
uint::range(0u, n) {|i|
|
||||
for uint::range(0u, n) {|i|
|
||||
let llargval = get_param(llwrapfn, i);
|
||||
store_inbounds(bcx, llargval, llargbundle,
|
||||
[0u, i]);
|
||||
|
|
|
|||
|
|
@ -588,7 +588,7 @@ fn gen_enum_shapes(ccx: @crate_ctxt) -> ValueRef {
|
|||
fn gen_resource_shapes(ccx: @crate_ctxt) -> ValueRef {
|
||||
let mut dtors = [];
|
||||
let len = interner::len(ccx.shape_cx.resources);
|
||||
uint::range(0u, len) {|i|
|
||||
for uint::range(0u, len) {|i|
|
||||
let ri = interner::get(ccx.shape_cx.resources, i);
|
||||
dtors += [trans::base::get_res_dtor(ccx, ri.did, ri.tps)];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ fn type_uses_for(ccx: @crate_ctxt, fn_id: def_id, n_tps: uint)
|
|||
}
|
||||
ast_map::node_ctor(_, _, ast_map::res_ctor(_, _, _), _) |
|
||||
ast_map::node_variant(_, _, _) {
|
||||
uint::range(0u, n_tps) {|n| cx.uses[n] |= use_repr;}
|
||||
for uint::range(0u, n_tps) {|n| cx.uses[n] |= use_repr;}
|
||||
}
|
||||
ast_map::node_native_item(i@@{node: native_item_fn(_, _), _}, abi, _) {
|
||||
if abi == native_abi_rust_intrinsic {
|
||||
|
|
@ -84,7 +84,7 @@ fn type_uses_for(ccx: @crate_ctxt, fn_id: def_id, n_tps: uint)
|
|||
"get_tydesc" | "needs_drop" { use_tydesc }
|
||||
"forget" | "addr_of" { 0u }
|
||||
};
|
||||
uint::range(0u, n_tps) {|n| cx.uses[n] |= flags;}
|
||||
for uint::range(0u, n_tps) {|n| cx.uses[n] |= flags;}
|
||||
}
|
||||
}
|
||||
ast_map::node_ctor(_, _, ast_map::class_ctor(ctor, _), _){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue