提交 94aa38d4 编写于 作者: M Michael Sullivan

Move some decoder code to the right place.

上级 a3dd67ae
......@@ -777,6 +777,21 @@ fn add_to_index_(item: @item, ebml_w: ebml::writer,
let bkts = create_index(idx, hash_node_id);
encode_index(ebml_w, bkts, write_int);
ebml_w.end_tag();
/* Encode the constructor */
for ctor.each |ctor| {
debug!{"encoding info for ctor %s %d", *item.ident,
ctor.node.id};
vec::push(*index, {
val: ctor.node.id,
pos: ebml_w.writer.tell()
});
encode_info_for_fn(ecx, ebml_w, ctor.node.id, item.ident,
path, if tps.len() > 0u {
some(ii_ctor(ctor, item.ident, tps,
local_def(item.id))) }
else { none }, tps, ctor.node.dec);
}
}
item_impl(tps, traits, _, methods) => {
add_to_index();
......@@ -891,23 +906,6 @@ fn encode_info_for_items(ecx: @encode_ctxt, ebml_w: ebml::writer,
match check ecx.tcx.items.get(i.id) {
ast_map::node_item(_, pt) => {
encode_info_for_item(ecx, ebml_w, i, index, *pt);
/* encode ctor, then encode items */
match i.node {
item_class(tps, _, _, some(ctor), m_dtor) => {
debug!{"encoding info for ctor %s %d", *i.ident,
ctor.node.id};
vec::push(*index, {
val: ctor.node.id,
pos: ebml_w.writer.tell()
});
encode_info_for_fn(ecx, ebml_w, ctor.node.id, i.ident,
*pt, if tps.len() > 0u {
some(ii_ctor(ctor, i.ident, tps,
local_def(i.id))) }
else { none }, tps, ctor.node.dec);
}
_ => {}
}
}
}
},
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册