@@ -1141,6 +1141,24 @@ impure fn trans_call(@block_ctxt cx, &ast.expr f,
1141
1141
args_res. _0 . build . FastCall ( f_res. _0 . val , llargs) ) ;
1142
1142
}
1143
1143
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
+
1144
1162
impure fn trans_expr( @block_ctxt cx, & ast. expr e) -> result {
1145
1163
alt ( e. node) {
1146
1164
case ( ast. expr_lit( ?lit, _) ) {
@@ -1192,6 +1210,7 @@ impure fn trans_expr(@block_ctxt cx, &ast.expr e) -> result {
1192
1210
check ( lhs_res. _1) ;
1193
1211
auto rhs_res = trans_expr( lhs_res. _0. bcx, * src) ;
1194
1212
auto t = node_ann_type( cx. fcx. ccx, ann) ;
1213
+ // FIXME: calculate copy init-ness in typestate.
1195
1214
ret copy_ty( rhs_res. bcx, true , lhs_res. _0. val, rhs_res. val, t) ;
1196
1215
}
1197
1216
@@ -1202,6 +1221,10 @@ impure fn trans_expr(@block_ctxt cx, &ast.expr e) -> result {
1202
1221
case ( ast. expr_cast( ?e, _, ?ann) ) {
1203
1222
ret trans_cast( cx, * e, ann) ;
1204
1223
}
1224
+
1225
+ case ( ast. expr_tup( ?args, ?ann) ) {
1226
+ ret trans_tup( cx, args, ann) ;
1227
+ }
1205
1228
}
1206
1229
cx. fcx. ccx. sess. unimpl( "expr variant in trans_expr" ) ;
1207
1230
fail;
0 commit comments