@@ -191,7 +191,7 @@ fn encode_module_item_paths(ebml_w: ebml::writer, ecx: @encode_ctxt,
191
191
encode_name_and_def_id( ebml_w, it. ident, it. id) ;
192
192
}
193
193
ebml_w. wr_tag( tag_paths) { ||
194
- // As in the res case, we add the same ident twice: for the
194
+ // We add the same ident twice: for the
195
195
// class and for its ctor
196
196
add_to_index( ebml_w, path, index, it. ident) ;
197
197
encode_named_def_id( ebml_w, it. ident,
@@ -422,8 +422,9 @@ fn encode_info_for_class(ecx: @encode_ctxt, ebml_w: ebml::writer,
422
422
id: node_id, path: ast_map:: path,
423
423
class_tps: [ ty_param] ,
424
424
items: [ @class_member] ,
425
- global_index: @mut [ entry<int>] )
426
- -> [ entry<int>] {
425
+ global_index: @mut [ entry<int>] ) -> [ entry<int>] {
426
+ /* Each class has its own index, since different classes
427
+ may have fields with the same name */
427
428
let index = @mut [ ] ;
428
429
let tcx = ecx. tcx;
429
430
for items. each { |ci|
@@ -432,6 +433,7 @@ fn encode_info_for_class(ecx: @encode_ctxt, ebml_w: ebml::writer,
432
433
alt ci. node {
433
434
instance_var( nm, _, mt, id, vis) {
434
435
* index += [ { val: id, pos: ebml_w. writer. tell( ) } ] ;
436
+ * global_index += [ { val: id, pos: ebml_w. writer. tell( ) } ] ;
435
437
ebml_w. start_tag( tag_items_data_item) ;
436
438
#debug( "encode_info_for_class: doing %s %d", * nm, id) ;
437
439
encode_visibility( ebml_w, vis) ;
@@ -446,8 +448,6 @@ fn encode_info_for_class(ecx: @encode_ctxt, ebml_w: ebml::writer,
446
448
alt m. vis {
447
449
public {
448
450
* index += [ { val: m. id, pos: ebml_w. writer. tell( ) } ] ;
449
- /* Not sure whether we really need to have two indices,
450
- but it works for now -- tjc */
451
451
* global_index += [ { val: m. id, pos: ebml_w. writer. tell( ) } ] ;
452
452
let impl_path = path + [ ast_map:: path_name( m. ident) ] ;
453
453
#debug( "encode_info_for_class: doing %s %d", * m. ident, m. id) ;
0 commit comments