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