@@ -60,9 +60,7 @@ type glue_fns = rec(ValueRef activate_glue,
60
60
ValueRef bzero_glue ) ;
61
61
62
62
tag arity { nullary; n_ary; }
63
- type tag_info = rec ( type_handle th,
64
- mutable uint size,
65
- vec[ ast. ty_param] ty_params ) ;
63
+ type tag_info = rec ( type_handle th, mutable uint size) ;
66
64
67
65
state type crate_ctxt = rec ( session. session sess,
68
66
ModuleRef llmod,
@@ -1456,6 +1454,15 @@ fn type_of_variant(@crate_ctxt cx, &ast.variant v) -> TypeRef {
1456
1454
ret T_struct ( lltys) ;
1457
1455
}
1458
1456
1457
+ // Returns the type parameters of a tag.
1458
+ fn tag_ty_params( @crate_ctxt cx, ast. def_id id) -> vec[ ast. ty_param] {
1459
+ check ( cx. items. contains_key( id) ) ;
1460
+ alt ( cx. items. get( id) . node) {
1461
+ case ( ast. item_tag( _, _, ?tps, _) ) { ret tps; }
1462
+ }
1463
+ fail; // not reached
1464
+ }
1465
+
1459
1466
// Returns the variants in a tag.
1460
1467
fn tag_variants( @crate_ctxt cx, ast. def_id id) -> vec[ ast. variant] {
1461
1468
check ( cx. items. contains_key( id) ) ;
@@ -1551,13 +1558,15 @@ fn iter_structural_ty(@block_ctxt cx,
1551
1558
auto llvarp = variant_cx. build.
1552
1559
TruncOrBitCast ( llunion_ptr, T_ptr ( llvarty) ) ;
1553
1560
1561
+ auto ty_params = tag_ty_params( cx. fcx. ccx, tid) ;
1562
+
1554
1563
auto j = 0 u;
1555
1564
for ( ty. arg a in args) {
1556
1565
auto v = vec( C_int ( 0 ) , C_int ( j as int) ) ;
1557
1566
auto llfldp = variant_cx. build. GEP ( llvarp, v) ;
1558
1567
1559
1568
auto ty_subst = ty. substitute_ty_params(
1560
- info . ty_params, tps, a. ty) ;
1569
+ ty_params, tps, a. ty) ;
1561
1570
1562
1571
auto llfld =
1563
1572
load_scalar_or_boxed( variant_cx,
@@ -4437,8 +4446,7 @@ fn collect_item(&@crate_ctxt cx, @ast.item i) -> @crate_ctxt {
4437
4446
auto vi = new_def_hash[ uint] ( ) ;
4438
4447
auto navi = new_def_hash[ uint] ( ) ;
4439
4448
cx. tags. insert( tag_id, @rec( th=mk_type_handle( ) ,
4440
- mutable size=0 u,
4441
- ty_params=tps) ) ;
4449
+ mutable size=0 u) ) ;
4442
4450
cx. items. insert( tag_id, i) ;
4443
4451
}
4444
4452
0 commit comments