diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2012-09-18 21:41:13 -0700 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2012-09-18 21:41:13 -0700 |
| commit | 8d4928f7808813de62fefcb89139bfb7382b250b (patch) | |
| tree | 769fb518ce7c6952b2b7428ffe06f0679abe3f95 /src/libsyntax | |
| parent | 1be24f0758d3075d2e7f141f8831bb8a233ce86e (diff) | |
| download | rust-8d4928f7808813de62fefcb89139bfb7382b250b.tar.gz rust-8d4928f7808813de62fefcb89139bfb7382b250b.zip | |
Revert "replace explicit calls to vec::each with vec::each_ref, partially demode str"
This reverts commit 1be24f0758d3075d2e7f141f8831bb8a233ce86e. Not quite ready.
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast_map.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax/ast_util.rs | 68 | ||||
| -rw-r--r-- | src/libsyntax/ext/qquote.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/simplext.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/visit.rs | 4 |
6 files changed, 42 insertions, 46 deletions
diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs index 9b6c2947a3b..d9a7543eed4 100644 --- a/src/libsyntax/ast_map.rs +++ b/src/libsyntax/ast_map.rs @@ -293,10 +293,8 @@ 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 - for vec::each_ref(struct_def.methods) |m| { - map_method(d_id, p, *m, cx); - } + // only need to handle methods + do vec::iter(struct_def.methods) |m| { map_method(d_id, p, m, cx); } } fn map_view_item(vi: @view_item, cx: ctx, _v: vt) { diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index a503641fdf3..6140014d848 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -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) => { - for vec::each_ref(vps) |vp| { - match vp.node { - view_path_simple(_, _, _, id) => vfn(id), - view_path_glob(_, id) => vfn(id), - view_path_list(_, _, id) => vfn(id) - } - } + 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) + } + } } } }, @@ -490,9 +490,7 @@ fn id_visitor(vfn: fn@(node_id)) -> visit::vt<()> { }, visit_ty_params: fn@(ps: ~[ty_param]) { - for vec::each_ref(ps) |p| { - vfn(p.id); - } + vec::iter(ps, |p| vfn(p.id)) }, visit_fn: fn@(fk: visit::fn_kind, d: ast::fn_decl, @@ -500,34 +498,34 @@ fn id_visitor(vfn: fn@(node_id)) -> visit::vt<()> { vfn(id); match fk { - visit::fk_ctor(_, _, tps, self_id, parent_id) => { - for vec::each_ref(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_ref(tps) |tp| { vfn(tp.id); } - vfn(id); - vfn(self_id); - vfn(parent_id.node); - } - visit::fk_item_fn(_, tps, _) => { - for vec::each_ref(tps) |tp| { vfn(tp.id); } - } - visit::fk_method(_, tps, m) => { - vfn(m.self_id); - for vec::each_ref(tps) |tp| { vfn(tp.id); } - } - visit::fk_anon(_, capture_clause) | - visit::fk_fn_block(capture_clause) => { - for vec::each_ref(*capture_clause) |clause| { - vfn(clause.id); - } + 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); } + } } - for vec::each_ref(d.inputs) |arg| { + do vec::iter(d.inputs) |arg| { vfn(arg.id) } }, diff --git a/src/libsyntax/ext/qquote.rs b/src/libsyntax/ext/qquote.rs index da37e44b58c..d97124d5f44 100644 --- a/src/libsyntax/ext/qquote.rs +++ b/src/libsyntax/ext/qquote.rs @@ -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(); - for str::chars_each(*str) |ch| { + do str::chars_iter(*str) |ch| { if (j < g_len && i == cx.gather[j].lo) { assert ch == '$'; let repl = fmt!("$%u ", j); diff --git a/src/libsyntax/ext/simplext.rs b/src/libsyntax/ext/simplext.rs index a5103309e8c..08fa427d078 100644 --- a/src/libsyntax/ext/simplext.rs +++ b/src/libsyntax/ext/simplext.rs @@ -208,10 +208,10 @@ fn transcribe(cx: ext_ctxt, b: bindings, body: @expr) -> @expr { pure fn follow(m: arb_depth<matchable>, idx_path: &[uint]) -> arb_depth<matchable> { let mut res: arb_depth<matchable> = m; - for vec::each_ref(idx_path) |idx| { + 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; diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index c7aa724d9fd..4998dc7af6c 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -1672,9 +1672,9 @@ fn print_arg_mode(s: ps, m: ast::mode) { fn print_bounds(s: ps, bounds: @~[ast::ty_param_bound]) { if vec::len(*bounds) > 0u { word(s.s, ~":"); - for vec::each_ref(*bounds) |bound| { + 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"), diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index befd24d80e5..ffe97197f6f 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -262,8 +262,8 @@ 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_ref(*bounds) |bound| { - match *bound { + for vec::each(*bounds) |bound| { + match bound { bound_trait(t) => v.visit_ty(t, e, v), bound_copy | bound_send | bound_const | bound_owned => () } |
