diff options
| author | Brian Anderson <banderson@mozilla.com> | 2012-08-01 17:30:05 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-08-01 19:16:06 -0700 |
| commit | b355936b4da0831f47afe8f251daee503c8caa32 (patch) | |
| tree | 9f870e26f773af714cbcf7f315de5ff3722300c3 /src/rustc/front | |
| parent | dc499f193e473abc78c557feaa86969bbe7aa159 (diff) | |
| download | rust-b355936b4da0831f47afe8f251daee503c8caa32.tar.gz rust-b355936b4da0831f47afe8f251daee503c8caa32.zip | |
Convert ret to return
Diffstat (limited to 'src/rustc/front')
| -rw-r--r-- | src/rustc/front/config.rs | 28 | ||||
| -rw-r--r-- | src/rustc/front/core_inject.rs | 4 | ||||
| -rw-r--r-- | src/rustc/front/intrinsic_inject.rs | 2 | ||||
| -rw-r--r-- | src/rustc/front/test.rs | 32 |
4 files changed, 35 insertions, 31 deletions
diff --git a/src/rustc/front/config.rs b/src/rustc/front/config.rs index c633cf5d2af..9deaae5ecf1 100644 --- a/src/rustc/front/config.rs +++ b/src/rustc/front/config.rs @@ -31,7 +31,7 @@ fn strip_items(crate: @ast::crate, in_cfg: in_cfg_pred) let fold = fold::make_fold(precursor); let res = @fold.fold_crate(*crate); - ret res; + return res; } fn filter_item(cx: ctxt, &&item: @ast::item) -> @@ -54,8 +54,10 @@ fn fold_mod(cx: ctxt, m: ast::_mod, fld: fold::ast_fold) -> let filtered_items = vec::filter_map(m.items, item_filter); let view_item_filter = |a| filter_view_item(cx, a); let filtered_view_items = vec::filter_map(m.view_items, view_item_filter); - ret {view_items: vec::map(filtered_view_items, |x| fld.fold_view_item(x)), - items: vec::filter_map(filtered_items, |x| fld.fold_item(x))}; + return { + view_items: vec::map(filtered_view_items, |x| fld.fold_view_item(x)), + items: vec::filter_map(filtered_items, |x| fld.fold_item(x)) + }; } fn filter_foreign_item(cx: ctxt, &&item: @ast::foreign_item) -> @@ -72,8 +74,10 @@ fn fold_foreign_mod(cx: ctxt, nm: ast::foreign_mod, let view_item_filter = |a| filter_view_item(cx, a); let filtered_view_items = vec::filter_map( nm.view_items, view_item_filter); - ret {view_items: vec::map(filtered_view_items, |x| fld.fold_view_item(x)), - items: filtered_items}; + return { + view_items: vec::map(filtered_view_items, |x| fld.fold_view_item(x)), + items: filtered_items + }; } fn filter_stmt(cx: ctxt, &&stmt: @ast::stmt) -> @@ -97,7 +101,7 @@ fn fold_block(cx: ctxt, b: ast::blk_, fld: fold::ast_fold) -> ast::blk_ { let filter = |a| filter_stmt(cx, a); let filtered_stmts = vec::filter_map(b.stmts, filter); - ret {view_items: b.view_items, + return {view_items: b.view_items, stmts: vec::map(filtered_stmts, |x| fld.fold_stmt(x)), expr: option::map(b.expr, |x| fld.fold_expr(x)), id: b.id, @@ -105,15 +109,15 @@ fn fold_block(cx: ctxt, b: ast::blk_, fld: fold::ast_fold) -> } fn item_in_cfg(cx: ctxt, item: @ast::item) -> bool { - ret cx.in_cfg(item.attrs); + return cx.in_cfg(item.attrs); } fn foreign_item_in_cfg(cx: ctxt, item: @ast::foreign_item) -> bool { - ret cx.in_cfg(item.attrs); + return cx.in_cfg(item.attrs); } fn view_item_in_cfg(cx: ctxt, item: @ast::view_item) -> bool { - ret cx.in_cfg(item.attrs); + return cx.in_cfg(item.attrs); } // Determine if an item should be translated in the current crate @@ -134,13 +138,13 @@ fn metas_in_cfg(cfg: ast::crate_cfg, metas: ~[@ast::meta_item]) -> bool { |&&i| attr::get_meta_item_list(i) )); let has_cfg_metas = vec::len(cfg_metas) > 0u; - if !has_cfg_metas { ret true; } + if !has_cfg_metas { return true; } for cfg_metas.each |cfg_mi| { - if attr::contains(cfg, cfg_mi) { ret true; } + if attr::contains(cfg, cfg_mi) { return true; } } - ret false; + return false; } diff --git a/src/rustc/front/core_inject.rs b/src/rustc/front/core_inject.rs index 24b1a8094e3..7103c736206 100644 --- a/src/rustc/front/core_inject.rs +++ b/src/rustc/front/core_inject.rs @@ -23,7 +23,7 @@ fn inject_libcore_ref(sess: session, crate: @ast::crate) -> @ast::crate { fn spanned<T: copy>(x: T) -> @ast::spanned<T> { - ret @{node: x, + return @{node: x, span: dummy_sp()}; } @@ -43,6 +43,6 @@ fn inject_libcore_ref(sess: session, let vis = vec::append(~[vi1, vi2], crate.node.module.view_items); - ret @{node: {module: { view_items: vis with crate.node.module } + return @{node: {module: { view_items: vis with crate.node.module } with crate.node} with *crate } } diff --git a/src/rustc/front/intrinsic_inject.rs b/src/rustc/front/intrinsic_inject.rs index 920d4e2ee8c..34a60fda151 100644 --- a/src/rustc/front/intrinsic_inject.rs +++ b/src/rustc/front/intrinsic_inject.rs @@ -24,6 +24,6 @@ fn inject_intrinsic(sess: session, let items = vec::append(~[item], crate.node.module.items); - ret @{node: {module: { items: items with crate.node.module } + return @{node: {module: { items: items with crate.node.module } with crate.node} with *crate } } diff --git a/src/rustc/front/test.rs b/src/rustc/front/test.rs index 1cf825a5e6b..87011c2ad33 100644 --- a/src/rustc/front/test.rs +++ b/src/rustc/front/test.rs @@ -51,7 +51,7 @@ fn generate_test_harness(sess: session::session, let fold = fold::make_fold(precursor); let res = @fold.fold_crate(*crate); - ret res; + return res; } fn strip_test_functions(crate: @ast::crate) -> @ast::crate { @@ -82,7 +82,7 @@ fn fold_mod(_cx: test_ctxt, m: ast::_mod, fld: fold::ast_fold) -> ast::_mod { let mod_nomain = {view_items: m.view_items, items: vec::filter_map(m.items, nomain)}; - ret fold::noop_fold_mod(mod_nomain, fld); + return fold::noop_fold_mod(mod_nomain, fld); } fn fold_crate(cx: test_ctxt, c: ast::crate_, fld: fold::ast_fold) -> @@ -91,7 +91,7 @@ fn fold_crate(cx: test_ctxt, c: ast::crate_, fld: fold::ast_fold) -> // Add a special __test module to the crate that will contain code // generated for the test harness - ret {module: add_test_module(cx, folded.module) with folded}; + return {module: add_test_module(cx, folded.module) with folded}; } @@ -121,7 +121,7 @@ fn fold_item(cx: test_ctxt, &&i: @ast::item, fld: fold::ast_fold) -> let res = fold::noop_fold_item(i, fld); vec::pop(cx.path); - ret res; + return res; } fn is_test_fn(i: @ast::item) -> bool { @@ -140,7 +140,7 @@ fn is_test_fn(i: @ast::item) -> bool { } } - ret has_test_attr && has_test_signature(i); + return has_test_attr && has_test_signature(i); } fn is_ignored(cx: test_ctxt, i: @ast::item) -> bool { @@ -148,7 +148,7 @@ fn is_ignored(cx: test_ctxt, i: @ast::item) -> bool { let ignoreitems = attr::attr_metas(ignoreattrs); let cfg_metas = vec::concat(vec::filter_map(ignoreitems, |&&i| attr::get_meta_item_list(i) )); - ret if vec::is_not_empty(ignoreitems) { + return if vec::is_not_empty(ignoreitems) { config::metas_in_cfg(cx.crate.node.config, cfg_metas) } else { false @@ -161,7 +161,7 @@ fn should_fail(i: @ast::item) -> bool { fn add_test_module(cx: test_ctxt, m: ast::_mod) -> ast::_mod { let testmod = mk_test_module(cx); - ret {items: vec::append_one(m.items, testmod) with m}; + return {items: vec::append_one(m.items, testmod) with m}; } /* @@ -203,11 +203,11 @@ fn mk_test_module(cx: test_ctxt) -> @ast::item { debug!{"Synthetic test module:\n%s\n", pprust::item_to_str(@item)}; - ret @item; + return @item; } fn nospan<T: copy>(t: T) -> ast::spanned<T> { - ret {node: t, span: dummy_sp()}; + return {node: t, span: dummy_sp()}; } fn path_node(ids: ~[ast::ident]) -> @ast::path { @@ -238,7 +238,7 @@ fn mk_tests(cx: test_ctxt) -> @ast::item { node: item_, vis: ast::public, span: dummy_sp()}; - ret @item; + return @item; } fn mk_path(cx: test_ctxt, path: ~[ast::ident]) -> ~[ast::ident] { @@ -270,7 +270,7 @@ fn mk_test_desc_vec_ty(cx: test_ctxt) -> @ast::ty { let inner_ty = @{id: cx.sess.next_node_id(), node: ast::ty_vec(vec_mt), span: dummy_sp()}; - ret @{id: cx.sess.next_node_id(), + return @{id: cx.sess.next_node_id(), node: ast::ty_uniq({ty: inner_ty, mutbl: ast::m_imm}), span: dummy_sp()}; } @@ -286,7 +286,7 @@ fn mk_test_desc_vec(cx: test_ctxt) -> @ast::expr { callee_id: cx.sess.next_node_id(), node: ast::expr_vec(descs, ast::m_imm), span: dummy_sp()}; - ret @{id: cx.sess.next_node_id(), + return @{id: cx.sess.next_node_id(), callee_id: cx.sess.next_node_id(), node: ast::expr_vstore(inner_expr, ast::vstore_uniq), span: dummy_sp()}; @@ -358,7 +358,7 @@ fn mk_test_desc_rec(cx: test_ctxt, test: test) -> @ast::expr { let desc_rec: ast::expr = {id: cx.sess.next_node_id(), callee_id: cx.sess.next_node_id(), node: desc_rec_, span: span}; - ret @desc_rec; + return @desc_rec; } // Produces a bare function that wraps the test function @@ -400,7 +400,7 @@ fn mk_test_wrapper(cx: test_ctxt, span: span }; - ret @wrapper_expr; + return @wrapper_expr; } fn mk_main(cx: test_ctxt) -> @ast::item { @@ -451,7 +451,7 @@ fn mk_main(cx: test_ctxt) -> @ast::item { node: item_, vis: ast::public, span: dummy_sp()}; - ret @item; + return @item; } fn mk_test_main_call(cx: test_ctxt) -> @ast::expr { @@ -497,7 +497,7 @@ fn mk_test_main_call(cx: test_ctxt) -> @ast::expr { {id: cx.sess.next_node_id(), callee_id: cx.sess.next_node_id(), node: test_main_call_expr_, span: dummy_sp()}; - ret @test_main_call_expr; + return @test_main_call_expr; } // Local Variables: |
