Skip to content

Commit 4c7778c

Browse files
committed
---
yaml --- r: 1007 b: refs/heads/master c: 5347cac h: refs/heads/master i: 1005: 36292e6 1003: 0fb0190 999: c965b3d 991: f5211ad v: v3
1 parent d12cb3d commit 4c7778c

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
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: 4316df63231dbf9c698e1bf464f7cecafea54a0c
2+
refs/heads/master: 5347cac92d0d44b5f1ca2f3b742a3786b62335d7

trunk/src/comp/middle/trans.rs

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -604,15 +604,28 @@ fn iter_structural_ty(@block_ctxt cx,
604604

605605
alt (variant._1) {
606606
case (n_ary) {
607-
// FIXME: broken at the moment, causes type_is_binding
608-
// errors; need to unpack the fn type returned by
609-
// ann_to_type.
610607
let vec[ValueRef] vals = vec(C_int(0), C_int(1),
611608
C_int(i as int));
612-
auto llfld = r.bcx.build.GEP(v, vals);
613-
auto ty = typeck.ann_to_type(variants.(i).ann);
614-
r = f(variant_cx, llfld, ty);
615-
r.bcx.build.Br(next_cx.llbb);
609+
auto llvar = variant_cx.build.GEP(v, vals);
610+
611+
auto fn_ty = typeck.ann_to_type(variants.(i).ann);
612+
alt (fn_ty.struct) {
613+
case (typeck.ty_fn(?args, _)) {
614+
auto j = 0u;
615+
for (typeck.arg a in args) {
616+
auto idx = vec(C_int(0), C_int(j as int));
617+
auto llfp = variant_cx.build.GEP(llvar,
618+
idx);
619+
auto llfld = variant_cx.build.Load(llfp);
620+
auto res = f(variant_cx, llfld, a.ty);
621+
variant_cx = res.bcx;
622+
j += 1u;
623+
}
624+
}
625+
case (_) { fail; }
626+
}
627+
628+
variant_cx.build.Br(next_cx.llbb);
616629
}
617630
case (nullary) {
618631
// Nothing to do.

0 commit comments

Comments
 (0)