De-mode vec::each() and many of the str iteration routines

Note that the method foo.each() is not de-moded, nor the other
vec routines.
This commit is contained in:
Niko Matsakis 2012-09-18 21:41:37 -07:00
parent 62b7f4d800
commit 9cf271fe96
81 changed files with 556 additions and 750 deletions

View file

@ -293,8 +293,10 @@ fn map_struct_def(struct_def: @ast::struct_def, parent_node: ast_node,
}
let d_id = ast_util::local_def(id);
let p = extend(cx, ident);
// only need to handle methods
do vec::iter(struct_def.methods) |m| { map_method(d_id, p, m, cx); }
// only need to handle methods
for vec::each(struct_def.methods) |m| {
map_method(d_id, p, *m, cx);
}
}
fn map_view_item(vi: @view_item, cx: ctx, _v: vt) {

View file

@ -429,13 +429,13 @@ fn id_visitor(vfn: fn@(node_id)) -> visit::vt<()> {
match vi.node {
view_item_use(_, _, id) => vfn(id),
view_item_import(vps) | view_item_export(vps) => {
do vec::iter(vps) |vp| {
match vp.node {
view_path_simple(_, _, _, id) => vfn(id),
view_path_glob(_, id) => vfn(id),
view_path_list(_, _, id) => vfn(id)
}
}
for vec::each(vps) |vp| {
match vp.node {
view_path_simple(_, _, _, id) => vfn(id),
view_path_glob(_, id) => vfn(id),
view_path_list(_, _, id) => vfn(id)
}
}
}
}
},
@ -490,7 +490,9 @@ fn id_visitor(vfn: fn@(node_id)) -> visit::vt<()> {
},
visit_ty_params: fn@(ps: ~[ty_param]) {
vec::iter(ps, |p| vfn(p.id))
for vec::each(ps) |p| {
vfn(p.id);
}
},
visit_fn: fn@(fk: visit::fn_kind, d: ast::fn_decl,
@ -498,34 +500,34 @@ fn id_visitor(vfn: fn@(node_id)) -> visit::vt<()> {
vfn(id);
match fk {
visit::fk_ctor(_, _, tps, self_id, parent_id) => {
vec::iter(tps, |tp| vfn(tp.id));
vfn(id);
vfn(self_id);
vfn(parent_id.node);
}
visit::fk_dtor(tps, _, self_id, parent_id) => {
vec::iter(tps, |tp| vfn(tp.id));
vfn(id);
vfn(self_id);
vfn(parent_id.node);
}
visit::fk_item_fn(_, tps, _) => {
vec::iter(tps, |tp| vfn(tp.id));
}
visit::fk_method(_, tps, m) => {
vfn(m.self_id);
vec::iter(tps, |tp| vfn(tp.id));
}
visit::fk_anon(_, capture_clause)
| visit::fk_fn_block(capture_clause) => {
for vec::each(*capture_clause) |clause| {
vfn(clause.id);
visit::fk_ctor(_, _, tps, self_id, parent_id) => {
for vec::each(tps) |tp| { vfn(tp.id); }
vfn(id);
vfn(self_id);
vfn(parent_id.node);
}
visit::fk_dtor(tps, _, self_id, parent_id) => {
for vec::each(tps) |tp| { vfn(tp.id); }
vfn(id);
vfn(self_id);
vfn(parent_id.node);
}
visit::fk_item_fn(_, tps, _) => {
for vec::each(tps) |tp| { vfn(tp.id); }
}
visit::fk_method(_, tps, m) => {
vfn(m.self_id);
for vec::each(tps) |tp| { vfn(tp.id); }
}
visit::fk_anon(_, capture_clause) |
visit::fk_fn_block(capture_clause) => {
for vec::each(*capture_clause) |clause| {
vfn(clause.id);
}
}
}
}
do vec::iter(d.inputs) |arg| {
for vec::each(d.inputs) |arg| {
vfn(arg.id)
}
},

View file

@ -228,7 +228,7 @@ fn finish<T: qq_helper>
let mut state = active;
let mut i = 0u, j = 0u;
let g_len = cx.gather.len();
do str::chars_iter(*str) |ch| {
for str::chars_each(*str) |ch| {
if (j < g_len && i == cx.gather[j].lo) {
assert ch == '$';
let repl = fmt!("$%u ", j);

View file

@ -211,7 +211,7 @@ pure fn follow(m: arb_depth<matchable>, idx_path: &[uint]) ->
for vec::each(idx_path) |idx| {
res = match res {
leaf(_) => return res,/* end of the line */
seq(new_ms, _) => new_ms[idx]
seq(new_ms, _) => new_ms[*idx]
}
}
return res;

View file

@ -1674,7 +1674,7 @@ fn print_bounds(s: ps, bounds: @~[ast::ty_param_bound]) {
word(s.s, ~":");
for vec::each(*bounds) |bound| {
nbsp(s);
match bound {
match *bound {
ast::bound_copy => word(s.s, ~"Copy"),
ast::bound_send => word(s.s, ~"Send"),
ast::bound_const => word(s.s, ~"Const"),

View file

@ -263,7 +263,7 @@ fn visit_foreign_item<E>(ni: @foreign_item, e: E, v: vt<E>) {
fn visit_ty_param_bounds<E>(bounds: @~[ty_param_bound], e: E, v: vt<E>) {
for vec::each(*bounds) |bound| {
match bound {
match *bound {
bound_trait(t) => v.visit_ty(t, e, v),
bound_copy | bound_send | bound_const | bound_owned => ()
}