Convert 'again' to 'loop'. Remove 'again' keyword
This commit is contained in:
parent
073df63c72
commit
2810ea9a68
@ -817,7 +817,7 @@ fn install_source(c: cargo, path: &Path) {
|
||||
|
||||
for cratefiles.each |cf| {
|
||||
match load_crate(&cf) {
|
||||
None => again,
|
||||
None => loop,
|
||||
Some(crate) => {
|
||||
for crate.deps.each |query| {
|
||||
// FIXME (#1356): handle cyclic dependencies
|
||||
|
@ -562,18 +562,18 @@ fn check_variants(files: &[Path], cx: context) {
|
||||
file_might_not_converge(&file) {
|
||||
error!("Skipping convergence test based on\
|
||||
file_might_not_converge");
|
||||
again;
|
||||
loop;
|
||||
}
|
||||
|
||||
let s = @result::get(io::read_whole_file_str(&file));
|
||||
if contains(*s, ~"#") {
|
||||
again; // Macros are confusing
|
||||
loop; // Macros are confusing
|
||||
}
|
||||
if cx.mode == tm_converge && content_might_not_converge(*s) {
|
||||
again;
|
||||
loop;
|
||||
}
|
||||
if cx.mode == tm_run && content_is_dangerous_to_compile(*s) {
|
||||
again;
|
||||
loop;
|
||||
}
|
||||
|
||||
log(error, ~"check_variants: " + file.to_str());
|
||||
|
@ -218,7 +218,7 @@ unsafe fn walk_gc_roots(mem: Memory, sentinel: **Word, visitor: Visitor) {
|
||||
last_ret = *ptr::offset(frame.fp, ret_offset) as *Word;
|
||||
|
||||
if ptr::is_null(pc) {
|
||||
again;
|
||||
loop;
|
||||
}
|
||||
|
||||
let mut delay_reached_sentinel = reached_sentinel;
|
||||
@ -231,13 +231,13 @@ unsafe fn walk_gc_roots(mem: Memory, sentinel: **Word, visitor: Visitor) {
|
||||
if root == sentinel {
|
||||
delay_reached_sentinel = true;
|
||||
}
|
||||
again;
|
||||
loop;
|
||||
}
|
||||
|
||||
// Skip null pointers, which can occur when a
|
||||
// unique pointer has already been freed.
|
||||
if ptr::is_null(*root) {
|
||||
again;
|
||||
loop;
|
||||
}
|
||||
|
||||
if ptr::is_null(tydesc) {
|
||||
@ -324,7 +324,7 @@ fn cleanup_stack_for_failure() {
|
||||
for walk_gc_roots(need_cleanup, sentinel) |root, tydesc| {
|
||||
// Track roots to avoid double frees.
|
||||
if option::is_some(roots.find(&*root)) {
|
||||
again;
|
||||
loop;
|
||||
}
|
||||
roots.insert(*root, ());
|
||||
|
||||
|
@ -84,7 +84,7 @@ impl Reader {
|
||||
assert (w > 0u);
|
||||
if w == 1u {
|
||||
vec::push(chars, b0 as char );
|
||||
again;
|
||||
loop;
|
||||
}
|
||||
// can't satisfy this char with the existing data
|
||||
if end > vec::len(buf) {
|
||||
|
@ -419,10 +419,10 @@ pure fn normalize(components: &[~str]) -> ~[~str] {
|
||||
unchecked {
|
||||
for components.each |c| {
|
||||
unchecked {
|
||||
if c == ~"." && components.len() > 1 { again; }
|
||||
if c == ~"." && components.len() > 1 { loop; }
|
||||
if c == ~".." && cs.len() != 0 {
|
||||
vec::pop(cs);
|
||||
again;
|
||||
loop;
|
||||
}
|
||||
vec::push(cs, copy c);
|
||||
}
|
||||
|
@ -347,12 +347,12 @@ fn query_to_str(+query: Query) -> ~str {
|
||||
fn get_scheme(rawurl: &str) -> result::Result<(~str, ~str), @~str> {
|
||||
for str::each_chari(rawurl) |i,c| {
|
||||
match c {
|
||||
'A' .. 'Z' | 'a' .. 'z' => again,
|
||||
'A' .. 'Z' | 'a' .. 'z' => loop,
|
||||
'0' .. '9' | '+' | '-' | '.' => {
|
||||
if i == 0 {
|
||||
return result::Err(@~"url: Scheme must begin with a letter.");
|
||||
}
|
||||
again;
|
||||
loop;
|
||||
}
|
||||
':' => {
|
||||
if i == 0 {
|
||||
@ -419,7 +419,7 @@ fn get_authority(rawurl: &str) ->
|
||||
let mut pos : uint = 0, begin : uint = 2, end : uint = len;
|
||||
|
||||
for str::each_chari(rawurl) |i,c| {
|
||||
if i < 2 { again; } // ignore the leading //
|
||||
if i < 2 { loop; } // ignore the leading //
|
||||
|
||||
// deal with input class first
|
||||
match c {
|
||||
@ -569,7 +569,7 @@ fn get_path(rawurl: &str, authority : bool) ->
|
||||
'A' .. 'Z' | 'a' .. 'z' | '0' .. '9' | '&' |'\'' | '(' | ')' | '.'
|
||||
| '@' | ':' | '%' | '/' | '+' | '!' | '*' | ',' | ';' | '='
|
||||
| '_' | '-' => {
|
||||
again;
|
||||
loop;
|
||||
}
|
||||
'?' | '#' => {
|
||||
end = i;
|
||||
|
@ -1171,7 +1171,7 @@ mod node {
|
||||
option::Some(_) => {
|
||||
let next_char = get_next_char_in_leaf(it);
|
||||
match (next_char) {
|
||||
option::None => again,
|
||||
option::None => loop,
|
||||
option::Some(_) => return next_char
|
||||
}
|
||||
}
|
||||
|
@ -719,7 +719,7 @@ fn add_new_extension(cx: ext_ctxt, sp: span, arg: ast::mac_arg,
|
||||
for clauses.each |c| {
|
||||
match use_selectors_to_bind(c.params, arg) {
|
||||
Some(bindings) => return transcribe(cx, bindings, c.body),
|
||||
None => again
|
||||
None => loop
|
||||
}
|
||||
}
|
||||
cx.span_fatal(sp, ~"no clauses match macro invocation");
|
||||
|
@ -55,7 +55,7 @@ fn strip_doc_comment_decoration(comment: ~str) -> ~str {
|
||||
let mut i = max.get_default(uint::max_value);
|
||||
for lines.each |line| {
|
||||
if line.trim().is_empty() {
|
||||
again;
|
||||
loop;
|
||||
}
|
||||
for line.each_chari |j, c| {
|
||||
if j >= i {
|
||||
|
@ -306,7 +306,7 @@ fn scan_digits(rdr: string_reader, radix: uint) -> ~str {
|
||||
let mut rslt = ~"";
|
||||
loop {
|
||||
let c = rdr.curr;
|
||||
if c == '_' { bump(rdr); again; }
|
||||
if c == '_' { bump(rdr); loop; }
|
||||
match char::to_digit(c, radix) {
|
||||
Some(_) => {
|
||||
str::push_char(rslt, c);
|
||||
|
@ -888,7 +888,7 @@ struct parser {
|
||||
return pexpr(self.parse_sugary_call_expr(~"do", expr_do_body));
|
||||
} else if self.eat_keyword(~"while") {
|
||||
return pexpr(self.parse_while_expr());
|
||||
} else if self.eat_keyword(~"again") || self.eat_keyword(~"loop") {
|
||||
} else if self.eat_keyword(~"loop") {
|
||||
return pexpr(self.parse_loop_expr());
|
||||
} else if self.eat_keyword(~"match") {
|
||||
return pexpr(self.parse_alt_expr());
|
||||
@ -1138,7 +1138,7 @@ struct parser {
|
||||
}
|
||||
_ => self.unexpected()
|
||||
}
|
||||
again;
|
||||
loop;
|
||||
}
|
||||
if self.expr_is_complete(e) { break; }
|
||||
match copy self.token {
|
||||
@ -3096,7 +3096,7 @@ struct parser {
|
||||
}
|
||||
self.expect(token::LBRACE);
|
||||
common_fields = Some(self.parse_struct_def());
|
||||
again;
|
||||
loop;
|
||||
}
|
||||
|
||||
let vis = self.parse_visibility();
|
||||
|
@ -412,7 +412,7 @@ fn contextual_keyword_table() -> hashmap<~str, ()> {
|
||||
fn restricted_keyword_table() -> hashmap<~str, ()> {
|
||||
let words = str_hash();
|
||||
let keys = ~[
|
||||
~"again", ~"assert",
|
||||
~"assert",
|
||||
~"break",
|
||||
~"const", ~"copy",
|
||||
~"do", ~"drop",
|
||||
|
@ -1323,7 +1323,7 @@ fn print_expr(s: ps, &&expr: @ast::expr) {
|
||||
option::iter(opt_ident, |ident| {print_ident(s, ident); space(s.s)});
|
||||
}
|
||||
ast::expr_again(opt_ident) => {
|
||||
word(s.s, ~"again");
|
||||
word(s.s, ~"loop");
|
||||
space(s.s);
|
||||
option::iter(opt_ident, |ident| {print_ident(s, ident); space(s.s)});
|
||||
}
|
||||
|
@ -687,7 +687,7 @@ fn link_binary(sess: session,
|
||||
for cstore::get_used_crate_files(cstore).each |cratepath| {
|
||||
if cratepath.filetype() == Some(~"rlib") {
|
||||
vec::push(cc_args, cratepath.to_str());
|
||||
again;
|
||||
loop;
|
||||
}
|
||||
let dir = cratepath.dirname();
|
||||
if dir != ~"" { vec::push(cc_args, ~"-L" + dir); }
|
||||
|
@ -772,7 +772,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::Writer, item: @item,
|
||||
// maybe we should only ever handle the real type signatures.
|
||||
for vec::each(ms) |m| {
|
||||
let ty_m = ast_util::trait_method_to_ty_method(m);
|
||||
if ty_m.self_ty.node != ast::sty_static { again; }
|
||||
if ty_m.self_ty.node != ast::sty_static { loop; }
|
||||
|
||||
vec::push(*index, {val: ty_m.id, pos: ebml_w.writer.tell()});
|
||||
|
||||
|
@ -266,7 +266,7 @@ impl check_loan_ctxt {
|
||||
for self.walk_loans(par_scope_id) |old_loan| {
|
||||
for (*new_loanss).each |new_loans| {
|
||||
for (*new_loans).each |new_loan| {
|
||||
if old_loan.lp != new_loan.lp { again; }
|
||||
if old_loan.lp != new_loan.lp { loop; }
|
||||
match (old_loan.mutbl, new_loan.mutbl) {
|
||||
(m_const, _) | (_, m_const) |
|
||||
(m_mutbl, m_mutbl) | (m_imm, m_imm) => {
|
||||
|
@ -199,7 +199,7 @@ fn check_fn(fk: visit::fn_kind, decl: fn_decl, body: blk, sp: span,
|
||||
let id = ast_util::def_id_of_def(fv.def).node;
|
||||
|
||||
// skip over free variables that appear in the cap clause
|
||||
if captured_vars.contains(id) { again; }
|
||||
if captured_vars.contains(id) { loop; }
|
||||
|
||||
// if this is the last use of the variable, then it will be
|
||||
// a move and not a copy
|
||||
|
@ -193,7 +193,7 @@ struct LanguageItemCollector {
|
||||
}
|
||||
dl_def(_) | dl_impl(_) | dl_field => {
|
||||
// Skip this.
|
||||
again;
|
||||
loop;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ fn check_crate(tcx: ty::ctxt, method_map: &method_map, crate: @ast::crate) {
|
||||
let check_field = |span, id, ident| {
|
||||
let fields = ty::lookup_class_fields(tcx, id);
|
||||
for fields.each |field| {
|
||||
if field.ident != ident { again; }
|
||||
if field.ident != ident { loop; }
|
||||
if field.vis == private {
|
||||
tcx.sess.span_err(span, fmt!("field `%s` is private",
|
||||
*tcx.sess.parse_sess.interner
|
||||
|
@ -2156,7 +2156,7 @@ struct Resolver {
|
||||
if !self.name_is_exported(containing_module, atom) {
|
||||
debug!("(resolving glob import) name `%s` is unexported",
|
||||
self.session.str_of(atom));
|
||||
again;
|
||||
loop;
|
||||
}
|
||||
|
||||
debug!("(resolving glob import) writing module resolution \
|
||||
@ -2220,7 +2220,7 @@ struct Resolver {
|
||||
if !self.name_is_exported(containing_module, atom) {
|
||||
debug!("(resolving glob import) name `%s` is unexported",
|
||||
self.session.str_of(atom));
|
||||
again;
|
||||
loop;
|
||||
}
|
||||
|
||||
let mut dest_import_resolution;
|
||||
|
@ -2537,7 +2537,7 @@ fn crate_ctxt_to_encode_parms(cx: @crate_ctxt)
|
||||
let mut reexports = ~[];
|
||||
for cx.exp_map.each |exp_id, defs| {
|
||||
for defs.each |def| {
|
||||
if !def.reexp { again; }
|
||||
if !def.reexp { loop; }
|
||||
let path = match cx.tcx.items.get(exp_id) {
|
||||
ast_map::node_export(_, path) => {
|
||||
ast_map::path_to_str(*path, cx.sess.parse_sess.interner)
|
||||
|
@ -305,7 +305,7 @@ fn llreg_ty(cls: ~[x86_64_reg_class]) -> TypeRef {
|
||||
vec_len as c_uint);
|
||||
vec::push(tys, vec_ty);
|
||||
i += vec_len;
|
||||
again;
|
||||
loop;
|
||||
}
|
||||
sse_fs_class => {
|
||||
vec::push(tys, T_f32());
|
||||
|
@ -381,7 +381,7 @@ fn check_pat(pcx: pat_ctxt, pat: @ast::pat, expected: ty::t) {
|
||||
if !etc {
|
||||
for class_fields.eachi |i, field| {
|
||||
if found_fields.contains_key(i) {
|
||||
again;
|
||||
loop;
|
||||
}
|
||||
tcx.sess.span_err(pat.span,
|
||||
fmt!("pattern does not mention field `%s`",
|
||||
|
@ -298,7 +298,7 @@ struct lookup {
|
||||
let (trait_id, bound_substs) = match bound {
|
||||
ty::bound_copy | ty::bound_send | ty::bound_const |
|
||||
ty::bound_owned => {
|
||||
again; /* ok */
|
||||
loop; /* ok */
|
||||
}
|
||||
ty::bound_trait(bound_t) => {
|
||||
match ty::get(bound_t).struct {
|
||||
@ -352,7 +352,7 @@ struct lookup {
|
||||
|
||||
let ms = *ty::trait_methods(self.tcx(), did);
|
||||
for ms.eachi |i, m| {
|
||||
if m.ident != self.m_name { again; }
|
||||
if m.ident != self.m_name { loop; }
|
||||
|
||||
let m_fty = ty::mk_fn(self.tcx(), m.fty);
|
||||
|
||||
@ -391,7 +391,7 @@ struct lookup {
|
||||
let ms = *ty::trait_methods(self.tcx(), did);
|
||||
|
||||
for ms.each |m| {
|
||||
if m.ident != self.m_name { again; }
|
||||
if m.ident != self.m_name { loop; }
|
||||
|
||||
if m.vis == ast::private && !self.include_private {
|
||||
self.tcx().sess.span_fatal(
|
||||
|
@ -183,7 +183,7 @@ fn lookup_vtable(fcx: @fn_ctxt,
|
||||
|
||||
// First, ensure we haven't processed this impl yet.
|
||||
if impls_seen.contains_key(im.did) {
|
||||
again;
|
||||
loop;
|
||||
}
|
||||
impls_seen.insert(im.did, ());
|
||||
|
||||
@ -208,7 +208,7 @@ fn lookup_vtable(fcx: @fn_ctxt,
|
||||
match ty::get(of_ty).struct {
|
||||
ty::ty_trait(id, _, _) => {
|
||||
// Not the trait we're looking for
|
||||
if id != trait_id { again; }
|
||||
if id != trait_id { loop; }
|
||||
}
|
||||
_ => { /* ok */ }
|
||||
}
|
||||
@ -233,7 +233,7 @@ fn lookup_vtable(fcx: @fn_ctxt,
|
||||
let im_bs = ty::lookup_item_type(tcx,
|
||||
im.did).bounds;
|
||||
match fcx.mk_subty(false, expr.span, ty, for_ty) {
|
||||
result::Err(_) => again,
|
||||
result::Err(_) => loop,
|
||||
result::Ok(()) => ()
|
||||
}
|
||||
|
||||
|
@ -659,7 +659,7 @@ struct CoherenceChecker {
|
||||
}
|
||||
Some(_) => {
|
||||
// Skip this one.
|
||||
again;
|
||||
loop;
|
||||
}
|
||||
}
|
||||
|
||||
@ -741,7 +741,7 @@ struct CoherenceChecker {
|
||||
}
|
||||
dl_def(_) | dl_impl(_) | dl_field => {
|
||||
// Skip this.
|
||||
again;
|
||||
loop;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -166,7 +166,7 @@ fn main(args: ~[~str]) {
|
||||
while !rdr.eof() {
|
||||
let line: ~str = rdr.read_line();
|
||||
|
||||
if str::len(line) == 0u { again; }
|
||||
if str::len(line) == 0u { loop; }
|
||||
|
||||
match (line[0], proc_mode) {
|
||||
|
||||
|
@ -154,7 +154,7 @@ fn main(args: ~[~str]) {
|
||||
while !rdr.eof() {
|
||||
let line: ~str = rdr.read_line();
|
||||
|
||||
if str::len(line) == 0u { again; }
|
||||
if str::len(line) == 0u { loop; }
|
||||
|
||||
match (line[0], proc_mode) {
|
||||
|
||||
|
@ -10,14 +10,14 @@ fn main() {
|
||||
if x == 3 { break; } assert (x <= 3);
|
||||
}
|
||||
i = 0;
|
||||
while i < 10 { i += 1; if i % 2 == 0 { again; } assert (i % 2 != 0); }
|
||||
while i < 10 { i += 1; if i % 2 == 0 { loop; } assert (i % 2 != 0); }
|
||||
i = 0;
|
||||
loop {
|
||||
i += 1; if i % 2 == 0 { again; } assert (i % 2 != 0);
|
||||
i += 1; if i % 2 == 0 { loop; } assert (i % 2 != 0);
|
||||
if i >= 10 { break; }
|
||||
}
|
||||
for vec::each(~[1, 2, 3, 4, 5, 6]) |x| {
|
||||
if x % 2 == 0 { again; }
|
||||
if x % 2 == 0 { loop; }
|
||||
assert (x % 2 != 0);
|
||||
}
|
||||
}
|
||||
|
@ -81,10 +81,10 @@ struct cat<T: copy> : map<int, T> {
|
||||
}
|
||||
|
||||
pure fn each_key(&&f: fn(+int) -> bool) {
|
||||
for self.each |k, _v| { if !f(k) { break; } again;};
|
||||
for self.each |k, _v| { if !f(k) { break; } loop;};
|
||||
}
|
||||
pure fn each_value(&&f: fn(+T) -> bool) {
|
||||
for self.each |_k, v| { if !f(v) { break; } again;};
|
||||
for self.each |_k, v| { if !f(v) { break; } loop;};
|
||||
}
|
||||
|
||||
pure fn each_ref(f: fn(k: &int, v: &T) -> bool) {}
|
||||
|
@ -42,7 +42,7 @@ fn main() {
|
||||
for vec::all(~[1, 2, 3, 4, 5, 6, 7]) |e| {
|
||||
last = e;
|
||||
if e == 5 { break; }
|
||||
if e % 2 == 1 { again; }
|
||||
if e % 2 == 1 { loop; }
|
||||
assert e % 2 == 0;
|
||||
};
|
||||
assert last == 5;
|
||||
|
@ -6,7 +6,7 @@ use std;
|
||||
|
||||
fn test_break() { loop { let x: @int = break; } }
|
||||
|
||||
fn test_cont() { let mut i = 0; while i < 1 { i += 1; let x: @int = again; } }
|
||||
fn test_cont() { let mut i = 0; while i < 1 { i += 1; let x: @int = loop; } }
|
||||
|
||||
fn test_ret() { let x: @int = return; }
|
||||
|
||||
|
@ -17,7 +17,7 @@ fn log_ret() { log(error, return); }
|
||||
|
||||
fn log_break() { loop { log(error, break); } }
|
||||
|
||||
fn log_again() { loop { log(error, again); } }
|
||||
fn log_again() { loop { log(error, loop); } }
|
||||
|
||||
fn ret_ret() -> int { return (return 2) + 3; }
|
||||
|
||||
|
@ -59,7 +59,7 @@ fn canttouchthis() -> uint {
|
||||
fn angrydome() {
|
||||
loop { if break { } }
|
||||
let mut i = 0;
|
||||
loop { i += 1; if i == 1 { match (again) { 1 => { }, _ => fail ~"wat" } }
|
||||
loop { i += 1; if i == 1 { match (loop) { 1 => { }, _ => fail ~"wat" } }
|
||||
break; }
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,6 @@ fn main() {
|
||||
assert (i > 0);
|
||||
log(debug, i);
|
||||
i -= 1;
|
||||
again;
|
||||
loop;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user