Skip to content

Commit

Permalink
Switch Module.import_resolutions from oldmap
Browse files Browse the repository at this point in the history
  • Loading branch information
sanxiyn committed Mar 21, 2013
1 parent e84323e commit f68f228
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/librustc/middle/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
}
Expand Down Expand Up @@ -2242,11 +2242,11 @@ pub impl Resolver {
// 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);
}
}
Expand Down Expand Up @@ -2484,15 +2484,15 @@ pub impl Resolver {

// 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`",
is_none(&mut target_import_resolution.type_target),
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 =
Expand All @@ -2505,7 +2505,7 @@ pub impl Resolver {
copy target_import_resolution.type_target;

module_.import_resolutions.insert
(ident, new_import_resolution);
(*ident, new_import_resolution);
}
None => { /* continue ... */ }
Some(dest_import_resolution) => {
Expand Down Expand Up @@ -2547,7 +2547,7 @@ pub impl Resolver {
(*ident, dest_import_resolution);
}
Some(existing_import_resolution) => {
dest_import_resolution = existing_import_resolution;
dest_import_resolution = *existing_import_resolution;
}
}

Expand Down Expand Up @@ -3205,7 +3205,7 @@ pub impl Resolver {
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));
Expand Down Expand Up @@ -5308,9 +5308,9 @@ pub impl Resolver {
}

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:?";
Expand All @@ -5319,15 +5319,15 @@ pub impl Resolver {
}

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:?";
// FIXME #4954
}
}

debug!("* %s:%s%s", *self.session.str_of(name),
debug!("* %s:%s%s", *self.session.str_of(*name),
value_repr, type_repr);
}
}
Expand Down

0 comments on commit f68f228

Please sign in to comment.