about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGraydon Hoare <graydon@mozilla.com>2010-11-24 10:36:46 -0800
committerGraydon Hoare <graydon@mozilla.com>2010-11-24 16:56:01 -0800
commit96540ef0bb649f4bd5c90ff2b524e763b3b5db85 (patch)
treea308953e7230e24027aef125d17ffa12faf1d57f
parente2f9f746ea5adcede229b5c9c14450a0057ed13b (diff)
move expr_call translation into helper function.
-rw-r--r--src/comp/middle/trans.rs20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs
index 893c5691964..f323d306a7a 100644
--- a/src/comp/middle/trans.rs
+++ b/src/comp/middle/trans.rs
@@ -966,6 +966,17 @@ impure fn trans_cast(@block_ctxt cx, &ast.expr e, &ast.ann ann) -> result {
     ret e_res;
 }
 
+impure fn trans_call(@block_ctxt cx, &ast.expr f,
+                     vec[@ast.expr] args) -> result {
+    auto f_res = trans_lval(cx, f);
+    check (! f_res._1);
+    auto args_res = trans_exprs(f_res._0.bcx, args);
+    auto llargs = vec(cx.fcx.lltaskptr);
+    llargs += args_res._1;
+    ret res(args_res._0,
+            args_res._0.build.FastCall(f_res._0.val, llargs));
+}
+
 impure fn trans_expr(@block_ctxt cx, &ast.expr e) -> result {
     alt (e.node) {
         case (ast.expr_lit(?lit, _)) {
@@ -1022,14 +1033,7 @@ impure fn trans_expr(@block_ctxt cx, &ast.expr e) -> result {
         }
 
         case (ast.expr_call(?f, ?args, _)) {
-            auto f_res = trans_lval(cx, *f);
-            check (! f_res._1);
-
-            auto args_res = trans_exprs(f_res._0.bcx, args);
-            auto llargs = vec(cx.fcx.lltaskptr);
-            llargs += args_res._1;
-            ret res(args_res._0,
-                    args_res._0.build.FastCall(f_res._0.val, llargs));
+            ret trans_call(cx, *f, args);
         }
 
         case (ast.expr_cast(?e, _, ?ann)) {