about summary refs log tree commit diff
path: root/src/rustc/metadata
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2012-08-07 16:46:19 -0700
committerPatrick Walton <pcwalton@mimiga.net>2012-08-07 16:46:19 -0700
commit61446293f91cd7a4dff7ca5e17ca5eced22577ad (patch)
tree97d369ffb2cde11b0f94337a7efb8aaca0020af0 /src/rustc/metadata
parent0f711e72f72cf69166902fe9df9c5063e5aa14ff (diff)
downloadrust-61446293f91cd7a4dff7ca5e17ca5eced22577ad.tar.gz
rust-61446293f91cd7a4dff7ca5e17ca5eced22577ad.zip
rustc: Move some more routines that operate on struct definitions out of line
Diffstat (limited to 'src/rustc/metadata')
-rw-r--r--src/rustc/metadata/encoder.rs35
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));