diff options
| author | Graydon Hoare <[email protected]> | 2011-01-06 12:55:27 -0800 |
|---|---|---|
| committer | Graydon Hoare <[email protected]> | 2011-01-06 12:55:27 -0800 |
| commit | 27b4c3f96231099c32c789a8671632f78431bb69 (patch) | |
| tree | bcb3a25624bba0e3c2aad4a40c4ddb7b5b2a6db8 /src/comp | |
| parent | Add the boilerplate for folding view items. (diff) | |
| download | rust-27b4c3f96231099c32c789a8671632f78431bb69.tar.xz rust-27b4c3f96231099c32c789a8671632f78431bb69.zip | |
Whitespace cleanup, and copy target into closure.
Diffstat (limited to 'src/comp')
| -rw-r--r-- | src/comp/middle/trans.rs | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index a241eddb..5f72ddf5 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -1990,8 +1990,7 @@ impure fn trans_bind(@block_ctxt cx, @ast.expr f, // Synthesize a closure type. let @ty.t bindings_ty = ty.plain_ty(ty.ty_tup(bound_tys)); - let TypeRef llbindings_ty = type_of(bcx.fcx.ccx, - bindings_ty); + let TypeRef llbindings_ty = type_of(bcx.fcx.ccx, bindings_ty); let TypeRef llclosure_ty = T_ptr(T_box(T_struct(vec(T_ptr(T_tydesc()), type_of(bcx.fcx.ccx, @@ -2013,23 +2012,27 @@ impure fn trans_bind(@block_ctxt cx, @ast.expr f, C_int(abi.box_rc_field_body))); bcx.build.Store(C_int(1), rc); - // Store bindings tydesc. auto bound_tydesc = bcx.build.GEP(closure, vec(C_int(0), C_int(abi.closure_elt_tydesc))); - auto bindings_tydesc = get_tydesc(bcx, bindings_ty); bcx.build.Store(bindings_tydesc, bound_tydesc); - // Copy args into body fields. - auto bindings = + // Store thunk-target. + auto bound_target = bcx.build.GEP(closure, vec(C_int(0), - C_int(abi.closure_elt_bindings))); + C_int(abi.closure_elt_target))); + bcx.build.Store(bcx.build.Load(f_res.res.val), bound_target); + // Copy expr values into boxed bindings. let int i = 0; + auto bindings = + bcx.build.GEP(closure, + vec(C_int(0), + C_int(abi.closure_elt_bindings))); for (ValueRef v in bound_vals) { auto bound = bcx.build.GEP(bindings, vec(C_int(0),C_int(i))); |