@@ -52,11 +52,12 @@ const uint tag_index_table = 0x15u;
52
52
mod Encode {
53
53
54
54
type ctxt = rec (
55
- fn ( ast. def_id ) -> str ds // Callback to translate defs to strs.
55
+ fn ( ast. def_id ) -> str ds, // Callback to translate defs to strs.
56
+ @ty. type_store tystore // The type store.
56
57
) ;
57
58
58
59
fn ty_str ( @ctxt cx , ty . t t) -> str {
59
- ret sty_str ( cx, ty. struct ( t) ) ;
60
+ ret sty_str ( cx, ty. struct ( cx . tystore , t) ) ;
60
61
}
61
62
62
63
fn mt_str ( @ctxt cx , & ty. mt mt ) -> str {
@@ -332,11 +333,11 @@ fn encode_variant_id(&ebml.writer ebml_w, ast.def_id vid) {
332
333
ebml. end_tag ( ebml_w) ;
333
334
}
334
335
335
- fn encode_type ( & ebml. writer ebml_w , ty. t typ ) {
336
+ fn encode_type ( @trans . crate_ctxt cx , & ebml. writer ebml_w , ty. t typ ) {
336
337
ebml. start_tag ( ebml_w, tag_items_data_item_type) ;
337
338
338
339
auto f = def_to_str;
339
- auto ty_str_ctxt = @rec ( ds=f) ;
340
+ auto ty_str_ctxt = @rec ( ds=f, tystore=cx . tystore ) ;
340
341
ebml_w. writer . write ( _str. bytes ( Encode . ty_str ( ty_str_ctxt, typ) ) ) ;
341
342
342
343
ebml. end_tag ( ebml_w) ;
@@ -379,7 +380,7 @@ fn encode_tag_variant_info(@trans.crate_ctxt cx, &ebml.writer ebml_w,
379
380
encode_def_id ( ebml_w, variant. node . id ) ;
380
381
encode_kind ( ebml_w, 'v' as u8 ) ;
381
382
encode_tag_id ( ebml_w, did) ;
382
- encode_type ( ebml_w, trans. node_ann_type ( cx, variant. node . ann ) ) ;
383
+ encode_type ( cx , ebml_w, trans. node_ann_type ( cx, variant. node . ann ) ) ;
383
384
if ( _vec. len [ ast. variant_arg ] ( variant. node . args ) > 0 u) {
384
385
encode_symbol ( cx, ebml_w, variant. node . id ) ;
385
386
}
@@ -396,7 +397,7 @@ fn encode_info_for_item(@trans.crate_ctxt cx, &ebml.writer ebml_w,
396
397
ebml. start_tag ( ebml_w, tag_items_data_item) ;
397
398
encode_def_id ( ebml_w, did) ;
398
399
encode_kind ( ebml_w, 'c' as u8 ) ;
399
- encode_type ( ebml_w, trans. node_ann_type ( cx, ann) ) ;
400
+ encode_type ( cx , ebml_w, trans. node_ann_type ( cx, ann) ) ;
400
401
encode_symbol ( cx, ebml_w, did) ;
401
402
ebml. end_tag ( ebml_w) ;
402
403
}
@@ -405,7 +406,7 @@ fn encode_info_for_item(@trans.crate_ctxt cx, &ebml.writer ebml_w,
405
406
encode_def_id ( ebml_w, did) ;
406
407
encode_kind ( ebml_w, 'f' as u8 ) ;
407
408
encode_type_param_count ( ebml_w, tps) ;
408
- encode_type ( ebml_w, trans. node_ann_type ( cx, ann) ) ;
409
+ encode_type ( cx , ebml_w, trans. node_ann_type ( cx, ann) ) ;
409
410
encode_symbol ( cx, ebml_w, did) ;
410
411
ebml. end_tag ( ebml_w) ;
411
412
}
@@ -426,15 +427,15 @@ fn encode_info_for_item(@trans.crate_ctxt cx, &ebml.writer ebml_w,
426
427
encode_def_id ( ebml_w, did) ;
427
428
encode_kind ( ebml_w, 'y' as u8 ) ;
428
429
encode_type_param_count ( ebml_w, tps) ;
429
- encode_type ( ebml_w, trans. node_ann_type ( cx, ann) ) ;
430
+ encode_type ( cx , ebml_w, trans. node_ann_type ( cx, ann) ) ;
430
431
ebml. end_tag ( ebml_w) ;
431
432
}
432
433
case ( ast. item_tag ( ?id, ?variants, ?tps, ?did, ?ann) ) {
433
434
ebml. start_tag ( ebml_w, tag_items_data_item) ;
434
435
encode_def_id ( ebml_w, did) ;
435
436
encode_kind ( ebml_w, 't' as u8 ) ;
436
437
encode_type_param_count ( ebml_w, tps) ;
437
- encode_type ( ebml_w, trans. node_ann_type ( cx, ann) ) ;
438
+ encode_type ( cx , ebml_w, trans. node_ann_type ( cx, ann) ) ;
438
439
for ( ast. variant v in variants) {
439
440
encode_variant_id ( ebml_w, v. node . id ) ;
440
441
}
@@ -448,15 +449,15 @@ fn encode_info_for_item(@trans.crate_ctxt cx, &ebml.writer ebml_w,
448
449
encode_kind ( ebml_w, 'o' as u8 ) ;
449
450
encode_type_param_count ( ebml_w, tps) ;
450
451
auto fn_ty = trans. node_ann_type ( cx, ann) ;
451
- encode_type ( ebml_w, fn_ty) ;
452
+ encode_type ( cx , ebml_w, fn_ty) ;
452
453
encode_symbol ( cx, ebml_w, odid. ctor ) ;
453
454
ebml. end_tag ( ebml_w) ;
454
455
455
456
ebml. start_tag ( ebml_w, tag_items_data_item) ;
456
457
encode_def_id ( ebml_w, odid. ty ) ;
457
458
encode_kind ( ebml_w, 'y' as u8 ) ;
458
459
encode_type_param_count ( ebml_w, tps) ;
459
- encode_type ( ebml_w, ty. ty_fn_ret ( fn_ty) ) ;
460
+ encode_type ( cx , ebml_w, ty. ty_fn_ret ( cx . tystore , fn_ty) ) ;
460
461
ebml. end_tag ( ebml_w) ;
461
462
}
462
463
}
@@ -469,13 +470,13 @@ fn encode_info_for_native_item(@trans.crate_ctxt cx, &ebml.writer ebml_w,
469
470
case ( ast. native_item_ty ( _, ?did) ) {
470
471
encode_def_id ( ebml_w, did) ;
471
472
encode_kind ( ebml_w, 'T' as u8 ) ;
472
- encode_type ( ebml_w, ty. mk_native ( cx. tystore ) ) ;
473
+ encode_type ( cx , ebml_w, ty. mk_native ( cx. tystore ) ) ;
473
474
}
474
475
case ( ast. native_item_fn ( _, _, _, ?tps, ?did, ?ann) ) {
475
476
encode_def_id ( ebml_w, did) ;
476
477
encode_kind ( ebml_w, 'F' as u8 ) ;
477
478
encode_type_param_count ( ebml_w, tps) ;
478
- encode_type ( ebml_w, trans. node_ann_type ( cx, ann) ) ;
479
+ encode_type ( cx , ebml_w, trans. node_ann_type ( cx, ann) ) ;
479
480
encode_symbol ( cx, ebml_w, did) ;
480
481
}
481
482
}
0 commit comments