diff options
Diffstat (limited to 'src/rustc/metadata')
| -rw-r--r-- | src/rustc/metadata/encoder.rs | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/src/rustc/metadata/encoder.rs b/src/rustc/metadata/encoder.rs index 8d31bd333a1..545d3821f02 100644 --- a/src/rustc/metadata/encoder.rs +++ b/src/rustc/metadata/encoder.rs @@ -205,20 +205,7 @@ fn encode_module_item_paths(ebml_w: ebml::writer, ecx: @encode_ctxt, // class and for its ctor add_to_index(ebml_w, path, index, it.ident); - match struct_def.ctor { - none => { - // Nothing to do. - } - some(ctor) => { - encode_named_def_id(ebml_w, it.ident, - local_def(ctor.node.id)); - } - } - - encode_class_item_paths(ebml_w, - struct_def.members, - vec::append_one(path, it.ident), - index); + encode_struct_def(ebml_w, struct_def, path, it.ident, index); } } item_enum(variants, _) => { @@ -238,6 +225,26 @@ fn encode_module_item_paths(ebml_w: ebml::writer, ecx: @encode_ctxt, } } +fn encode_struct_def(ebml_w: ebml::writer, + struct_def: ast::struct_def, + path: ~[ast::ident], + ident: ast::ident, + &index: ~[entry<~str>]) { + match struct_def.ctor { + none => { + // Nothing to do. + } + some(ctor) => { + encode_named_def_id(ebml_w, ident, local_def(ctor.node.id)); + } + } + + encode_class_item_paths(ebml_w, + struct_def.members, + vec::append_one(path, ident), + index); +} + fn encode_trait_ref(ebml_w: ebml::writer, ecx: @encode_ctxt, t: @trait_ref) { ebml_w.start_tag(tag_impl_trait); encode_type(ecx, ebml_w, node_id_to_type(ecx.tcx, t.ref_id)); |
