Skip to content

Commit 838511e

Browse files
author
Eric Holk
committed
Folding recv_val into trans_recv, since this is its only use.
1 parent e71f261 commit 838511e

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

src/comp/middle/trans_comm.rs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,6 @@ fn trans_send(&@block_ctxt cx, &@ast::expr lhs, &@ast::expr rhs,
207207
auto data = trans_lval(bcx, rhs);
208208
bcx = data.res.bcx;
209209
auto chan_ty = node_id_type(cx.fcx.lcx.ccx, id);
210-
auto unit_ty;
211210
alt (ty::struct(cx.fcx.lcx.ccx.tcx, chan_ty)) {
212211
case (ty::ty_chan(?t)) { unit_ty = t; }
213212
case (_) { bcx.fcx.lcx.ccx.sess.bug("non-chan type in trans_send"); }
@@ -223,6 +222,7 @@ fn trans_send(&@block_ctxt cx, &@ast::expr lhs, &@ast::expr rhs,
223222
bcx.build.Call(bcx.fcx.lcx.ccx.upcalls.send,
224223
~[bcx.fcx.lltaskptr, llchanval, lldataptr]);
225224
ret rslt(bcx, chn.val);
225+
auto unit_ty;
226226
}
227227

228228
fn trans_recv(&@block_ctxt cx, &@ast::expr lhs, &@ast::expr rhs,
@@ -234,20 +234,16 @@ fn trans_recv(&@block_ctxt cx, &@ast::expr lhs, &@ast::expr rhs,
234234
auto unit_ty = node_id_type(bcx.fcx.lcx.ccx, id);
235235
// FIXME: calculate copy init-ness in typestate.
236236

237-
ret recv_val(bcx, data.res.val, lhs, unit_ty, DROP_EXISTING);
238-
}
239-
240-
fn recv_val(&@block_ctxt cx, ValueRef to, &@ast::expr from, &ty::t unit_ty,
241-
copy_action action) -> result {
242-
auto bcx = cx;
243-
auto prt = trans_expr(bcx, from);
237+
auto prt = trans_expr(bcx, lhs);
244238
bcx = prt.bcx;
245-
auto lldataptr = bcx.build.PointerCast(to, T_ptr(T_ptr(T_i8())));
239+
auto lldataptr = bcx.build.PointerCast(data.res.val,
240+
T_ptr(T_ptr(T_i8())));
246241
auto llportptr = bcx.build.PointerCast(prt.val, T_opaque_port_ptr());
247242
bcx.build.Call(bcx.fcx.lcx.ccx.upcalls.recv,
248243
~[bcx.fcx.lltaskptr, lldataptr, llportptr]);
249-
auto data_load = load_if_immediate(bcx, to, unit_ty);
250-
//auto cp = copy_val(bcx, action, to, data_load, unit_ty);
244+
auto data_load = load_if_immediate(bcx, data.res.val, unit_ty);
245+
//auto cp = copy_val(bcx, DROP_EXISTING,
246+
// data.res.val, data_load, unit_ty);
251247
//bcx = cp.bcx;
252248

253249
add_clean_temp(cx, data_load, unit_ty);

0 commit comments

Comments
 (0)