Skip to content
Permalink
Browse files

Make sure that .STORE only works on instances

  • Loading branch information...
lizmat committed Oct 10, 2018
1 parent 9d4c8dd commit 9daac68324dc8f543e66bc3698387a3e2e1df511
Showing with 7 additions and 7 deletions.
  1. +1 −1 src/core/Bag.pm6
  2. +1 −1 src/core/BagHash.pm6
  3. +1 −1 src/core/Hash.pm6
  4. +1 −1 src/core/Mix.pm6
  5. +1 −1 src/core/MixHash.pm6
  6. +1 −1 src/core/Set.pm6
  7. +1 −1 src/core/SetHash.pm6
@@ -23,7 +23,7 @@ my class Bag does Baggy {
}

#--- interface methods
method STORE(*@pairs, :$initialize --> Bag:D) {
method STORE(Bag:D: *@pairs, :$initialize --> Bag:D) {
nqp::if(
(my $iterator := @pairs.iterator).is-lazy,
Failure.new(X::Cannot::Lazy.new(:action<initialize>,:what(self.^name))),
@@ -1,7 +1,7 @@
my class BagHash does Baggy {

#--- interface methods
method STORE(*@pairs --> BagHash:D) {
method STORE(BagHash:D: *@pairs --> BagHash:D) {
nqp::if(
(my $iterator := @pairs.iterator).is-lazy,
Failure.new(X::Cannot::Lazy.new(:action<initialize>,:what(self.^name))),
@@ -71,7 +71,7 @@ my class Hash { # declared in BOOTSTRAP
)
)
}
method STORE(\to_store) {
method STORE(Hash:D: \to_store) {
my $temp := nqp::p6bindattrinvres(
nqp::clone(self), # make sure we get a possible descriptor as well
Map,
@@ -4,7 +4,7 @@ my class Mix does Mixy {
has Real $!total-positive;

#--- interface methods
method STORE(*@pairs, :$initialize --> Mix:D) {
method STORE(Mix:D: *@pairs, :$initialize --> Mix:D) {
nqp::if(
(my $iterator := @pairs.iterator).is-lazy,
Failure.new(X::Cannot::Lazy.new(:action<initialize>,:what(self.^name))),
@@ -4,7 +4,7 @@ my class MixHash does Mixy {
method total() { Rakudo::QuantHash.MIX-TOTAL($!elems) }
method !total-positive() { Rakudo::QuantHash.MIX-TOTAL-POSITIVE($!elems) }

method STORE(*@pairs --> MixHash:D) {
method STORE(MixHash:D: *@pairs --> MixHash:D) {
nqp::if(
(my $iterator := @pairs.iterator).is-lazy,
Failure.new(X::Cannot::Lazy.new(:action<initialize>,:what(self.^name))),
@@ -86,7 +86,7 @@ my class Set does Setty {
multi method Mixy (Set:D:) { self.Mix }

#--- interface methods
method STORE(*@pairs, :$initialize --> Set:D) {
method STORE(Set:D: *@pairs, :$initialize --> Set:D) {
nqp::if(
(my $iterator := @pairs.iterator).is-lazy,
Failure.new(X::Cannot::Lazy.new(:action<initialize>,:what(self.^name))),
@@ -183,7 +183,7 @@ my class SetHash does Setty {
multi method Mixy (SetHash:D:) { self.MixHash }

#--- interface methods
method STORE(*@pairs --> SetHash:D) {
method STORE(SetHash:D: *@pairs --> SetHash:D) {
nqp::if(
(my \iterator := @pairs.iterator).is-lazy,
Failure.new(X::Cannot::Lazy.new(:action<initialize>,:what(self.^name))),

0 comments on commit 9daac68

Please sign in to comment.
You can’t perform that action at this time.