Skip to content

Commit f620240

Browse files
committed
---
yaml --- r: 957 b: refs/heads/master c: cffdb66 h: refs/heads/master i: 955: 9096f3a v: v3
1 parent bc40f3c commit f620240

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
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: 78ec07790a90813cf4f42df0246ea9c27892745f
2+
refs/heads/master: cffdb66aa42b6c5a1d30a1b4364d65f409976202

trunk/src/comp/middle/trans.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,6 +1141,24 @@ impure fn trans_call(@block_ctxt cx, &ast.expr f,
11411141
args_res._0.build.FastCall(f_res._0.val, llargs));
11421142
}
11431143

1144+
impure fn trans_tup(@block_ctxt cx, vec[tup(bool, @ast.expr)] args,
1145+
&ast.ann ann) -> result {
1146+
auto ty = node_type(cx.fcx.ccx, ann);
1147+
auto tup_val = cx.build.Alloca(ty);
1148+
let int i = 0;
1149+
auto r = res(cx, C_nil());
1150+
for (tup(bool, @ast.expr) arg in args) {
1151+
auto t = typeck.expr_ty(arg._1);
1152+
auto src_res = trans_expr(r.bcx, *arg._1);
1153+
auto dst_elt = r.bcx.build.GEP(tup_val, vec(C_int(0), C_int(i)));
1154+
// FIXME: calculate copy init-ness in typestate.
1155+
r = copy_ty(src_res.bcx, true, dst_elt, src_res.val, t);
1156+
i += 1;
1157+
}
1158+
ret res(r.bcx, tup_val);
1159+
}
1160+
1161+
11441162
impure fn trans_expr(@block_ctxt cx, &ast.expr e) -> result {
11451163
alt (e.node) {
11461164
case (ast.expr_lit(?lit, _)) {
@@ -1192,6 +1210,7 @@ impure fn trans_expr(@block_ctxt cx, &ast.expr e) -> result {
11921210
check (lhs_res._1);
11931211
auto rhs_res = trans_expr(lhs_res._0.bcx, *src);
11941212
auto t = node_ann_type(cx.fcx.ccx, ann);
1213+
// FIXME: calculate copy init-ness in typestate.
11951214
ret copy_ty(rhs_res.bcx, true, lhs_res._0.val, rhs_res.val, t);
11961215
}
11971216

@@ -1202,6 +1221,10 @@ impure fn trans_expr(@block_ctxt cx, &ast.expr e) -> result {
12021221
case (ast.expr_cast(?e, _, ?ann)) {
12031222
ret trans_cast(cx, *e, ann);
12041223
}
1224+
1225+
case (ast.expr_tup(?args, ?ann)) {
1226+
ret trans_tup(cx, args, ann);
1227+
}
12051228
}
12061229
cx.fcx.ccx.sess.unimpl("expr variant in trans_expr");
12071230
fail;

0 commit comments

Comments
 (0)