about summary refs log tree commit diff
path: root/src/rustc
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2012-08-17 16:38:07 -0700
committerPatrick Walton <pcwalton@mimiga.net>2012-08-17 16:38:07 -0700
commit10c997a746178085b6b447a76e237dd08c5446fa (patch)
treeed249f782faeaefb4db593c00d6db64d600ea5e3 /src/rustc
parent1ed94a56744c0ed4056c22da297d84222f4327f2 (diff)
downloadrust-10c997a746178085b6b447a76e237dd08c5446fa.tar.gz
rust-10c997a746178085b6b447a76e237dd08c5446fa.zip
rustc: Get rid of the impl_map in the encoder
Diffstat (limited to 'src/rustc')
-rw-r--r--src/rustc/metadata/encoder.rs46
1 files changed, 20 insertions, 26 deletions
diff --git a/src/rustc/metadata/encoder.rs b/src/rustc/metadata/encoder.rs
index 926a448180f..02fb03efe9f 100644
--- a/src/rustc/metadata/encoder.rs
+++ b/src/rustc/metadata/encoder.rs
@@ -262,32 +262,26 @@ fn encode_info_for_mod(ecx: @encode_ctxt, ebml_w: ebml::writer, md: _mod,
     encode_family(ebml_w, 'm');
     encode_name(ebml_w, name);
     debug!{"(encoding info for module) encoding info for module ID %d", id};
-    // the impl map contains ref_ids
-    let impls = ecx.impl_map(id);
-    for impls.each |i| {
-        let (ident, did) = i;
-        debug!{"(encoding info for module) ... encoding impl %s (%?/%?), \
-                exported? %?",
-               *ident,
-               did,
-               ast_map::node_id_to_str(ecx.tcx.items, did.node),
-               ast_util::is_exported(ident, md)};
-
-        ebml_w.start_tag(tag_mod_impl);
-        match ecx.tcx.items.find(did.node) {
-          some(ast_map::node_item(it@@{node: cl@item_class(*),_},_)) => {
-        /* If did stands for a trait
-        ref, we need to map it to its parent class */
-            ebml_w.wr_str(def_to_str(local_def(it.id)));
-          }
-          _ => {
-            // Must be a re-export, then!
-            // ...or a trait ref
-            ebml_w.wr_str(def_to_str(did));
-          }
-        };
-        ebml_w.end_tag();
-    } // for
+
+    // Encode info about all the module children.
+    for md.items.each |item| {
+        match item.node {
+            item_impl(*) | item_class(*) => {
+                let (ident, did) = (item.ident, item.id);
+                debug!{"(encoding info for module) ... encoding impl %s \
+                        (%?/%?), exported? %?",
+                       *ident,
+                       did,
+                       ast_map::node_id_to_str(ecx.tcx.items, did),
+                       ast_util::is_exported(ident, md)};
+
+                ebml_w.start_tag(tag_mod_impl);
+                ebml_w.wr_str(def_to_str(local_def(did)));
+                ebml_w.end_tag();
+            }
+            _ => {} // XXX: Encode these too.
+        }
+    }
 
     encode_path(ebml_w, path, ast_map::path_mod(name));