]> git.lizzy.rs Git - rust.git/commitdiff
Switch Module.import_resolutions from oldmap
authorSeo Sanghyeon <sanxiyn@gmail.com>
Thu, 21 Mar 2013 08:10:57 +0000 (17:10 +0900)
committerSeo Sanghyeon <sanxiyn@gmail.com>
Thu, 21 Mar 2013 08:10:57 +0000 (17:10 +0900)
src/librustc/middle/resolve.rs

index 6df86d21cb7c476d5f1fc6ba38a19f004ee609a2..84ebfa3eecc4cfe5b0dbbd42deb4f9dd616158ef 100644 (file)
@@ -478,7 +478,7 @@ pub struct Module {
     anonymous_children: @HashMap<node_id,@mut Module>,
 
     // The status of resolving each import in this module.
-    import_resolutions: @HashMap<ident,@mut ImportResolution>,
+    import_resolutions: @mut LinearMap<ident, @mut ImportResolution>,
 
     // The number of unresolved globs that this module exports.
     glob_count: uint,
@@ -498,7 +498,7 @@ pub fn Module(parent_link: ParentLink,
         children: @mut LinearMap::new(),
         imports: @mut ~[],
         anonymous_children: @HashMap(),
-        import_resolutions: @HashMap(),
+        import_resolutions: @mut LinearMap::new(),
         glob_count: 0,
         resolved_import_count: 0
     }
@@ -2242,11 +2242,11 @@ fn get_binding(import_resolution:
                         // The name is an import which has been fully
                         // resolved. We can, therefore, just follow it.
                         if value_result.is_unknown() {
-                            value_result = get_binding(import_resolution,
+                            value_result = get_binding(*import_resolution,
                                                        ValueNS);
                         }
                         if type_result.is_unknown() {
-                            type_result = get_binding(import_resolution,
+                            type_result = get_binding(*import_resolution,
                                                       TypeNS);
                         }
                     }
@@ -2484,7 +2484,7 @@ fn resolve_glob_import(@mut self,
 
         // Add all resolved imports from the containing module.
         for containing_module.import_resolutions.each
-                |&ident, &target_import_resolution| {
+                |&(ident, target_import_resolution)| {
 
             debug!("(resolving glob import) writing module resolution \
                     %? into `%s`",
@@ -2492,7 +2492,7 @@ fn resolve_glob_import(@mut self,
                    self.module_to_str(module_));
 
             // Here we merge two import resolutions.
-            match module_.import_resolutions.find(&ident) {
+            match module_.import_resolutions.find(ident) {
                 None if target_import_resolution.privacy == Public => {
                     // Simple: just copy the old import resolution.
                     let new_import_resolution =
@@ -2505,7 +2505,7 @@ fn resolve_glob_import(@mut self,
                         copy target_import_resolution.type_target;
 
                     module_.import_resolutions.insert
-                        (ident, new_import_resolution);
+                        (*ident, new_import_resolution);
                 }
                 None => { /* continue ... */ }
                 Some(dest_import_resolution) => {
@@ -2547,7 +2547,7 @@ fn resolve_glob_import(@mut self,
                         (*ident, dest_import_resolution);
                 }
                 Some(existing_import_resolution) => {
-                    dest_import_resolution = existing_import_resolution;
+                    dest_import_resolution = *existing_import_resolution;
                 }
             }
 
@@ -3205,7 +3205,7 @@ fn add_exports_for_module(@mut self,
                                              false);
         }
 
-        for module_.import_resolutions.each |ident, importresolution| {
+        for module_.import_resolutions.each |&(ident, importresolution)| {
             if importresolution.privacy != Public {
                 debug!("(computing exports) not reexporting private `%s`",
                        *self.session.str_of(*ident));
@@ -5308,9 +5308,9 @@ fn dump_module(@mut self, module_: @mut Module) {
         }
 
         debug!("Import resolutions:");
-        for module_.import_resolutions.each |&name, &import_resolution| {
+        for module_.import_resolutions.each |&(name, import_resolution)| {
             let mut value_repr;
-            match (*import_resolution).target_for_namespace(ValueNS) {
+            match import_resolution.target_for_namespace(ValueNS) {
                 None => { value_repr = ~""; }
                 Some(_) => {
                     value_repr = ~" value:?";
@@ -5319,7 +5319,7 @@ fn dump_module(@mut self, module_: @mut Module) {
             }
 
             let mut type_repr;
-            match (*import_resolution).target_for_namespace(TypeNS) {
+            match import_resolution.target_for_namespace(TypeNS) {
                 None => { type_repr = ~""; }
                 Some(_) => {
                     type_repr = ~" type:?";
@@ -5327,7 +5327,7 @@ fn dump_module(@mut self, module_: @mut Module) {
                 }
             }
 
-            debug!("* %s:%s%s", *self.session.str_of(name),
+            debug!("* %s:%s%s", *self.session.str_of(*name),
                    value_repr, type_repr);
         }
     }