Skip to content

Commit eadc5a9

Browse files
committed
---
yaml --- r: 969 b: refs/heads/master c: d7ce242 h: refs/heads/master i: 967: 03ee295 v: v3
1 parent 5189bef commit eadc5a9

File tree

2 files changed

+23
-19
lines changed

2 files changed

+23
-19
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 9f56b0061ce058c0edd614cfdd5cbdb72efcfe08
2+
refs/heads/master: d7ce2425c9a35225a582f45604cfa7b0d11423b3

trunk/src/comp/middle/trans.rs

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,20 +1124,6 @@ fn trans_lval(@block_ctxt cx, @ast.expr e) -> tup(result, bool) {
11241124
fail;
11251125
}
11261126

1127-
impure fn trans_exprs(@block_ctxt cx, &vec[@ast.expr] es)
1128-
-> tup(@block_ctxt, vec[ValueRef]) {
1129-
let vec[ValueRef] vs = vec();
1130-
let @block_ctxt bcx = cx;
1131-
1132-
for (@ast.expr e in es) {
1133-
auto res = trans_expr(bcx, e);
1134-
vs += res.val;
1135-
bcx = res.bcx;
1136-
}
1137-
1138-
ret tup(bcx, vs);
1139-
}
1140-
11411127
impure fn trans_cast(@block_ctxt cx, @ast.expr e, &ast.ann ann) -> result {
11421128
auto e_res = trans_expr(cx, e);
11431129
auto llsrctype = val_ty(e_res.val);
@@ -1169,15 +1155,33 @@ impure fn trans_cast(@block_ctxt cx, @ast.expr e, &ast.ann ann) -> result {
11691155
ret e_res;
11701156
}
11711157

1158+
1159+
impure fn trans_args(@block_ctxt cx, &vec[@ast.expr] es)
1160+
-> tup(@block_ctxt, vec[ValueRef]) {
1161+
let vec[ValueRef] vs = vec(cx.fcx.lltaskptr);
1162+
let @block_ctxt bcx = cx;
1163+
1164+
for (@ast.expr e in es) {
1165+
auto res = trans_expr(bcx, e);
1166+
// Until here we've been treating structures by pointer;
1167+
// we are now passing it as an arg, so need to load it.
1168+
if (typeck.type_is_structural(typeck.expr_ty(e))) {
1169+
res.val = res.bcx.build.Load(res.val);
1170+
}
1171+
vs += res.val;
1172+
bcx = res.bcx;
1173+
}
1174+
1175+
ret tup(bcx, vs);
1176+
}
1177+
11721178
impure fn trans_call(@block_ctxt cx, @ast.expr f,
11731179
vec[@ast.expr] args) -> result {
11741180
auto f_res = trans_lval(cx, f);
11751181
check (! f_res._1);
1176-
auto args_res = trans_exprs(f_res._0.bcx, args);
1177-
auto llargs = vec(cx.fcx.lltaskptr);
1178-
llargs += args_res._1;
1182+
auto args_res = trans_args(f_res._0.bcx, args);
11791183
ret res(args_res._0,
1180-
args_res._0.build.FastCall(f_res._0.val, llargs));
1184+
args_res._0.build.FastCall(f_res._0.val, args_res._1));
11811185
}
11821186

11831187
impure fn trans_tup(@block_ctxt cx, vec[tup(bool, @ast.expr)] args,

0 commit comments

Comments
 (0)