@@ -492,12 +492,14 @@ pub fn trans_call_inner(
492
492
}
493
493
} ;
494
494
495
- let args_res = trans_args ( bcx, llenv, args, fn_expr_ty,
496
- dest, ret_flag, autoref_arg) ;
497
- bcx = args_res. bcx ;
498
- let mut llargs = /*bad*/ copy args_res. args ;
495
+ let llretslot = trans_ret_slot ( bcx, fn_expr_ty, dest) ;
496
+
497
+ let mut llargs = ~[ ] ;
498
+ llargs. push ( llretslot) ;
499
+ llargs. push ( llenv) ;
500
+ bcx = trans_args ( bcx, args, fn_expr_ty,
501
+ ret_flag, autoref_arg, & mut llargs) ;
499
502
500
- let llretslot = args_res. retslot ;
501
503
502
504
// Now that the arguments have finished evaluating, we need to revoke
503
505
// the cleanup for the self argument, if it exists
@@ -555,30 +557,12 @@ pub enum CallArgs {
555
557
ArgVals ( & ' self [ ValueRef ] )
556
558
}
557
559
558
- pub struct Args {
559
- bcx : block ,
560
- args : ~[ ValueRef ] ,
561
- retslot : ValueRef
562
- }
563
-
564
- pub fn trans_args ( cx : block ,
565
- llenv : ValueRef ,
566
- +args : CallArgs ,
567
- fn_ty : ty:: t ,
568
- dest : expr:: Dest ,
569
- ret_flag : Option < ValueRef > ,
570
- +autoref_arg : AutorefArg ) -> Args {
571
- let _icx = cx. insn_ctxt ( "trans_args" ) ;
572
- let mut temp_cleanups = ~[ ] ;
573
- let arg_tys = ty:: ty_fn_args ( fn_ty) ;
574
- let mut llargs: ~[ ValueRef ] = ~[ ] ;
575
-
576
- let mut bcx = cx;
577
-
560
+ pub fn trans_ret_slot ( +bcx : block ,
561
+ +fn_ty : ty:: t ,
562
+ +dest : expr:: Dest ) -> ValueRef
563
+ {
578
564
let retty = ty:: ty_fn_ret ( fn_ty) ;
579
-
580
- // Arg 0: Output pointer.
581
- let llretslot = match dest {
565
+ match dest {
582
566
expr:: SaveIn ( dst) => dst,
583
567
expr:: Ignore => {
584
568
if ty:: type_is_nil ( retty) {
@@ -589,13 +573,21 @@ pub fn trans_args(cx: block,
589
573
alloc_ty ( bcx, retty)
590
574
}
591
575
}
592
- } ;
593
- llargs . push ( llretslot ) ;
576
+ }
577
+ }
594
578
595
- // Arg 1: Env (closure-bindings / self value)
596
- llargs. push ( llenv) ;
579
+ pub fn trans_args ( +cx : block ,
580
+ +args : CallArgs ,
581
+ +fn_ty : ty:: t ,
582
+ +ret_flag : Option < ValueRef > ,
583
+ +autoref_arg : AutorefArg ,
584
+ +llargs : & mut ~[ ValueRef ] ) -> block
585
+ {
586
+ let _icx = cx. insn_ctxt ( "trans_args" ) ;
587
+ let mut temp_cleanups = ~[ ] ;
588
+ let arg_tys = ty:: ty_fn_args ( fn_ty) ;
597
589
598
- // ... then explicit args.
590
+ let mut bcx = cx ;
599
591
600
592
// First we figure out the caller's view of the types of the arguments.
601
593
// This will be needed if this is a generic call, because the callee has
@@ -624,7 +616,7 @@ pub fn trans_args(cx: block,
624
616
revoke_clean( bcx, * c)
625
617
}
626
618
627
- Args { bcx : bcx , args : llargs , retslot : llretslot }
619
+ return bcx;
628
620
}
629
621
630
622
pub enum AutorefArg {
0 commit comments