Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make sure Mixy / Baggy coerce correctly to each other
  • Loading branch information
lizmat committed Oct 4, 2013
1 parent 560b416 commit 4b41c01
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/core/Bag.pm
Expand Up @@ -29,6 +29,8 @@ my class Bag does Baggy {
X::Immutable.new( method => 'grab', typename => self.^name ).throw;
}

method Bag { self }
method Bag { self }
method BagHash { BagHash.new-fp(nqp::getattr(self, Bag, '%!elems').values) }
method Mix { Mix.new-fp(nqp::getattr(self, Bag, '%!elems').values) }
method MixHash { MixHash.new-fp(nqp::getattr(self, Bag, '%!elems').values) }
}
6 changes: 6 additions & 0 deletions src/core/BagHash.pm
Expand Up @@ -51,4 +51,10 @@ my class BagHash does Baggy {
}
}
method BagHash { self }
method Mix {
Mix.new-fp(nqp::getattr(self, BagHash, '%!elems').values);
}
method MixHash {
MixHash.new-fp(nqp::getattr(self, BagHash, '%!elems').values);
}
}
2 changes: 2 additions & 0 deletions src/core/Mix.pm
Expand Up @@ -21,4 +21,6 @@ my class Mix does Mixy {

method Mix { self }
method MixHash { MixHash.new-fp(nqp::getattr(self, Mix, '%!elems').values) }
method Bag { Bag.new-fp(nqp::getattr(self, Mix, '%!elems').values) }
method BagHash { BagHash.new-fp(nqp::getattr(self, Mix, '%!elems').values) }
}
6 changes: 6 additions & 0 deletions src/core/MixHash.pm
Expand Up @@ -48,4 +48,10 @@ my class MixHash does Mixy {
}
}
method MixHash { self }
method Bag {
Bag.new-fp(nqp::getattr(self, MixHash, '%!elems').values);
}
method BagHash {
BagHash.new-fp(nqp::getattr(self, MixHash, '%!elems').values);
}
}

0 comments on commit 4b41c01

Please sign in to comment.