8
8
// option. This file may not be copied, modified, or distributed
9
9
// except according to those terms.
10
10
11
+ use self :: Determinacy :: * ;
11
12
use self :: ImportDirectiveSubclass :: * ;
12
13
13
14
use Module ;
@@ -36,14 +37,20 @@ impl<'a> Resolver<'a> {
36
37
}
37
38
}
38
39
40
+ #[ derive( Copy , Clone , Debug ) ]
41
+ pub enum Determinacy {
42
+ Determined ,
43
+ Undetermined ,
44
+ }
45
+
39
46
/// Contains data for specific types of import directives.
40
47
#[ derive( Clone , Debug ) ]
41
48
pub enum ImportDirectiveSubclass < ' a > {
42
49
SingleImport {
43
50
target : Name ,
44
51
source : Name ,
45
- value_result : Cell < Result < & ' a NameBinding < ' a > , bool /* determined? */ > > ,
46
- type_result : Cell < Result < & ' a NameBinding < ' a > , bool /* determined? */ > > ,
52
+ value_result : Cell < Result < & ' a NameBinding < ' a > , Determinacy > > ,
53
+ type_result : Cell < Result < & ' a NameBinding < ' a > , Determinacy > > ,
47
54
} ,
48
55
GlobImport { is_prelude : bool } ,
49
56
}
@@ -53,8 +60,8 @@ impl<'a> ImportDirectiveSubclass<'a> {
53
60
SingleImport {
54
61
target : target,
55
62
source : source,
56
- type_result : Cell :: new ( Err ( false ) ) ,
57
- value_result : Cell :: new ( Err ( false ) ) ,
63
+ type_result : Cell :: new ( Err ( Undetermined ) ) ,
64
+ value_result : Cell :: new ( Err ( Undetermined ) ) ,
58
65
}
59
66
}
60
67
}
@@ -497,21 +504,21 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> {
497
504
498
505
let mut indeterminate = false ;
499
506
for & ( ns, result) in & [ ( ValueNS , value_result) , ( TypeNS , type_result) ] {
500
- if let Err ( false ) = result. get ( ) {
507
+ if let Err ( Undetermined ) = result. get ( ) {
501
508
result. set ( {
502
509
match self . resolve_name_in_module ( module, source, ns, false , None ) {
503
510
Success ( binding) => Ok ( binding) ,
504
- Indeterminate => Err ( false ) ,
505
- Failed ( _) => Err ( true ) ,
511
+ Indeterminate => Err ( Undetermined ) ,
512
+ Failed ( _) => Err ( Determined ) ,
506
513
}
507
514
} ) ;
508
515
} else {
509
516
continue
510
517
} ;
511
518
512
519
match result. get ( ) {
513
- Err ( false ) => indeterminate = true ,
514
- Err ( true ) => {
520
+ Err ( Undetermined ) => indeterminate = true ,
521
+ Err ( Determined ) => {
515
522
self . update_resolution ( directive. parent , target, ns, |_, resolution| {
516
523
resolution. single_imports . directive_failed ( )
517
524
} ) ;
0 commit comments