@@ -29,6 +29,7 @@ use syntax::opt_vec::OptVec;
29
29
use syntax:: visit;
30
30
use syntax:: visit:: Visitor ;
31
31
32
+ use std:: cell:: Cell ;
32
33
use std:: uint;
33
34
use std:: hashmap:: { HashMap , HashSet } ;
34
35
use std:: util;
@@ -416,7 +417,7 @@ enum ModuleKind {
416
417
struct Module {
417
418
parent_link : ParentLink ,
418
419
def_id : Option < DefId > ,
419
- kind : ModuleKind ,
420
+ kind : Cell < ModuleKind > ,
420
421
is_public : bool ,
421
422
422
423
children : @mut HashMap < Name , @mut NameBindings > ,
@@ -463,11 +464,11 @@ impl Module {
463
464
kind : ModuleKind ,
464
465
external : bool ,
465
466
is_public : bool )
466
- -> Module {
467
+ -> Module {
467
468
Module {
468
469
parent_link : parent_link,
469
470
def_id : def_id,
470
- kind : kind,
471
+ kind : Cell :: new ( kind) ,
471
472
is_public : is_public,
472
473
children : @mut HashMap :: new ( ) ,
473
474
imports : @mut ~[ ] ,
@@ -581,7 +582,7 @@ impl NameBindings {
581
582
type_span : None ,
582
583
} )
583
584
}
584
- Some ( module_def) => module_def. kind = kind,
585
+ Some ( module_def) => module_def. kind . set ( kind) ,
585
586
}
586
587
}
587
588
}
@@ -1238,7 +1239,7 @@ impl Resolver {
1238
1239
// It already exists
1239
1240
Some ( & child) if child. get_module_if_available ( )
1240
1241
. is_some ( ) &&
1241
- child. get_module ( ) . kind ==
1242
+ child. get_module ( ) . kind . get ( ) ==
1242
1243
ImplModuleKind => {
1243
1244
ModuleReducedGraphParent ( child. get_module ( ) )
1244
1245
}
@@ -1805,7 +1806,7 @@ impl Resolver {
1805
1806
1806
1807
// Mark it as an impl module if
1807
1808
// necessary.
1808
- type_module. kind = ImplModuleKind ;
1809
+ type_module. kind . set ( ImplModuleKind ) ;
1809
1810
}
1810
1811
Some ( _) | None => {
1811
1812
let parent_link =
@@ -2649,7 +2650,7 @@ impl Resolver {
2649
2650
// import, do not allow traits and impls
2650
2651
// to be selected.
2651
2652
match ( name_search_type,
2652
- module_def. kind ) {
2653
+ module_def. kind . get ( ) ) {
2653
2654
( ImportSearch , TraitModuleKind ) |
2654
2655
( ImportSearch , ImplModuleKind ) => {
2655
2656
self . resolve_error (
@@ -2879,7 +2880,7 @@ impl Resolver {
2879
2880
ModuleParentLink ( parent_module_node, _) => {
2880
2881
match search_through_modules {
2881
2882
DontSearchThroughModules => {
2882
- match search_module. kind {
2883
+ match search_module. kind . get ( ) {
2883
2884
NormalModuleKind => {
2884
2885
// We stop the search here.
2885
2886
debug ! ( "(resolving item in lexical \
@@ -2987,7 +2988,7 @@ impl Resolver {
2987
2988
NoParentLink => return None ,
2988
2989
ModuleParentLink ( new_module, _) |
2989
2990
BlockParentLink ( new_module, _) => {
2990
- match new_module. kind {
2991
+ match new_module. kind . get ( ) {
2991
2992
NormalModuleKind => return Some ( new_module) ,
2992
2993
ExternModuleKind |
2993
2994
TraitModuleKind |
@@ -3004,7 +3005,7 @@ impl Resolver {
3004
3005
fn get_nearest_normal_module_parent_or_self ( & mut self ,
3005
3006
module_ : @mut Module )
3006
3007
-> @mut Module {
3007
- match module_. kind {
3008
+ match module_. kind . get ( ) {
3008
3009
NormalModuleKind => return module_,
3009
3010
ExternModuleKind |
3010
3011
TraitModuleKind |
@@ -4702,7 +4703,7 @@ impl Resolver {
4702
4703
( def, last_private. or ( lp) )
4703
4704
}
4704
4705
} ;
4705
- match containing_module. kind {
4706
+ match containing_module. kind . get ( ) {
4706
4707
TraitModuleKind | ImplModuleKind => {
4707
4708
match self . method_map . find ( & ident. name ) {
4708
4709
Some ( s) => {
0 commit comments