rustc: Don't recurse in seq_preconds. Consumes too much stack

This commit is contained in:
Brian Anderson 2012-05-18 14:28:34 -07:00
parent afca68b820
commit 3f283bb168
2 changed files with 2020 additions and 15 deletions

View File

@ -82,6 +82,9 @@ fn seq_preconds(fcx: fn_ctxt, pps: [pre_and_post]) -> precond {
fn seq_preconds_go(fcx: fn_ctxt, pps: [pre_and_post], first: pre_and_post)
-> precond {
let mut pps = pps;
let mut first = first;
loop {
let sz: uint = vec::len(pps);
if sz >= 1u {
let second = pps[0];
@ -92,12 +95,12 @@ fn seq_preconds(fcx: fn_ctxt, pps: [pre_and_post]) -> precond {
union(next_first, second_pre);
let next_first_post = clone(first.postcondition);
seq_tritv(next_first_post, second.postcondition);
ret seq_preconds_go(fcx, vec::slice(pps, 1u, sz),
@{precondition: next_first,
postcondition: next_first_post});
pps = vec::slice(pps, 1u, sz);
first = @{precondition: next_first,
postcondition: next_first_post};
} else { ret first.precondition; }
}
}
if sz >= 1u {
let first = pps[0];

File diff suppressed because it is too large Load Diff