Skip to content

Commit 94aa38d

Browse files
committed
Move some decoder code to the right place.
1 parent a3dd67a commit 94aa38d

File tree

1 file changed

+15
-17
lines changed

1 file changed

+15
-17
lines changed

src/rustc/metadata/encoder.rs

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -777,6 +777,21 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::writer, item: @item,
777777
let bkts = create_index(idx, hash_node_id);
778778
encode_index(ebml_w, bkts, write_int);
779779
ebml_w.end_tag();
780+
781+
/* Encode the constructor */
782+
for ctor.each |ctor| {
783+
debug!{"encoding info for ctor %s %d", *item.ident,
784+
ctor.node.id};
785+
vec::push(*index, {
786+
val: ctor.node.id,
787+
pos: ebml_w.writer.tell()
788+
});
789+
encode_info_for_fn(ecx, ebml_w, ctor.node.id, item.ident,
790+
path, if tps.len() > 0u {
791+
some(ii_ctor(ctor, item.ident, tps,
792+
local_def(item.id))) }
793+
else { none }, tps, ctor.node.dec);
794+
}
780795
}
781796
item_impl(tps, traits, _, methods) => {
782797
add_to_index();
@@ -891,23 +906,6 @@ fn encode_info_for_items(ecx: @encode_ctxt, ebml_w: ebml::writer,
891906
match check ecx.tcx.items.get(i.id) {
892907
ast_map::node_item(_, pt) => {
893908
encode_info_for_item(ecx, ebml_w, i, index, *pt);
894-
/* encode ctor, then encode items */
895-
match i.node {
896-
item_class(tps, _, _, some(ctor), m_dtor) => {
897-
debug!{"encoding info for ctor %s %d", *i.ident,
898-
ctor.node.id};
899-
vec::push(*index, {
900-
val: ctor.node.id,
901-
pos: ebml_w.writer.tell()
902-
});
903-
encode_info_for_fn(ecx, ebml_w, ctor.node.id, i.ident,
904-
*pt, if tps.len() > 0u {
905-
some(ii_ctor(ctor, i.ident, tps,
906-
local_def(i.id))) }
907-
else { none }, tps, ctor.node.dec);
908-
}
909-
_ => {}
910-
}
911909
}
912910
}
913911
},

0 commit comments

Comments
 (0)