@@ -2567,52 +2567,15 @@ impl Resolver {
2567
2567
}
2568
2568
}
2569
2569
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
-
2609
2570
// Add all children from the containing module.
2610
2571
self . populate_module_if_necessary ( containing_module) ;
2611
2572
2612
2573
{
2613
2574
let children = containing_module. children . borrow ( ) ;
2614
2575
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) ;
2616
2579
}
2617
2580
}
2618
2581
@@ -2623,7 +2586,9 @@ impl Resolver {
2623
2586
for ( & name, module) in external_module_children. get ( ) . iter ( ) {
2624
2587
let name_bindings =
2625
2588
@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) ;
2627
2592
}
2628
2593
}
2629
2594
@@ -2641,6 +2606,50 @@ impl Resolver {
2641
2606
return Success ( ( ) ) ;
2642
2607
}
2643
2608
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
+
2644
2653
/// Resolves the given module path from the given root `module_`.
2645
2654
fn resolve_module_path_from_root ( & mut self ,
2646
2655
module_ : @Module ,
0 commit comments