Skip to content

Commit e74f674

Browse files
committed
---
yaml --- r: 108188 b: refs/heads/dist-snap c: b2b4c79 h: refs/heads/master v: v3
1 parent b4f572e commit e74f674

File tree

2 files changed

+51
-42
lines changed

2 files changed

+51
-42
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: f64fdf524a434f0e5cd0bc91d09c144723f3c90d
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: 949e1c7935776ddb3e67ade590e9df58a5894cf8
9+
refs/heads/dist-snap: b2b4c79b179413d4a5e1d706844b11dfca8226c8
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/librustc/middle/resolve.rs

Lines changed: 50 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2567,52 +2567,15 @@ impl Resolver {
25672567
}
25682568
}
25692569

2570-
let merge_import_resolution = |name, name_bindings: @NameBindings| {
2571-
let dest_import_resolution;
2572-
let mut import_resolutions = module_.import_resolutions
2573-
.borrow_mut();
2574-
match import_resolutions.get().find(&name) {
2575-
None => {
2576-
// Create a new import resolution from this child.
2577-
dest_import_resolution =
2578-
@ImportResolution::new(id, is_public);
2579-
import_resolutions.get().insert(name,
2580-
dest_import_resolution);
2581-
}
2582-
Some(&existing_import_resolution) => {
2583-
dest_import_resolution = existing_import_resolution;
2584-
}
2585-
}
2586-
2587-
debug!("(resolving glob import) writing resolution `{}` in `{}` \
2588-
to `{}`",
2589-
token::get_ident(name).get().to_str(),
2590-
self.module_to_str(containing_module),
2591-
self.module_to_str(module_));
2592-
2593-
// Merge the child item into the import resolution.
2594-
if name_bindings.defined_in_public_namespace(ValueNS) {
2595-
debug!("(resolving glob import) ... for value target");
2596-
dest_import_resolution.value_target.set(
2597-
Some(Target::new(containing_module, name_bindings)));
2598-
dest_import_resolution.value_id.set(id);
2599-
}
2600-
if name_bindings.defined_in_public_namespace(TypeNS) {
2601-
debug!("(resolving glob import) ... for type target");
2602-
dest_import_resolution.type_target.set(
2603-
Some(Target::new(containing_module, name_bindings)));
2604-
dest_import_resolution.type_id.set(id);
2605-
}
2606-
dest_import_resolution.is_public.set(is_public);
2607-
};
2608-
26092570
// Add all children from the containing module.
26102571
self.populate_module_if_necessary(containing_module);
26112572

26122573
{
26132574
let children = containing_module.children.borrow();
26142575
for (&name, name_bindings) in children.get().iter() {
2615-
merge_import_resolution(name, *name_bindings);
2576+
self.merge_import_resolution(module_, containing_module,
2577+
id, is_public,
2578+
name, *name_bindings);
26162579
}
26172580
}
26182581

@@ -2623,7 +2586,9 @@ impl Resolver {
26232586
for (&name, module) in external_module_children.get().iter() {
26242587
let name_bindings =
26252588
@Resolver::create_name_bindings_from_module(*module);
2626-
merge_import_resolution(name, name_bindings);
2589+
self.merge_import_resolution(module_, containing_module,
2590+
id, is_public,
2591+
name, name_bindings);
26272592
}
26282593
}
26292594

@@ -2641,6 +2606,50 @@ impl Resolver {
26412606
return Success(());
26422607
}
26432608

2609+
fn merge_import_resolution(&mut self,
2610+
module_: @Module,
2611+
containing_module: @Module,
2612+
id: NodeId,
2613+
is_public: bool,
2614+
name: Name,
2615+
name_bindings: @NameBindings) {
2616+
let dest_import_resolution;
2617+
let mut import_resolutions = module_.import_resolutions.borrow_mut();
2618+
match import_resolutions.get().find(&name) {
2619+
None => {
2620+
// Create a new import resolution from this child.
2621+
dest_import_resolution =
2622+
@ImportResolution::new(id, is_public);
2623+
import_resolutions.get().insert(name,
2624+
dest_import_resolution);
2625+
}
2626+
Some(&existing_import_resolution) => {
2627+
dest_import_resolution = existing_import_resolution;
2628+
}
2629+
}
2630+
2631+
debug!("(resolving glob import) writing resolution `{}` in `{}` \
2632+
to `{}`",
2633+
token::get_ident(name).get().to_str(),
2634+
self.module_to_str(containing_module),
2635+
self.module_to_str(module_));
2636+
2637+
// Merge the child item into the import resolution.
2638+
if name_bindings.defined_in_public_namespace(ValueNS) {
2639+
debug!("(resolving glob import) ... for value target");
2640+
dest_import_resolution.value_target.set(
2641+
Some(Target::new(containing_module, name_bindings)));
2642+
dest_import_resolution.value_id.set(id);
2643+
}
2644+
if name_bindings.defined_in_public_namespace(TypeNS) {
2645+
debug!("(resolving glob import) ... for type target");
2646+
dest_import_resolution.type_target.set(
2647+
Some(Target::new(containing_module, name_bindings)));
2648+
dest_import_resolution.type_id.set(id);
2649+
}
2650+
dest_import_resolution.is_public.set(is_public);
2651+
}
2652+
26442653
/// Resolves the given module path from the given root `module_`.
26452654
fn resolve_module_path_from_root(&mut self,
26462655
module_: @Module,

0 commit comments

Comments
 (0)