output_types.push(type_of::type_of(bcx.ccx(), out_datum.ty));
let val = out_datum.val;
if is_rw {
- ext_inputs.push(unpack_result!(bcx, {
- callee::trans_arg_datum(bcx,
- expr_ty(bcx, &**out),
- out_datum,
- cleanup::CustomScope(temp_scope),
- callee::DontAutorefArg)
- }));
+ bcx = callee::trans_arg_datum(bcx,
+ expr_ty(bcx, &**out),
+ out_datum,
+ cleanup::CustomScope(temp_scope),
+ callee::DontAutorefArg,
+ &mut ext_inputs);
ext_constraints.push(i.to_string());
}
val
}).collect::<Vec<_>>();
// Now the input operands
- let mut inputs = ia.inputs.iter().map(|&(ref c, ref input)| {
+ let mut inputs = Vec::new();
+ for &(ref c, ref input) in &ia.inputs {
constraints.push((*c).clone());
let in_datum = unpack_datum!(bcx, expr::trans(bcx, &**input));
- unpack_result!(bcx, {
- callee::trans_arg_datum(bcx,
+ bcx = callee::trans_arg_datum(bcx,
expr_ty(bcx, &**input),
in_datum,
cleanup::CustomScope(temp_scope),
- callee::DontAutorefArg)
- })
- }).collect::<Vec<_>>();
+ callee::DontAutorefArg,
+ &mut inputs);
+ }
inputs.push_all(&ext_inputs[..]);
// no failure occurred preparing operands, no need to cleanup
// Translate the `self` argument first.
if !ignore_self {
let arg_datum = unpack_datum!(bcx, expr::trans(bcx, &*arg_exprs[0]));
- llargs.push(unpack_result!(bcx, {
- trans_arg_datum(bcx,
- args[0],
- arg_datum,
- arg_cleanup_scope,
- DontAutorefArg)
- }))
+ bcx = trans_arg_datum(bcx,
+ args[0],
+ arg_datum,
+ arg_cleanup_scope,
+ DontAutorefArg,
+ llargs);
}
// Now untuple the rest of the arguments.
tuple_expr.id));
let repr = adt::represent_type(bcx.ccx(), tuple_type);
let repr_ptr = &*repr;
- llargs.extend(field_types.iter().enumerate().map(|(i, field_type)| {
+ for (i, field_type) in field_types.iter().enumerate() {
let arg_datum = tuple_lvalue_datum.get_element(
bcx,
field_type,
|srcval| {
adt::trans_field_ptr(bcx, repr_ptr, srcval, 0, i)
}).to_expr_datum();
- unpack_result!(bcx, trans_arg_datum(
- bcx,
- field_type,
- arg_datum,
- arg_cleanup_scope,
- DontAutorefArg)
- )
- }));
+ bcx = trans_arg_datum(bcx,
+ field_type,
+ arg_datum,
+ arg_cleanup_scope,
+ DontAutorefArg,
+ llargs);
+ }
}
_ => {
bcx.sess().span_bug(tuple_expr.span,
let arg_tys = ty::erase_late_bound_regions(bcx.tcx(), &ty::ty_fn_args(fn_ty));
if !ignore_self {
let arg_datum = unpack_datum!(bcx, expr::trans(bcx, arg_exprs[0]));
- llargs.push(unpack_result!(bcx, {
- trans_arg_datum(bcx,
- arg_tys[0],
- arg_datum,
- arg_cleanup_scope,
- DontAutorefArg)
- }))
+ bcx = trans_arg_datum(bcx,
+ arg_tys[0],
+ arg_datum,
+ arg_cleanup_scope,
+ DontAutorefArg,
+ llargs);
}
// Now untuple the rest of the arguments.
for (i, &field_type) in field_types.iter().enumerate() {
let arg_datum =
unpack_datum!(bcx, expr::trans(bcx, arg_exprs[i + 1]));
- llargs.push(unpack_result!(bcx, {
- trans_arg_datum(bcx,
- field_type,
- arg_datum,
- arg_cleanup_scope,
- DontAutorefArg)
- }))
+ bcx = trans_arg_datum(bcx,
+ field_type,
+ arg_datum,
+ arg_cleanup_scope,
+ DontAutorefArg,
+ llargs);
}
}
_ => {
};
let arg_datum = unpack_datum!(bcx, expr::trans(bcx, &**arg_expr));
- llargs.push(unpack_result!(bcx, {
- trans_arg_datum(bcx, arg_ty, arg_datum,
- arg_cleanup_scope,
- DontAutorefArg)
- }));
+ bcx = trans_arg_datum(bcx, arg_ty, arg_datum,
+ arg_cleanup_scope,
+ DontAutorefArg,
+ llargs);
}
}
ArgOverloadedCall(arg_exprs) => {
ArgOverloadedOp(lhs, rhs, autoref) => {
assert!(!variadic);
- llargs.push(unpack_result!(bcx, {
- trans_arg_datum(bcx, arg_tys[0], lhs,
- arg_cleanup_scope,
- DontAutorefArg)
- }));
+ bcx = trans_arg_datum(bcx, arg_tys[0], lhs,
+ arg_cleanup_scope,
+ DontAutorefArg,
+ llargs);
assert_eq!(arg_tys.len(), 1 + rhs.len());
for (rhs, rhs_id) in rhs {
- llargs.push(unpack_result!(bcx, {
- trans_arg_datum(bcx, arg_tys[1], rhs,
- arg_cleanup_scope,
- if autoref { DoAutorefArg(rhs_id) } else { DontAutorefArg })
- }));
+ bcx = trans_arg_datum(bcx, arg_tys[1], rhs,
+ arg_cleanup_scope,
+ if autoref { DoAutorefArg(rhs_id) } else { DontAutorefArg },
+ llargs);
}
}
ArgVals(vs) => {
formal_arg_ty: Ty<'tcx>,
arg_datum: Datum<'tcx, Expr>,
arg_cleanup_scope: cleanup::ScopeId,
- autoref_arg: AutorefArg)
- -> Result<'blk, 'tcx> {
+ autoref_arg: AutorefArg,
+ llargs: &mut Vec<ValueRef>)
+ -> Block<'blk, 'tcx> {
let _icx = push_ctxt("trans_arg_datum");
let mut bcx = bcx;
let ccx = bcx.ccx();
}
debug!("--- trans_arg_datum passing {}", bcx.val_to_string(val));
- Result::new(bcx, val)
+
+ llargs.push(val);
+
+ bcx
}