Skip to content

Commit 7b5d34a

Browse files
committed
Comments and cleanup.
1 parent 57e5cde commit 7b5d34a

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/comp/middle/trans.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5135,6 +5135,13 @@ fn trans_bind_thunk(&@local_ctxt cx, &span sp, &ty::t incoming_fty,
51355135
auto fcx = new_fn_ctxt(cx, sp, llthunk);
51365136
auto bcx = new_top_block_ctxt(fcx);
51375137
auto lltop = bcx.llbb;
5138+
5139+
// The 'llenv' that will arrive in the thunk we're creating is an
5140+
// environment that will contain the values of its arguments and a pointer
5141+
// to the original function. So, let's create one of those:
5142+
5143+
// The llenv pointer needs to be the correct size. That size is
5144+
// 'closure_ty', which was determined by trans_bind.
51385145
auto llclosure_ptr_ty =
51395146
type_of(cx.ccx, sp, ty::mk_imm_box(cx.ccx.tcx, closure_ty));
51405147
auto llclosure = bcx.build.PointerCast(fcx.llenv, llclosure_ptr_ty);
@@ -5296,14 +5303,12 @@ fn trans_bind(&@block_ctxt cx, &@ast::expr f,
52965303
// Translate the bound expressions.
52975304
let vec[ty::t] bound_tys = [];
52985305
let vec[ValueRef] bound_vals = [];
5299-
auto i = 0u;
53005306
for (@ast::expr e in bound) {
53015307
auto arg = trans_expr(bcx, e);
53025308
bcx = arg.bcx;
53035309
vec::push[ValueRef](bound_vals, arg.val);
53045310
vec::push[ty::t](bound_tys,
53055311
ty::expr_ty(cx.fcx.lcx.ccx.tcx, e));
5306-
i += 1u;
53075312
}
53085313

53095314
// Synthesize a closure type.
@@ -5384,9 +5389,9 @@ fn trans_bind(&@block_ctxt cx, &@ast::expr f,
53845389
auto src = bcx.build.Load(f_res.res.val);
53855390
bound_target = bcx.build.PointerCast(bound_target, llclosurety);
53865391
bcx.build.Store(src, bound_target);
5387-
// Copy expr values into boxed bindings.
53885392

5389-
i = 0u;
5393+
// Copy expr values into boxed bindings.
5394+
auto i = 0u;
53905395
auto bindings =
53915396
bcx.build.GEP(closure,
53925397
[C_int(0), C_int(abi::closure_elt_bindings)]);

0 commit comments

Comments
 (0)