Skip to content

Commit 65be26a

Browse files
committed
---
yaml --- r: 1722 b: refs/heads/master c: 95dc89f h: refs/heads/master v: v3
1 parent f2f8e1d commit 65be26a

File tree

2 files changed

+11
-29
lines changed

2 files changed

+11
-29
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: b7972d34ed489f54e14972c176c2d335ed4f26c2
2+
refs/heads/master: 95dc89f0124b85e289024c9ff96ae2e6f9f2b249

trunk/src/comp/middle/trans.rs

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1738,19 +1738,6 @@ fn variant_types(@crate_ctxt cx, &ast.variant v) -> vec[@ty.t] {
17381738
ret tys;
17391739
}
17401740

1741-
fn type_of_variant(@crate_ctxt cx,
1742-
&ast.variant v,
1743-
vec[ast.ty_param] ty_params,
1744-
vec[@ty.t] ty_param_substs) -> TypeRef {
1745-
let vec[TypeRef] lltys = vec();
1746-
auto tys = variant_types(cx, v);
1747-
for (@ty.t typ in tys) {
1748-
auto typ2 = ty.substitute_ty_params(ty_params, ty_param_substs, typ);
1749-
lltys += vec(type_of(cx, typ2));
1750-
}
1751-
ret T_struct(lltys);
1752-
}
1753-
17541741
// Returns the type parameters of a tag.
17551742
fn tag_ty_params(@crate_ctxt cx, ast.def_id id) -> vec[ast.ty_param] {
17561743
check (cx.items.contains_key(id));
@@ -1923,27 +1910,22 @@ fn iter_structural_ty_full(@block_ctxt cx,
19231910

19241911
if (_vec.len[ast.variant_arg](variant.args) > 0u) {
19251912
// N-ary variant.
1926-
auto llvarty = type_of_variant(bcx.fcx.ccx, variants.(i),
1927-
ty_params, tps);
1928-
19291913
auto fn_ty = ty.ann_to_type(variants.(i).ann);
19301914
alt (fn_ty.struct) {
19311915
case (ty.ty_fn(_, ?args, _)) {
1932-
auto llvarp_a = variant_cx.build.
1933-
TruncOrBitCast(llunion_a_ptr, T_ptr(llvarty));
1934-
1935-
auto llvarp_b = variant_cx.build.
1936-
TruncOrBitCast(llunion_b_ptr, T_ptr(llvarty));
1937-
1938-
auto j = 0u;
1916+
auto j = 0;
19391917
for (ty.arg a in args) {
19401918
auto v = vec(C_int(0), C_int(j as int));
19411919

1942-
auto llfldp_a =
1943-
variant_cx.build.GEP(llvarp_a, v);
1920+
auto rslt = GEP_tag(variant_cx, llunion_a_ptr,
1921+
tid, variants.(i).id, tps, j);
1922+
auto llfldp_a = rslt.val;
1923+
variant_cx = rslt.bcx;
19441924

1945-
auto llfldp_b =
1946-
variant_cx.build.GEP(llvarp_b, v);
1925+
rslt = GEP_tag(variant_cx, llunion_b_ptr, tid,
1926+
variants.(i).id, tps, j);
1927+
auto llfldp_b = rslt.val;
1928+
variant_cx = rslt.bcx;
19471929

19481930
auto ty_subst = ty.substitute_ty_params(
19491931
ty_params, tps, a.ty);
@@ -1961,7 +1943,7 @@ fn iter_structural_ty_full(@block_ctxt cx,
19611943
auto res = f(variant_cx,
19621944
llfld_a, llfld_b, ty_subst);
19631945
variant_cx = res.bcx;
1964-
j += 1u;
1946+
j += 1;
19651947
}
19661948
}
19671949
case (_) { fail; }

0 commit comments

Comments
 (0)