Add testcase for bootstrap blocker and fix for each result type to nil.

This commit is contained in:
Graydon Hoare 2011-04-19 16:52:59 -07:00
parent 6651826677
commit d1b9ddc8d4
2 changed files with 26 additions and 3 deletions

View file

@ -3583,12 +3583,12 @@ fn trans_for_each(@block_ctxt cx,
bcx.build.Store(lllvar, lllvarptr);
fcx.llupvars.insert(decl_id, lllvarptr);
auto res = trans_block(bcx, body);
auto r = trans_block(bcx, body);
// Tie up the llallocas -> lltop edge.
new_builder(fcx.llallocas).Br(lltop);
res.bcx.build.RetVoid();
r.bcx.build.RetVoid();
// Step 3: Call iter passing [lliterbody, llenv], plus other args.
@ -3611,10 +3611,11 @@ fn trans_for_each(@block_ctxt cx,
cx.build.Store(llenvblobptr, env_cell);
// log "lliterbody: " + val_str(cx.fcx.lcx.ccx.tn, lliterbody);
ret trans_call(cx, f,
r = trans_call(cx, f,
some[ValueRef](cx.build.Load(pair)),
args,
ann);
ret res(r.bcx, C_nil());
}
}
fail;

View file

@ -0,0 +1,22 @@
tag thing { a; b; c; }
iter foo() -> int {
put 10;
}
fn main() {
auto x = true;
alt (a) {
case (a) {
x = true;
for each (int i in foo()) {
}
}
case (b) {
x = false;
}
case (c) {
x = false;
}
}
}