@@ -2238,7 +2238,7 @@ fn trans_for_each(@block_ctxt cx,
2238
2238
// escape. This could be determined upstream, and probably ought
2239
2239
// to be so, eventualy. For first cut, skip this. Null env.
2240
2240
2241
- auto env_ty = T_struct ( vec ( T_ptr ( T_i8 ( ) ) ) ) ;
2241
+ auto env_ty = T_opaque_closure_ptr ( cx . fcx . ccx . tn ) ;
2242
2242
2243
2243
2244
2244
// Step 2: Declare foreach body function.
@@ -2283,11 +2283,19 @@ fn trans_for_each(@block_ctxt cx,
2283
2283
// Step 3: Call iter passing [lliterbody, llenv], plus other args.
2284
2284
2285
2285
alt ( seq. node) {
2286
+
2286
2287
case ( ast. expr_call( ?f, ?args, ?ann) ) {
2287
2288
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
+
2288
2296
// log "lliterbody: " + val_str(cx.fcx.ccx.tn, lliterbody);
2289
2297
ret trans_call( cx, f,
2290
- some[ ValueRef ] ( lliterbody ) ,
2298
+ some[ ValueRef ] ( cx . build . Load ( pair ) ) ,
2291
2299
args,
2292
2300
ann) ;
2293
2301
}
@@ -3364,7 +3372,7 @@ fn trans_expr(@block_ctxt cx, @ast.expr e) -> result {
3364
3372
ret trans_ret( cx, e) ;
3365
3373
}
3366
3374
3367
- case ( ast. expr_ret ( ?e) ) {
3375
+ case ( ast. expr_put ( ?e) ) {
3368
3376
ret trans_put( cx, e) ;
3369
3377
}
3370
3378
0 commit comments