Removed all 4 uses of do ... while in the codebase.

This commit is contained in:
Paul Stansifer 2012-05-08 17:33:48 -07:00
parent fa6c18e014
commit 5af58e7926
2 changed files with 11 additions and 8 deletions

View file

@ -251,7 +251,7 @@ fn normalize(p: path) -> path {
let mut t = [];
let mut i = vec::len(s);
let mut skip = 0;
do {
while i != 0u {
i -= 1u;
if s[i] == ".." {
skip += 1;
@ -262,7 +262,7 @@ fn normalize(p: path) -> path {
skip -= 1;
}
}
} while i != 0u;
}
let mut t = vec::reversed(t);
while skip > 0 {
t += [".."];

View file

@ -69,10 +69,11 @@ fn parse_constrs(st: @pstate, conv: conv_did) -> [@ty::constr] {
let mut rslt: [@ty::constr] = [];
alt peek(st) {
':' {
do {
loop {
next(st);
rslt += [parse_constr(st, conv, parse_constr_arg)];
} while peek(st) == ';'
if peek(st) != ';' { break; }
}
}
_ { }
}
@ -84,10 +85,11 @@ fn parse_ty_constrs(st: @pstate, conv: conv_did) -> [@ty::type_constr] {
let mut rslt: [@ty::type_constr] = [];
alt peek(st) {
':' {
do {
loop {
next(st);
rslt += [parse_constr(st, conv, parse_ty_constr_arg)];
} while peek(st) == ';'
if peek(st) != ';' { break; }
}
}
_ { }
}
@ -154,12 +156,13 @@ fn parse_constr<T: copy>(st: @pstate, conv: conv_did,
assert (ignore == '(');
let def = parse_def(st, conv);
let mut an_arg: constr_arg_general_<T>;
do {
loop {
an_arg = pser(st);
// FIXME use a real span
args += [@respan(sp, an_arg)];
ignore = next(st);
} while ignore == ';'
if ignore != ';' { break; }
}
assert (ignore == ')');
ret @respan(sp, {path: pth, args: args, id: def});
}