diff options
| author | Graydon Hoare <[email protected]> | 2010-11-24 10:36:46 -0800 |
|---|---|---|
| committer | Graydon Hoare <[email protected]> | 2010-11-24 16:56:01 -0800 |
| commit | 96540ef0bb649f4bd5c90ff2b524e763b3b5db85 (patch) | |
| tree | a308953e7230e24027aef125d17ffa12faf1d57f /src/comp | |
| parent | Move expr_cast translation into helper function. (diff) | |
| download | rust-96540ef0bb649f4bd5c90ff2b524e763b3b5db85.tar.xz rust-96540ef0bb649f4bd5c90ff2b524e763b3b5db85.zip | |
move expr_call translation into helper function.
Diffstat (limited to 'src/comp')
| -rw-r--r-- | src/comp/middle/trans.rs | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index 893c5691..f323d306 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)) { |