@@ -77,6 +77,7 @@ use syntax::opt_vec::OptVec;
77
77
78
78
use core:: option:: { Some , get, is_some, is_none} ;
79
79
use core:: str:: { connect, split_str} ;
80
+ use core:: hashmap:: linear:: LinearMap ;
80
81
use std:: oldmap:: HashMap ;
81
82
82
83
// Definition mapping
@@ -456,7 +457,7 @@ pub struct Module {
456
457
def_id: Option<def_id>,
457
458
kind: ModuleKind,
458
459
459
- children: @HashMap <ident,@mut NameBindings>,
460
+ children: @mut LinearMap <ident, @mut NameBindings>,
460
461
imports: @mut ~[@ImportDirective],
461
462
462
463
// The anonymous children of this node. Anonymous children are pseudo-
@@ -494,7 +495,7 @@ pub fn Module(parent_link: ParentLink,
494
495
parent_link: parent_link,
495
496
def_id: def_id,
496
497
kind: kind,
497
- children: @HashMap (),
498
+ children: @mut LinearMap::new (),
498
499
imports: @mut ~[],
499
500
anonymous_children: @HashMap(),
500
501
import_resolutions: @HashMap(),
@@ -1024,7 +1025,7 @@ pub impl Resolver {
1024
1025
*self.session.str_of(name)));
1025
1026
}
1026
1027
}
1027
- return (child, new_parent);
1028
+ return (* child, new_parent);
1028
1029
}
1029
1030
}
1030
1031
}
@@ -1614,7 +1615,7 @@ pub impl Resolver {
1614
1615
let name_bindings = parent_module.children.get(
1615
1616
&ident);
1616
1617
resolution.type_target =
1617
- Some(Target(parent_module, name_bindings));
1618
+ Some(Target(parent_module, * name_bindings));
1618
1619
}
1619
1620
}
1620
1621
@@ -2165,13 +2166,13 @@ pub impl Resolver {
2165
2166
// Continue.
2166
2167
}
2167
2168
Some ( child_name_bindings) => {
2168
- if ( * child_name_bindings) . defined_in_namespace ( ValueNS ) {
2169
+ if child_name_bindings. defined_in_namespace ( ValueNS ) {
2169
2170
value_result = BoundResult ( containing_module,
2170
- child_name_bindings) ;
2171
+ * child_name_bindings) ;
2171
2172
}
2172
- if ( * child_name_bindings) . defined_in_namespace ( TypeNS ) {
2173
+ if child_name_bindings. defined_in_namespace ( TypeNS ) {
2173
2174
type_result = BoundResult ( containing_module,
2174
- child_name_bindings) ;
2175
+ * child_name_bindings) ;
2175
2176
}
2176
2177
}
2177
2178
}
@@ -2352,9 +2353,9 @@ pub impl Resolver {
2352
2353
// Continue.
2353
2354
}
2354
2355
Some ( child_name_bindings) => {
2355
- if ( * child_name_bindings) . defined_in_namespace ( TypeNS ) {
2356
+ if child_name_bindings. defined_in_namespace ( TypeNS ) {
2356
2357
module_result = BoundResult ( containing_module,
2357
- child_name_bindings) ;
2358
+ * child_name_bindings) ;
2358
2359
}
2359
2360
}
2360
2361
}
@@ -2534,16 +2535,16 @@ pub impl Resolver {
2534
2535
}
2535
2536
2536
2537
// Add all children from the containing module.
2537
- for containing_module. children. each |& ident, & name_bindings| {
2538
+ for containing_module. children. each |& ( ident, name_bindings) | {
2538
2539
let mut dest_import_resolution;
2539
- match module_. import_resolutions. find( & ident) {
2540
+ match module_. import_resolutions. find( ident) {
2540
2541
None => {
2541
2542
// Create a new import resolution from this child.
2542
2543
dest_import_resolution = @mut ImportResolution ( privacy,
2543
2544
span,
2544
2545
state) ;
2545
2546
module_. import_resolutions . insert
2546
- ( ident, dest_import_resolution) ;
2547
+ ( * ident, dest_import_resolution) ;
2547
2548
}
2548
2549
Some ( existing_import_resolution) => {
2549
2550
dest_import_resolution = existing_import_resolution;
@@ -2552,21 +2553,21 @@ pub impl Resolver {
2552
2553
2553
2554
debug ! ( "(resolving glob import) writing resolution `%s` in `%s` \
2554
2555
to `%s`, privacy=%?",
2555
- * self . session. str_of( ident) ,
2556
+ * self . session. str_of( * ident) ,
2556
2557
self . module_to_str( containing_module) ,
2557
2558
self . module_to_str( module_) ,
2558
2559
copy dest_import_resolution. privacy) ;
2559
2560
2560
2561
// Merge the child item into the import resolution.
2561
- if ( * name_bindings) . defined_in_public_namespace ( ValueNS ) {
2562
+ if name_bindings. defined_in_public_namespace ( ValueNS ) {
2562
2563
debug ! ( "(resolving glob import) ... for value target" ) ;
2563
2564
dest_import_resolution. value_target =
2564
- Some ( Target ( containing_module, name_bindings) ) ;
2565
+ Some ( Target ( containing_module, * name_bindings) ) ;
2565
2566
}
2566
- if ( * name_bindings) . defined_in_public_namespace ( TypeNS ) {
2567
+ if name_bindings. defined_in_public_namespace ( TypeNS ) {
2567
2568
debug ! ( "(resolving glob import) ... for type target" ) ;
2568
2569
dest_import_resolution. type_target =
2569
- Some ( Target ( containing_module, name_bindings) ) ;
2570
+ Some ( Target ( containing_module, * name_bindings) ) ;
2570
2571
}
2571
2572
}
2572
2573
@@ -2760,8 +2761,8 @@ pub impl Resolver {
2760
2761
2761
2762
match module_. children . find ( & name) {
2762
2763
Some ( name_bindings)
2763
- if ( * name_bindings) . defined_in_namespace ( namespace) => {
2764
- return Success ( Target ( module_, name_bindings) ) ;
2764
+ if name_bindings. defined_in_namespace ( namespace) => {
2765
+ return Success ( Target ( module_, * name_bindings) ) ;
2765
2766
}
2766
2767
Some ( _) | None => { /* Not found; continue. */ }
2767
2768
}
@@ -3005,10 +3006,9 @@ pub impl Resolver {
3005
3006
// First, check the direct children of the module.
3006
3007
match module_. children . find ( & name) {
3007
3008
Some ( name_bindings)
3008
- if ( * name_bindings) . defined_in_namespace ( namespace) => {
3009
-
3009
+ if name_bindings. defined_in_namespace ( namespace) => {
3010
3010
debug ! ( "(resolving name in module) found node as child" ) ;
3011
- return Success ( Target ( module_, name_bindings) ) ;
3011
+ return Success ( Target ( module_, * name_bindings) ) ;
3012
3012
}
3013
3013
Some ( _) | None => {
3014
3014
// Continue.
@@ -3190,7 +3190,7 @@ pub impl Resolver {
3190
3190
fn add_exports_for_module(@mut self,
3191
3191
exports2: &mut ~[Export2],
3192
3192
module_: @mut Module) {
3193
- for module_.children.each |ident, namebindings| {
3193
+ for module_.children.each |&( ident, namebindings) | {
3194
3194
debug!(" ( computing exports) maybe export ' %s' ",
3195
3195
*self.session.str_of(*ident));
3196
3196
self.add_exports_of_namebindings(&mut *exports2,
0 commit comments