Skip to content

Commit 65c2a8b

Browse files
committed
---
yaml --- r: 1403 b: refs/heads/master c: 80c6726 h: refs/heads/master i: 1401: 3574a3e 1399: 1377acd v: v3
1 parent 3b293b2 commit 65c2a8b

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 34c60b6edb810d9f142d248b27d8e6e34c95d63c
2+
refs/heads/master: 80c67268fc007d55fa0ff193ac0be6ab83640aa6

trunk/src/comp/middle/trans.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2238,7 +2238,7 @@ fn trans_for_each(@block_ctxt cx,
22382238
// escape. This could be determined upstream, and probably ought
22392239
// to be so, eventualy. For first cut, skip this. Null env.
22402240

2241-
auto env_ty = T_struct(vec(T_ptr(T_i8())));
2241+
auto env_ty = T_opaque_closure_ptr(cx.fcx.ccx.tn);
22422242

22432243

22442244
// Step 2: Declare foreach body function.
@@ -2283,11 +2283,19 @@ fn trans_for_each(@block_ctxt cx,
22832283
// Step 3: Call iter passing [lliterbody, llenv], plus other args.
22842284

22852285
alt (seq.node) {
2286+
22862287
case (ast.expr_call(?f, ?args, ?ann)) {
22872288

2289+
auto pair = cx.build.Alloca(T_fn_pair(cx.fcx.ccx.tn,
2290+
iter_body_llty));
2291+
auto code_cell = cx.build.GEP(pair,
2292+
vec(C_int(0),
2293+
C_int(abi.fn_field_code)));
2294+
cx.build.Store(lliterbody, code_cell);
2295+
22882296
// log "lliterbody: " + val_str(cx.fcx.ccx.tn, lliterbody);
22892297
ret trans_call(cx, f,
2290-
some[ValueRef](lliterbody),
2298+
some[ValueRef](cx.build.Load(pair)),
22912299
args,
22922300
ann);
22932301
}
@@ -3364,7 +3372,7 @@ fn trans_expr(@block_ctxt cx, @ast.expr e) -> result {
33643372
ret trans_ret(cx, e);
33653373
}
33663374

3367-
case (ast.expr_ret(?e)) {
3375+
case (ast.expr_put(?e)) {
33683376
ret trans_put(cx, e);
33693377
}
33703378

0 commit comments

Comments
 (0)