@@ -417,12 +417,12 @@ pub enum MapChain<K,V> {
417
417
// get the map from an env frame
418
418
impl < K : Eq + Hash + IterBytes + ' static , V : ' static > MapChain < K , V > {
419
419
// Constructor. I don't think we need a zero-arg one.
420
- fn new ( init : ~HashMap < K , @V > ) -> @mut MapChain < K , V > {
420
+ pub fn new ( init : ~HashMap < K , @V > ) -> @mut MapChain < K , V > {
421
421
@mut BaseMapChain ( init)
422
422
}
423
423
424
424
// add a new frame to the environment (functionally)
425
- fn push_frame ( @mut self ) -> @mut MapChain < K , V > {
425
+ pub fn push_frame ( @mut self ) -> @mut MapChain < K , V > {
426
426
@mut ConsMapChain ( ~HashMap :: new ( ) , self )
427
427
}
428
428
@@ -432,7 +432,7 @@ impl <K: Eq + Hash + IterBytes + 'static, V: 'static> MapChain<K,V>{
432
432
433
433
// ugh: can't get this to compile with mut because of the
434
434
// lack of flow sensitivity.
435
- fn get_map < ' a > ( & ' a self ) -> & ' a HashMap < K , @V > {
435
+ pub fn get_map < ' a > ( & ' a self ) -> & ' a HashMap < K , @V > {
436
436
match * self {
437
437
BaseMapChain ( ~ref map) => map,
438
438
ConsMapChain ( ~ref map, _) => map
@@ -442,7 +442,7 @@ impl <K: Eq + Hash + IterBytes + 'static, V: 'static> MapChain<K,V>{
442
442
// traits just don't work anywhere...?
443
443
//impl Map<Name,SyntaxExtension> for MapChain {
444
444
445
- fn contains_key ( & self , key : & K ) -> bool {
445
+ pub fn contains_key ( & self , key : & K ) -> bool {
446
446
match * self {
447
447
BaseMapChain ( ref map) => map. contains_key ( key) ,
448
448
ConsMapChain ( ref map, ref rest) =>
@@ -453,17 +453,17 @@ impl <K: Eq + Hash + IterBytes + 'static, V: 'static> MapChain<K,V>{
453
453
// should each_key and each_value operate on shadowed
454
454
// names? I think not.
455
455
// delaying implementing this....
456
- fn each_key ( & self , _f : & fn ( & K ) ->bool ) {
456
+ pub fn each_key ( & self , _f : & fn ( & K ) ->bool ) {
457
457
fail ! ( "unimplemented 2013-02-15T10:01" ) ;
458
458
}
459
459
460
- fn each_value ( & self , _f : & fn ( & V ) -> bool ) {
460
+ pub fn each_value ( & self , _f : & fn ( & V ) -> bool ) {
461
461
fail ! ( "unimplemented 2013-02-15T10:02" ) ;
462
462
}
463
463
464
464
// Returns a copy of the value that the name maps to.
465
465
// Goes down the chain 'til it finds one (or bottom out).
466
- fn find ( & self , key : & K ) -> Option < @V > {
466
+ pub fn find ( & self , key : & K ) -> Option < @V > {
467
467
match self . get_map ( ) . find ( key) {
468
468
Some ( ref v) => Some ( * * v) ,
469
469
None => match * self {
@@ -473,7 +473,7 @@ impl <K: Eq + Hash + IterBytes + 'static, V: 'static> MapChain<K,V>{
473
473
}
474
474
}
475
475
476
- fn find_in_topmost_frame ( & self , key : & K ) -> Option < @V > {
476
+ pub fn find_in_topmost_frame ( & self , key : & K ) -> Option < @V > {
477
477
let map = match * self {
478
478
BaseMapChain ( ref map) => map,
479
479
ConsMapChain ( ref map, _) => map
@@ -483,7 +483,7 @@ impl <K: Eq + Hash + IterBytes + 'static, V: 'static> MapChain<K,V>{
483
483
}
484
484
485
485
// insert the binding into the top-level map
486
- fn insert ( & mut self , key : K , ext : @V ) -> bool {
486
+ pub fn insert ( & mut self , key : K , ext : @V ) -> bool {
487
487
// can't abstract over get_map because of flow sensitivity...
488
488
match * self {
489
489
BaseMapChain ( ~ref mut map) => map. insert ( key, ext) ,
@@ -495,7 +495,7 @@ impl <K: Eq + Hash + IterBytes + 'static, V: 'static> MapChain<K,V>{
495
495
// ... there are definitely some opportunities for abstraction
496
496
// here that I'm ignoring. (e.g., manufacturing a predicate on
497
497
// the maps in the chain, and using an abstract "find".
498
- fn insert_into_frame( & mut self , key : K , ext : @V , n : K , pred : & fn ( & @V ) ->bool ) {
498
+ pub fn insert_into_frame( & mut self , key : K , ext : @V , n : K , pred : & fn ( & @V ) ->bool ) {
499
499
match * self {
500
500
BaseMapChain ( ~ref mut map) => {
501
501
if satisfies_pred ( map, & n, pred) {
0 commit comments