@@ -21,7 +21,6 @@ import back.abi;
21
21
import pretty. pprust ;
22
22
23
23
import middle. ty . pat_ty ;
24
- import middle. ty . plain_ty ;
25
24
26
25
import util. common ;
27
26
import util. common . istr ;
@@ -639,7 +638,7 @@ fn type_of_fn_full(@crate_ctxt cx,
639
638
vec ( T_fn_pair ( cx. tn ,
640
639
type_of_fn_full ( cx, ast. proto_fn , none[ TypeRef ] ,
641
640
vec ( rec ( mode=ast. val , ty=output) ) ,
642
- plain_ty ( ty. ty_nil ) , 0 u) ) ) ;
641
+ ty. mk_nil ( ) , 0 u) ) ) ;
643
642
}
644
643
645
644
// ... then explicit args.
@@ -1150,7 +1149,7 @@ fn simplify_type(@ty.t typ) -> @ty.t {
1150
1149
fn simplifier ( @ty. t typ ) -> @ty. t {
1151
1150
alt ( typ. struct ) {
1152
1151
case ( ty. ty_box ( _) ) {
1153
- ret ty. plain_box_ty ( ty. plain_ty ( ty . ty_nil ) , ast . imm ) ;
1152
+ ret ty. mk_imm_box ( ty. mk_nil ( ) ) ;
1154
1153
}
1155
1154
case ( _) { ret typ; }
1156
1155
}
@@ -1187,7 +1186,7 @@ fn static_size_of_tag(@crate_ctxt cx, @ty.t t) -> uint {
1187
1186
auto max_size = 0 u;
1188
1187
auto variants = tag_variants ( cx, tid) ;
1189
1188
for ( variant_info variant in variants) {
1190
- auto tup_ty = simplify_type( ty. plain_tup_ty ( variant. args) ) ;
1189
+ auto tup_ty = simplify_type( ty. mk_imm_tup ( variant. args) ) ;
1191
1190
1192
1191
// Perform any type parameter substitutions.
1193
1192
tup_ty = ty. bind_params_in_type( tup_ty) ;
@@ -1403,7 +1402,7 @@ fn GEP_tup_like(@block_ctxt cx, @ty.t t,
1403
1402
// flattened the incoming structure.
1404
1403
1405
1404
auto s = split_type ( t, ixs, 0 u) ;
1406
- auto prefix_ty = ty. plain_tup_ty ( s. prefix ) ;
1405
+ auto prefix_ty = ty. mk_imm_tup ( s. prefix ) ;
1407
1406
auto bcx = cx;
1408
1407
auto sz = size_of ( bcx, prefix_ty) ;
1409
1408
bcx = sz. bcx ;
@@ -1434,7 +1433,7 @@ fn GEP_tag(@block_ctxt cx,
1434
1433
// Synthesize a tuple type so that GEP_tup_like() can work its magic.
1435
1434
// Separately, store the type of the element we're interested in.
1436
1435
auto arg_tys = variant. args ;
1437
- auto elem_ty = ty. plain_ty ( ty . ty_nil ) ; // typestate infelicity
1436
+ auto elem_ty = ty. mk_nil ( ) ; // typestate infelicity
1438
1437
auto i = 0 ;
1439
1438
let vec[ @ty. t] true_arg_tys = vec ( ) ;
1440
1439
for ( @ty. t aty in arg_tys) {
@@ -1448,7 +1447,7 @@ fn GEP_tag(@block_ctxt cx,
1448
1447
i += 1 ;
1449
1448
}
1450
1449
1451
- auto tup_ty = ty. plain_tup_ty ( true_arg_tys) ;
1450
+ auto tup_ty = ty. mk_imm_tup ( true_arg_tys) ;
1452
1451
1453
1452
// Cast the blob pointer to the appropriate type, if we need to (i.e. if
1454
1453
// the blob pointer isn't dynamically sized).
@@ -1488,8 +1487,8 @@ fn trans_raw_malloc(@block_ctxt cx, TypeRef llptr_ty, ValueRef llsize)
1488
1487
fn trans_malloc_boxed( @block_ctxt cx, @ty. t t) -> result {
1489
1488
// Synthesize a fake box type structurally so we have something
1490
1489
// to measure the size of.
1491
- auto boxed_body = ty. plain_tup_ty ( vec( plain_ty ( ty. ty_int ) , t) ) ;
1492
- auto box_ptr = ty. plain_box_ty ( t , ast . imm ) ;
1490
+ auto boxed_body = ty. mk_imm_tup ( vec( ty. mk_int ( ) , t) ) ;
1491
+ auto box_ptr = ty. mk_imm_box ( t ) ;
1493
1492
auto sz = size_of( cx, boxed_body) ;
1494
1493
auto llty = type_of( cx. fcx. lcx. ccx, box_ptr) ;
1495
1494
ret trans_raw_malloc( sz. bcx, llty, sz. val) ;
@@ -2294,13 +2293,6 @@ fn tag_variant_with_id(@crate_ctxt cx,
2294
2293
fail;
2295
2294
}
2296
2295
2297
- // Returns a new plain tag type of the given ID with no type parameters. Don't
2298
- // use this function in new code; it's a hack to keep things working for now.
2299
- fn mk_plain_tag ( ast. def_id tid ) -> @ty. t {
2300
- let vec[ @ty. t] tps = vec ( ) ;
2301
- ret ty. plain_ty ( ty. ty_tag ( tid, tps) ) ;
2302
- }
2303
-
2304
2296
2305
2297
type val_pair_fn = fn ( @block_ctxt cx , ValueRef dst, ValueRef src) -> result ;
2306
2298
@@ -2341,8 +2333,8 @@ fn iter_structural_ty_full(@block_ctxt cx,
2341
2333
val_pair_and_ty_fn f) -> result {
2342
2334
auto box_a_ptr = cx. build . Load ( box_a_cell) ;
2343
2335
auto box_b_ptr = cx. build . Load ( box_b_cell) ;
2344
- auto tnil = plain_ty ( ty. ty_nil ) ;
2345
- auto tbox = ty. plain_box_ty ( tnil, ast . imm ) ;
2336
+ auto tnil = ty. mk_nil ( ) ;
2337
+ auto tbox = ty. mk_imm_box ( tnil) ;
2346
2338
2347
2339
auto inner_cx = new_sub_block_ctxt ( cx, "iter box" ) ;
2348
2340
auto next_cx = new_sub_block_ctxt ( cx, "next" ) ;
@@ -2407,8 +2399,7 @@ fn iter_structural_ty_full(@block_ctxt cx,
2407
2399
// NB: we must hit the discriminant first so that structural
2408
2400
// comparison know not to proceed when the discriminants differ.
2409
2401
auto bcx = cx;
2410
- bcx = f ( bcx, lldiscrim_a, lldiscrim_b,
2411
- plain_ty ( ty. ty_int ) ) . bcx ;
2402
+ bcx = f ( bcx, lldiscrim_a, lldiscrim_b, ty. mk_int ( ) ) . bcx ;
2412
2403
2413
2404
auto unr_cx = new_sub_block_ctxt ( bcx, "tag-iter-unr" ) ;
2414
2405
unr_cx. build . Unreachable ( ) ;
@@ -2628,7 +2619,7 @@ fn iter_sequence(@block_ctxt cx,
2628
2619
ret iter_sequence_body( cx, v, elt. ty, f, false) ;
2629
2620
}
2630
2621
case ( ty. ty_str) {
2631
- auto et = plain_ty ( ty. ty_machine ( common. ty_u8) ) ;
2622
+ auto et = ty. mk_mach ( common. ty_u8) ;
2632
2623
ret iter_sequence_body( cx, v, et, f, true) ;
2633
2624
}
2634
2625
case ( _) { fail; }
@@ -3449,7 +3440,7 @@ fn trans_for_each(@block_ctxt cx,
3449
3440
3450
3441
auto lcx = cx. fcx. lcx;
3451
3442
// FIXME: possibly support alias-mode here?
3452
- auto decl_ty = plain_ty ( ty. ty_nil ) ;
3443
+ auto decl_ty = ty. mk_nil ( ) ;
3453
3444
auto decl_id;
3454
3445
alt ( decl. node) {
3455
3446
case ( ast. decl_local( ?local) ) {
@@ -3536,7 +3527,7 @@ fn trans_for_each(@block_ctxt cx,
3536
3527
auto iter_body_llty = type_of_fn_full( lcx. ccx, ast. proto_fn,
3537
3528
none[ TypeRef ] ,
3538
3529
vec( rec( mode=ast. val, ty=decl_ty) ) ,
3539
- plain_ty ( ty. ty_nil ) , 0 u) ;
3530
+ ty. mk_nil ( ) , 0 u) ;
3540
3531
3541
3532
let ValueRef lliterbody = decl_internal_fastcall_fn( lcx. ccx. llmod,
3542
3533
s, iter_body_llty) ;
@@ -4235,8 +4226,7 @@ fn trans_bind_thunk(@local_ctxt cx,
4235
4226
auto bcx = new_top_block_ctxt ( fcx) ;
4236
4227
auto lltop = bcx. llbb ;
4237
4228
4238
- auto llclosure_ptr_ty = type_of ( cx. ccx , ty. plain_box_ty ( closure_ty,
4239
- ast. imm ) ) ;
4229
+ auto llclosure_ptr_ty = type_of ( cx. ccx , ty. mk_imm_box ( closure_ty) ) ;
4240
4230
auto llclosure = bcx. build . PointerCast ( fcx. llenv , llclosure_ptr_ty) ;
4241
4231
4242
4232
auto lltarget = GEP_tup_like ( bcx, closure_ty, llclosure,
@@ -4411,12 +4401,12 @@ fn trans_bind(@block_ctxt cx, @ast.expr f,
4411
4401
}
4412
4402
4413
4403
// Synthesize a closure type.
4414
- let @ty. t bindings_ty = ty. plain_tup_ty ( bound_tys) ;
4404
+ let @ty. t bindings_ty = ty. mk_imm_tup ( bound_tys) ;
4415
4405
4416
4406
// NB: keep this in sync with T_closure_ptr; we're making
4417
4407
// a ty.t structure that has the same "shape" as the LLVM type
4418
4408
// it constructs.
4419
- let @ty. t tydesc_ty = plain_ty ( ty. ty_type ) ;
4409
+ let @ty. t tydesc_ty = ty. mk_type ( ) ;
4420
4410
4421
4411
let vec[ @ty. t] captured_tys =
4422
4412
_vec. init_elt[ @ty. t] ( tydesc_ty, ty_param_count) ;
@@ -4425,9 +4415,9 @@ fn trans_bind(@block_ctxt cx, @ast.expr f,
4425
4415
vec( tydesc_ty,
4426
4416
outgoing_fty,
4427
4417
bindings_ty,
4428
- ty. plain_tup_ty ( captured_tys) ) ;
4418
+ ty. mk_imm_tup ( captured_tys) ) ;
4429
4419
4430
- let @ty. t closure_ty = ty. plain_tup_ty ( closure_tys) ;
4420
+ let @ty. t closure_ty = ty. mk_imm_tup ( closure_tys) ;
4431
4421
4432
4422
auto r = trans_malloc_boxed( bcx, closure_ty) ;
4433
4423
auto box = r. val;
@@ -4829,8 +4819,8 @@ fn trans_vec(@block_ctxt cx, vec[@ast.expr] args,
4829
4819
C_int ( abi. vec_elt_data) ) ) ;
4830
4820
4831
4821
auto pseudo_tup_ty =
4832
- ty. plain_tup_ty ( _vec. init_elt[ @ty. t] ( unit_ty,
4833
- _vec. len[ @ast. expr] ( args) ) ) ;
4822
+ ty. mk_imm_tup ( _vec. init_elt[ @ty. t] ( unit_ty,
4823
+ _vec. len[ @ast. expr] ( args) ) ) ;
4834
4824
let int i = 0 ;
4835
4825
4836
4826
for ( @ast. expr e in args) {
@@ -5927,7 +5917,7 @@ fn populate_fn_ctxt_from_llself(@fn_ctxt fcx, self_vt llself) {
5927
5917
5928
5918
// Synthesize a tuple type for the fields so that GEP_tup_like() can work
5929
5919
// its magic.
5930
- auto fields_tup_ty = ty. plain_tup_ty ( field_tys) ;
5920
+ auto fields_tup_ty = ty. mk_imm_tup ( field_tys) ;
5931
5921
5932
5922
auto n_typarams = _vec. len[ ast. ty_param] ( bcx. fcx. lcx. obj_typarams) ;
5933
5923
let TypeRef llobj_box_ty = T_obj_ptr ( bcx. fcx. lcx. ccx. tn, n_typarams) ;
@@ -6152,18 +6142,18 @@ fn trans_obj(@local_ctxt cx, &ast._obj ob, ast.def_id oid,
6152
6142
}
6153
6143
6154
6144
// Synthesize an obj body type.
6155
- auto tydesc_ty = plain_ty ( ty. ty_type ) ;
6145
+ auto tydesc_ty = ty. mk_type ( ) ;
6156
6146
let vec[ @ty. t] tps = vec( ) ;
6157
6147
for ( ast. ty_param tp in ty_params) {
6158
6148
_vec. push[ @ty. t] ( tps, tydesc_ty) ;
6159
6149
}
6160
6150
6161
- let @ty. t typarams_ty = ty. plain_tup_ty ( tps) ;
6162
- let @ty. t fields_ty = ty. plain_tup_ty ( obj_fields) ;
6163
- let @ty. t body_ty = ty. plain_tup_ty ( vec( tydesc_ty,
6164
- typarams_ty,
6165
- fields_ty) ) ;
6166
- let @ty. t boxed_body_ty = ty. plain_box_ty ( body_ty, ast . imm ) ;
6151
+ let @ty. t typarams_ty = ty. mk_imm_tup ( tps) ;
6152
+ let @ty. t fields_ty = ty. mk_imm_tup ( obj_fields) ;
6153
+ let @ty. t body_ty = ty. mk_imm_tup ( vec( tydesc_ty,
6154
+ typarams_ty,
6155
+ fields_ty) ) ;
6156
+ let @ty. t boxed_body_ty = ty. mk_imm_box ( body_ty) ;
6167
6157
6168
6158
// Malloc a box for the body.
6169
6159
auto box = trans_malloc_boxed( bcx, body_ty) ;
@@ -6265,7 +6255,7 @@ fn trans_tag_variant(@local_ctxt cx, ast.def_id tag_id,
6265
6255
let vec[ @ty. t] ty_param_substs = vec( ) ;
6266
6256
i = 0 u;
6267
6257
for ( ast. ty_param tp in ty_params) {
6268
- ty_param_substs += vec( plain_ty ( ty. ty_param ( i ) ) ) ;
6258
+ ty_param_substs += vec( ty. mk_param ( i ) ) ;
6269
6259
i += 1 u;
6270
6260
}
6271
6261
0 commit comments