@@ -9,7 +9,7 @@ import ebml::writer;
9
9
import syntax:: ast:: * ;
10
10
import syntax:: print:: pprust;
11
11
import syntax:: { ast_util, visit} ;
12
- import syntax:: ast_util:: local_def ;
12
+ import syntax:: ast_util:: * ;
13
13
import common:: * ;
14
14
import middle:: ty;
15
15
import middle:: ty:: node_id_to_type;
@@ -206,12 +206,6 @@ fn encode_module_item_paths(ebml_w: ebml::writer, ecx: @encode_ctxt,
206
206
add_to_index( ebml_w, path, index, it. ident) ;
207
207
encode_named_def_id( ebml_w, it. ident,
208
208
local_def( ctor. node. id) ) ;
209
- /* Encode id for dtor */
210
- option:: iter( m_dtor) { |dtor|
211
- ebml_w. wr_tag( tag_item_dtor) { ||
212
- encode_def_id( ebml_w, local_def( dtor. node. id) ) ;
213
- }
214
- } ;
215
209
encode_class_item_paths( ebml_w, items, path + [ it. ident] ,
216
210
index) ;
217
211
}
@@ -485,8 +479,8 @@ fn encode_info_for_fn(ecx: @encode_ctxt, ebml_w: ebml::writer,
485
479
encode_family( ebml_w, purity_fn_family( decl. purity) ) ;
486
480
encode_type_param_bounds( ebml_w, ecx, tps) ;
487
481
let its_ty = node_id_to_type( ecx. tcx, id) ;
488
- #debug( "fn name = %s ty = %s", ident,
489
- util:: ppaux:: ty_to_str( ecx. tcx, its_ty) ) ;
482
+ #debug( "fn name = %s ty = %s its node id = %d ", ident,
483
+ util:: ppaux:: ty_to_str( ecx. tcx, its_ty) , id ) ;
490
484
encode_type( ecx, ebml_w, its_ty) ;
491
485
encode_path( ebml_w, path, ast_map:: path_name( ident) ) ;
492
486
alt item {
@@ -623,13 +617,23 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::writer, item: @item,
623
617
encode_enum_variant_info( ecx, ebml_w, item. id, variants,
624
618
path, index, tps) ;
625
619
}
626
- item_class( tps, ifaces, items, ctor, _dtor , rp) {
620
+ item_class( tps, ifaces, items, ctor, m_dtor , rp) {
627
621
/* First, encode the fields and methods
628
622
These come first because we need to write them to make
629
623
the index, and the index needs to be in the item for the
630
624
class itself */
631
625
let idx = encode_info_for_class( ecx, ebml_w, item. id, path, tps,
632
626
items, index) ;
627
+ /* Encode the dtor */
628
+ option:: iter( m_dtor) { |dtor|
629
+ * index += [ { val: dtor. node. id, pos: ebml_w. writer. tell( ) } ] ;
630
+ encode_info_for_fn( ecx, ebml_w, dtor. node. id, item. ident
631
+ + "_dtor", path, if tps. len( ) > 0 u {
632
+ some( ii_dtor( dtor, item. ident, tps,
633
+ local_def( item. id) ) ) }
634
+ else { none } , tps, ast_util:: dtor_dec( ) ) ;
635
+ }
636
+
633
637
/* Index the class*/
634
638
add_to_index( ) ;
635
639
/* Now, make an item for the class itself */
@@ -644,6 +648,14 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::writer, item: @item,
644
648
for ifaces. each { |t|
645
649
encode_iface_ref( ebml_w, ecx, t) ;
646
650
}
651
+ /* Encode the dtor */
652
+ /* Encode id for dtor */
653
+ option:: iter( m_dtor) { |dtor|
654
+ ebml_w. wr_tag( tag_item_dtor) { ||
655
+ encode_def_id( ebml_w, local_def( dtor. node. id) ) ;
656
+ }
657
+ } ;
658
+
647
659
/* Encode def_ids for each field and method
648
660
for methods, write all the stuff get_iface_method
649
661
needs to know*/
@@ -803,17 +815,15 @@ fn encode_info_for_items(ecx: @encode_ctxt, ebml_w: ebml::writer,
803
815
encode_info_for_item( ecx, ebml_w, i, index, * pt) ;
804
816
/* encode ctor, then encode items */
805
817
alt i. node {
806
- item_class( tps, _, _, ctor, _, _) {
807
- /* this is assuming that ctors aren't inlined...
808
- probably shouldn't assume that */
818
+ item_class( tps, _, _, ctor, m_dtor, _) {
809
819
#debug( "encoding info for ctor %s %d", i. ident,
810
820
ctor. node. id) ;
811
821
* index += [ { val: ctor. node. id, pos: ebml_w. writer. tell( ) } ] ;
812
822
encode_info_for_fn( ecx, ebml_w, ctor. node. id, i. ident,
813
823
* pt, if tps. len( ) > 0 u {
814
824
some( ii_ctor( ctor, i. ident, tps,
815
825
local_def( i. id) ) ) }
816
- else { none } , tps, ctor. node. dec)
826
+ else { none } , tps, ctor. node. dec) ;
817
827
}
818
828
_ { }
819
829
}
0 commit comments