From 71960b162d244cc077654f5abb3fd3aecc4e9c8c Mon Sep 17 00:00:00 2001 From: Elizabeth Mattijsen Date: Thu, 1 Apr 2021 19:36:24 +0200 Subject: [PATCH] Set more sensible defaults to helper methods Further reduces bytecode footprint at the callsites --- src/core.c/Any-iterable-methods.pm6 | 8 ++--- src/core.c/Array.pm6 | 2 +- src/core.c/Bag.pm6 | 2 +- src/core.c/BagHash.pm6 | 2 +- src/core.c/Baggy.pm6 | 4 +-- src/core.c/Buf.pm6 | 10 +++--- src/core.c/Hash.pm6 | 4 +-- src/core.c/Iterable.pm6 | 10 +++--- src/core.c/Mix.pm6 | 2 +- src/core.c/MixHash.pm6 | 2 +- src/core.c/Mixy.pm6 | 2 +- src/core.c/Rakudo/Iterator.pm6 | 4 +-- src/core.c/Set.pm6 | 2 +- src/core.c/SetHash.pm6 | 2 +- src/core.c/Setty.pm6 | 4 +-- src/core.c/native_array.pm6 | 42 ++++++++++++------------- src/core.c/set_difference.pm6 | 4 +-- src/core.c/set_elem.pm6 | 2 +- src/core.c/set_symmetric_difference.pm6 | 2 +- tools/build/makeNATIVE_ARRAY.raku | 12 +++---- 20 files changed, 61 insertions(+), 61 deletions(-) diff --git a/src/core.c/Any-iterable-methods.pm6 b/src/core.c/Any-iterable-methods.pm6 index c286cb8abca..45803b003c0 100644 --- a/src/core.c/Any-iterable-methods.pm6 +++ b/src/core.c/Any-iterable-methods.pm6 @@ -17,7 +17,7 @@ augment class Any { # to help reduce bytecode size in hot code paths, making it more likely # that the (conditional) caller of this method, can be inlined. method throw-iterator-cannot-be-lazy( - str $action, str $what = "" + str $action, str $what = self.^name ) is hidden-from-backtrace is implementation-detail { X::Cannot::Lazy.new(:$action, :$what).throw } @@ -26,7 +26,7 @@ augment class Any { # to help reduce bytecode size in hot code paths, making it more likely # that the (conditional) caller of this method, can be inlined. method fail-iterator-cannot-be-lazy( - str $action, str $what = "" + str $action, str $what = self.^name ) is hidden-from-backtrace is implementation-detail { Failure.new(X::Cannot::Lazy.new(:$action, :$what)) } @@ -35,7 +35,7 @@ augment class Any { # empty, to help reduce bytecode size in hot code paths, making it more # likely that the (conditional) caller of this method, can be inlined. method throw-cannot-be-empty( - str $action, str $what = "" + str $action, str $what = self.^name ) is hidden-from-backtrace is implementation-detail { X::Cannot::Empty.new(:$action, :$what).throw } @@ -44,7 +44,7 @@ augment class Any { # to help reduce bytecode size in hot code paths, making it more likely # that the (conditional) caller of this method, can be inlined. method fail-cannot-be-empty( - str $action, str $what = "" + str $action, str $what = self.^name ) is hidden-from-backtrace is implementation-detail { Failure.new(X::Cannot::Empty.new(:$action, :$what)) } diff --git a/src/core.c/Array.pm6 b/src/core.c/Array.pm6 index cc00c181060..519ea501ff2 100644 --- a/src/core.c/Array.pm6 +++ b/src/core.c/Array.pm6 @@ -710,7 +710,7 @@ my class Array { # declared in BOOTSTRAP IterationEnd ), self, - self.throw-iterator-cannot-be-lazy('push', self.^name) + self.throw-iterator-cannot-be-lazy('push') ) } diff --git a/src/core.c/Bag.pm6 b/src/core.c/Bag.pm6 index 8d22498128a..54cfa0f3f58 100644 --- a/src/core.c/Bag.pm6 +++ b/src/core.c/Bag.pm6 @@ -38,7 +38,7 @@ my class Bag does Baggy { #--- interface methods multi method STORE(Bag:D: Iterable:D \iterable, :INITIALIZE($)! --> Bag:D) { (my \iterator := iterable.iterator).is-lazy - ?? self.fail-iterator-cannot-be-lazy('initialize', self.^name) + ?? self.fail-iterator-cannot-be-lazy('initialize') !! self.SET-SELF(Rakudo::QuantHash.ADD-PAIRS-TO-BAG( nqp::create(Rakudo::Internals::IterationSet),iterator,self.keyof )) diff --git a/src/core.c/BagHash.pm6 b/src/core.c/BagHash.pm6 index 60e1ab81670..eea331cfb83 100644 --- a/src/core.c/BagHash.pm6 +++ b/src/core.c/BagHash.pm6 @@ -7,7 +7,7 @@ my class BagHash does Baggy { #--- interface methods multi method STORE(BagHash:D: Iterable:D \iterable --> BagHash:D) { (my \iterator := iterable.iterator).is-lazy - ?? self.fail-iterator-cannot-be-lazy('initialize', self.^name) + ?? self.fail-iterator-cannot-be-lazy('initialize') !! self.SET-SELF( Rakudo::QuantHash.ADD-PAIRS-TO-BAG( nqp::create(Rakudo::Internals::IterationSet), diff --git a/src/core.c/Baggy.pm6 b/src/core.c/Baggy.pm6 index 763af630c58..0fa0b2808de 100644 --- a/src/core.c/Baggy.pm6 +++ b/src/core.c/Baggy.pm6 @@ -59,7 +59,7 @@ my role Baggy does QuantHash { # helper method to create Bag from iterator, check for laziness method !create-from-iterator(\type, \iterator --> Baggy:D) { iterator.is-lazy - ?? self.fail-iterator-cannot-be-lazy('coerce', type.^name) + ?? type.fail-iterator-cannot-be-lazy('coerce') !! nqp::create(type).SET-SELF( Rakudo::QuantHash.ADD-ITERATOR-TO-BAG( nqp::create(Rakudo::Internals::IterationSet), @@ -90,7 +90,7 @@ my role Baggy does QuantHash { method new-from-pairs(Baggy:_: *@pairs --> Baggy:D) { (my \iterator := @pairs.iterator).is-lazy - ?? self.fail-iterator-cannot-be-lazy('coerce', self.^name) + ?? self.fail-iterator-cannot-be-lazy('coerce') !! nqp::create(self).SET-SELF( Rakudo::QuantHash.ADD-PAIRS-TO-BAG( nqp::create(Rakudo::Internals::IterationSet), diff --git a/src/core.c/Buf.pm6 b/src/core.c/Buf.pm6 index 3f0180bd99c..f9278c94abf 100644 --- a/src/core.c/Buf.pm6 +++ b/src/core.c/Buf.pm6 @@ -57,7 +57,7 @@ my role Blob[::T = uint8] does Positional[T] does Stringy is repr('VMArray') is multi method STORE(Blob:D: Iterable:D \iterable, :$INITIALIZE) { $INITIALIZE ?? iterable.is-lazy - ?? self.throw-iterator-cannot-be-lazy('store', self.^name) + ?? self.throw-iterator-cannot-be-lazy('store') !! self!push-list("initializ",self,iterable) !! X::Assignment::RO.new(:value(self)).throw } @@ -734,7 +734,7 @@ my role Buf[::T = uint8] does Blob[T] is repr('VMArray') is array_type(T) { } multi method STORE(Buf:D: Iterable:D \iterable) { iterable.is-lazy - ?? self.throw-iterator-cannot-be-lazy('store', self.^name) + ?? self.throw-iterator-cannot-be-lazy('store') !! self!push-list("initializ",nqp::setelems(self,0),iterable); } multi method STORE(Buf:D: Any:D \non-iterable) { @@ -953,13 +953,13 @@ my role Buf[::T = uint8] does Blob[T] is repr('VMArray') is array_type(T) { multi method pop(Buf:D:) { nqp::elems(self) ?? nqp::pop_i(self) - !! self.fail-cannot-be-empty('pop', self.^name) + !! self.fail-cannot-be-empty('pop') } proto method shift(|) { * } multi method shift(Buf:D:) { nqp::elems(self) ?? nqp::shift_i(self) - !! self.fail-cannot-be-empty('shift', self.^name) + !! self.fail-cannot-be-empty('shift') } method reallocate(Buf:D: Int:D $elements) { nqp::setelems(self,$elements) } @@ -1053,7 +1053,7 @@ my role Buf[::T = uint8] does Blob[T] is repr('VMArray') is array_type(T) { method !pend(Buf:D: @values, $action) { @values.is-lazy - ?? self.fail-iterator-cannot-be-lazy($action, self.^name) + ?? self.fail-iterator-cannot-be-lazy($action) !! $action eq 'push' || $action eq 'append' ?? self!push-list($action,self,@values) !! self!unshift-list($action,self,@values) diff --git a/src/core.c/Hash.pm6 b/src/core.c/Hash.pm6 index 278dcfc1945..e83695b4937 100644 --- a/src/core.c/Hash.pm6 +++ b/src/core.c/Hash.pm6 @@ -218,7 +218,7 @@ my class Hash { # declared in BOOTSTRAP method dynamic(Hash:D:) { nqp::hllbool($!descriptor.dynamic) } method push(+values) { - return self.fail-iterator-cannot-be-lazy('.push', self.^name) + return self.fail-iterator-cannot-be-lazy('.push') if values.is-lazy; my $previous; @@ -245,7 +245,7 @@ my class Hash { # declared in BOOTSTRAP } method append(+values) { - return self.fail-iterator-cannot-be-lazy('.append', self.^name) + return self.fail-iterator-cannot-be-lazy('.append') if values.is-lazy; my $previous; diff --git a/src/core.c/Iterable.pm6 b/src/core.c/Iterable.pm6 index 9c24b3f5783..cbf12569e88 100644 --- a/src/core.c/Iterable.pm6 +++ b/src/core.c/Iterable.pm6 @@ -62,7 +62,7 @@ my role Iterable { method !MIXIFY(\type) { (my \iterator := self.flat.iterator).is-lazy - ?? self.fail-iterator-cannot-be-lazy('coerce', type.^name) + ?? type.fail-iterator-cannot-be-lazy('coerce') !! nqp::elems(my \elems := Rakudo::QuantHash.ADD-PAIRS-TO-MIX( nqp::create(Rakudo::Internals::IterationSet),iterator,Mu )) @@ -76,7 +76,7 @@ my role Iterable { method !BAGGIFY(\type) { (my \iterator := self.flat.iterator).is-lazy - ?? self.fail-iterator-cannot-be-lazy('coerce', type.^name) + ?? type.fail-iterator-cannot-be-lazy('coerce') !! nqp::elems(my \elems := Rakudo::QuantHash.ADD-PAIRS-TO-BAG( nqp::create(Rakudo::Internals::IterationSet),iterator,Mu )) @@ -90,7 +90,7 @@ my role Iterable { method !SETIFY(\type) { (my \iterator := self.flat.iterator).is-lazy - ?? self.fail-iterator-cannot-be-lazy('coerce', type.^name) + ?? type.fail-iterator-cannot-be-lazy('coerce') !! nqp::elems(my $elems := Rakudo::QuantHash.ADD-PAIRS-TO-SET( nqp::create(Rakudo::Internals::IterationSet),iterator,Mu )) @@ -115,7 +115,7 @@ multi sub infix:(Iterable:D \a, Iterable:D \b) { a.is-lazy, nqp::if( # a lazy b.is-lazy, - Any.throw-iterator-cannot-be-lazy('eqv') # a && b lazy + Any.throw-iterator-cannot-be-lazy('eqv','') # a && b lazy ), nqp::if( # a NOT lazy b.is-lazy, @@ -141,7 +141,7 @@ multi sub infix:(Iterable:D \a, Iterable:D \b) { ), nqp::if( ia.is-lazy, - Any.throw-iterator-cannot-be-lazy('eqv'), + Any.throw-iterator-cannot-be-lazy('eqv',''), nqp::stmts( nqp::until( nqp::stmts( diff --git a/src/core.c/Mix.pm6 b/src/core.c/Mix.pm6 index 34f3cd595e6..3dd9febed19 100644 --- a/src/core.c/Mix.pm6 +++ b/src/core.c/Mix.pm6 @@ -10,7 +10,7 @@ my class Mix does Mixy { #--- interface methods multi method STORE(Mix:D: Iterable:D \iterable, :INITIALIZE($)! --> Mix:D) { (my \iterator := iterable.iterator).is-lazy - ?? self.fail-iterator-cannot-be-lazy('.initialize', self.^name) + ?? self.fail-iterator-cannot-be-lazy('.initialize') !! self.SET-SELF(Rakudo::QuantHash.ADD-PAIRS-TO-MIX( nqp::create(Rakudo::Internals::IterationSet),iterator,self.keyof )) diff --git a/src/core.c/MixHash.pm6 b/src/core.c/MixHash.pm6 index 5a8da41e917..a76f4bf8c94 100644 --- a/src/core.c/MixHash.pm6 +++ b/src/core.c/MixHash.pm6 @@ -10,7 +10,7 @@ my class MixHash does Mixy { multi method STORE(MixHash:D: Iterable:D \iterable --> MixHash:D) { (my \iterator := iterable.iterator).is-lazy - ?? self.fail-iterator-cannot-be-lazy('initialize', self.^name) + ?? self.fail-iterator-cannot-be-lazy('initialize') !! self.SET-SELF( Rakudo::QuantHash.ADD-PAIRS-TO-MIX( nqp::create(Rakudo::Internals::IterationSet), diff --git a/src/core.c/Mixy.pm6 b/src/core.c/Mixy.pm6 index 54f09b39324..2beff0bde0d 100644 --- a/src/core.c/Mixy.pm6 +++ b/src/core.c/Mixy.pm6 @@ -69,7 +69,7 @@ my role Mixy does Baggy { #--- object creation methods method new-from-pairs(Mixy:_: *@pairs --> Mixy:D) { (my \iterator := @pairs.iterator).is-lazy - ?? self.fail-iterator-cannot-be-lazy('coerce', self.^name) + ?? self.fail-iterator-cannot-be-lazy('coerce') !! nqp::create(self).SET-SELF( Rakudo::QuantHash.ADD-PAIRS-TO-MIX( nqp::create(Rakudo::Internals::IterationSet), diff --git a/src/core.c/Rakudo/Iterator.pm6 b/src/core.c/Rakudo/Iterator.pm6 index 0440a0019e1..bbacce8fcbd 100644 --- a/src/core.c/Rakudo/Iterator.pm6 +++ b/src/core.c/Rakudo/Iterator.pm6 @@ -2255,7 +2255,7 @@ class Rakudo::Iterator { method new(\iterator,\n,\action,\f) { nqp::if( iterator.is-lazy, - Any.throw-iterator-cannot-be-lazy(action), + Any.throw-iterator-cannot-be-lazy(action,''), nqp::if( nqp::istype(n,Whatever), iterator, # * just give back itself @@ -2324,7 +2324,7 @@ class Rakudo::Iterator { method LastValue(\iterator, $action) is raw { nqp::if( iterator.is-lazy, - Any.throw-iterator-cannot-be-lazy($action), + Any.throw-iterator-cannot-be-lazy($action,''), nqp::stmts( (my $result := IterationEnd), nqp::if( diff --git a/src/core.c/Set.pm6 b/src/core.c/Set.pm6 index 2a09b0667f8..06873630650 100644 --- a/src/core.c/Set.pm6 +++ b/src/core.c/Set.pm6 @@ -94,7 +94,7 @@ my class Set does Setty { #--- interface methods multi method STORE(Set:D: Iterable:D \iterable, :INITIALIZE($)! --> Set:D) { (my \iterator := iterable.iterator).is-lazy - ?? self.fail-iterator-cannot-be-lazy('initialize', self.^name) + ?? self.fail-iterator-cannot-be-lazy('initialize') !! self.SET-SELF(Rakudo::QuantHash.ADD-PAIRS-TO-SET( nqp::create(Rakudo::Internals::IterationSet), iterator, diff --git a/src/core.c/SetHash.pm6 b/src/core.c/SetHash.pm6 index 54c64e57a12..dc646b26ea9 100644 --- a/src/core.c/SetHash.pm6 +++ b/src/core.c/SetHash.pm6 @@ -194,7 +194,7 @@ my class SetHash does Setty { #--- interface methods multi method STORE(SetHash:D: Iterable:D \iterable --> SetHash:D) { (my \iterator := iterable.iterator).is-lazy - ?? self.fail-iterator-cannot-be-lazy('initialize', self.^name) + ?? self.fail-iterator-cannot-be-lazy('initialize') !! self.SET-SELF( Rakudo::QuantHash.ADD-PAIRS-TO-SET( nqp::create(Rakudo::Internals::IterationSet), diff --git a/src/core.c/Setty.pm6 b/src/core.c/Setty.pm6 index ce1deba157e..85bc7dda609 100644 --- a/src/core.c/Setty.pm6 +++ b/src/core.c/Setty.pm6 @@ -6,7 +6,7 @@ my role Setty does QuantHash { # private method to create Set from iterator, check for laziness method !create-from-iterator(\type, \iterator --> Setty:D) { iterator.is-lazy - ?? self.fail-iterator-cannot-be-lazy('coerce', type.^name) + ?? type.fail-iterator-cannot-be-lazy('coerce') !! nqp::create(type).SET-SELF( Rakudo::QuantHash.ADD-ITERATOR-TO-SET( nqp::create(Rakudo::Internals::IterationSet), @@ -37,7 +37,7 @@ my role Setty does QuantHash { method new-from-pairs(*@pairs --> Setty:D) { (my \iterator := @pairs.iterator).is-lazy - ?? self.fail-iterator-cannot-be-lazy('coerce', self.^name) + ?? self.fail-iterator-cannot-be-lazy('coerce') !! nqp::create(self).SET-SELF( Rakudo::QuantHash.ADD-PAIRS-TO-SET( nqp::create(Rakudo::Internals::IterationSet), diff --git a/src/core.c/native_array.pm6 b/src/core.c/native_array.pm6 index 9a29c731da2..b2a07d42b9a 100644 --- a/src/core.c/native_array.pm6 +++ b/src/core.c/native_array.pm6 @@ -94,7 +94,7 @@ my class array does Iterable does Positional { role strarray[::T] does Positional[T] is array_type(T) { #- start of generated part of strarray role ----------------------------------- -#- Generated on 2021-04-01T18:57:04+02:00 by ./tools/build/makeNATIVE_ARRAY.raku +#- Generated on 2021-04-01T19:23:33+02:00 by ./tools/build/makeNATIVE_ARRAY.raku #- PLEASE DON'T CHANGE ANYTHING BELOW THIS LINE multi method grep(strarray:D: Str:D $needle, :$k, :$kv, :$p, :$v --> Seq:D) { @@ -275,7 +275,7 @@ my class array does Iterable does Positional { multi method STORE(strarray:D: Seq:D \seq --> strarray:D) { nqp::if( (my $iterator := seq.iterator).is-lazy, - self.throw-iterator-cannot-be-lazy('store', self.^name), + self.throw-iterator-cannot-be-lazy('store'), nqp::stmts( nqp::setelems(self,0), $iterator.push-all(self), @@ -341,7 +341,7 @@ my class array does Iterable does Positional { nqp::splice(self,$values,nqp::elems(self),0) } multi method append(strarray:D: @values --> strarray:D) { - return self.fail-iterator-cannot-be-lazy('.append', self.^name) + return self.fail-iterator-cannot-be-lazy('.append') if @values.is-lazy; nqp::push_s(self, $_) for flat @values; self @@ -350,13 +350,13 @@ my class array does Iterable does Positional { method pop(strarray:D: --> str) { nqp::elems(self) ?? nqp::pop_s(self) - !! self.throw-cannot-be-empty('pop', self.^name) + !! self.throw-cannot-be-empty('pop') } method shift(strarray:D: --> str) { nqp::elems(self) ?? nqp::shift_s(self) - !! self.throw-cannot-be-empty('shift', self.^name) + !! self.throw-cannot-be-empty('shift') } multi method unshift(strarray:D: str $value --> strarray:D) { @@ -368,7 +368,7 @@ my class array does Iterable does Positional { self } multi method unshift(strarray:D: @values --> strarray:D) { - return self.fail-iterator-cannot-be-lazy('.unshift', self.^name) + return self.fail-iterator-cannot-be-lazy('.unshift') if @values.is-lazy; nqp::unshift_s(self, @values.pop) while @values; self @@ -441,7 +441,7 @@ my class array does Iterable does Positional { multi method splice(strarray:D: Int:D $offset, Int:D $size, Seq:D \seq --> strarray:D) { nqp::if( seq.is-lazy, - self.throw-iterator-cannot-be-lazy('.splice', self.^name), + self.throw-iterator-cannot-be-lazy('.splice'), nqp::stmts( nqp::unless( nqp::istype( @@ -687,7 +687,7 @@ my class array does Iterable does Positional { role intarray[::T] does Positional[T] is array_type(T) { #- start of generated part of intarray role ----------------------------------- -#- Generated on 2021-04-01T18:57:04+02:00 by ./tools/build/makeNATIVE_ARRAY.raku +#- Generated on 2021-04-01T19:23:33+02:00 by ./tools/build/makeNATIVE_ARRAY.raku #- PLEASE DON'T CHANGE ANYTHING BELOW THIS LINE multi method grep(intarray:D: Int:D $needle, :$k, :$kv, :$p, :$v --> Seq:D) { @@ -868,7 +868,7 @@ my class array does Iterable does Positional { multi method STORE(intarray:D: Seq:D \seq --> intarray:D) { nqp::if( (my $iterator := seq.iterator).is-lazy, - self.throw-iterator-cannot-be-lazy('store', self.^name), + self.throw-iterator-cannot-be-lazy('store'), nqp::stmts( nqp::setelems(self,0), $iterator.push-all(self), @@ -934,7 +934,7 @@ my class array does Iterable does Positional { nqp::splice(self,$values,nqp::elems(self),0) } multi method append(intarray:D: @values --> intarray:D) { - return self.fail-iterator-cannot-be-lazy('.append', self.^name) + return self.fail-iterator-cannot-be-lazy('.append') if @values.is-lazy; nqp::push_i(self, $_) for flat @values; self @@ -943,13 +943,13 @@ my class array does Iterable does Positional { method pop(intarray:D: --> int) { nqp::elems(self) ?? nqp::pop_i(self) - !! self.throw-cannot-be-empty('pop', self.^name) + !! self.throw-cannot-be-empty('pop') } method shift(intarray:D: --> int) { nqp::elems(self) ?? nqp::shift_i(self) - !! self.throw-cannot-be-empty('shift', self.^name) + !! self.throw-cannot-be-empty('shift') } multi method unshift(intarray:D: int $value --> intarray:D) { @@ -961,7 +961,7 @@ my class array does Iterable does Positional { self } multi method unshift(intarray:D: @values --> intarray:D) { - return self.fail-iterator-cannot-be-lazy('.unshift', self.^name) + return self.fail-iterator-cannot-be-lazy('.unshift') if @values.is-lazy; nqp::unshift_i(self, @values.pop) while @values; self @@ -1034,7 +1034,7 @@ my class array does Iterable does Positional { multi method splice(intarray:D: Int:D $offset, Int:D $size, Seq:D \seq --> intarray:D) { nqp::if( seq.is-lazy, - self.throw-iterator-cannot-be-lazy('.splice', self.^name), + self.throw-iterator-cannot-be-lazy('.splice'), nqp::stmts( nqp::unless( nqp::istype( @@ -1332,7 +1332,7 @@ my class array does Iterable does Positional { role numarray[::T] does Positional[T] is array_type(T) { #- start of generated part of numarray role ----------------------------------- -#- Generated on 2021-04-01T18:57:04+02:00 by ./tools/build/makeNATIVE_ARRAY.raku +#- Generated on 2021-04-01T19:23:33+02:00 by ./tools/build/makeNATIVE_ARRAY.raku #- PLEASE DON'T CHANGE ANYTHING BELOW THIS LINE multi method grep(numarray:D: Num:D $needle, :$k, :$kv, :$p, :$v --> Seq:D) { @@ -1513,7 +1513,7 @@ my class array does Iterable does Positional { multi method STORE(numarray:D: Seq:D \seq --> numarray:D) { nqp::if( (my $iterator := seq.iterator).is-lazy, - self.throw-iterator-cannot-be-lazy('store', self.^name), + self.throw-iterator-cannot-be-lazy('store'), nqp::stmts( nqp::setelems(self,0), $iterator.push-all(self), @@ -1579,7 +1579,7 @@ my class array does Iterable does Positional { nqp::splice(self,$values,nqp::elems(self),0) } multi method append(numarray:D: @values --> numarray:D) { - return self.fail-iterator-cannot-be-lazy('.append', self.^name) + return self.fail-iterator-cannot-be-lazy('.append') if @values.is-lazy; nqp::push_n(self, $_) for flat @values; self @@ -1588,13 +1588,13 @@ my class array does Iterable does Positional { method pop(numarray:D: --> num) { nqp::elems(self) ?? nqp::pop_n(self) - !! self.throw-cannot-be-empty('pop', self.^name) + !! self.throw-cannot-be-empty('pop') } method shift(numarray:D: --> num) { nqp::elems(self) ?? nqp::shift_n(self) - !! self.throw-cannot-be-empty('shift', self.^name) + !! self.throw-cannot-be-empty('shift') } multi method unshift(numarray:D: num $value --> numarray:D) { @@ -1606,7 +1606,7 @@ my class array does Iterable does Positional { self } multi method unshift(numarray:D: @values --> numarray:D) { - return self.fail-iterator-cannot-be-lazy('.unshift', self.^name) + return self.fail-iterator-cannot-be-lazy('.unshift') if @values.is-lazy; nqp::unshift_n(self, @values.pop) while @values; self @@ -1679,7 +1679,7 @@ my class array does Iterable does Positional { multi method splice(numarray:D: Int:D $offset, Int:D $size, Seq:D \seq --> numarray:D) { nqp::if( seq.is-lazy, - self.throw-iterator-cannot-be-lazy('.splice', self.^name), + self.throw-iterator-cannot-be-lazy('.splice'), nqp::stmts( nqp::unless( nqp::istype( diff --git a/src/core.c/set_difference.pm6 b/src/core.c/set_difference.pm6 index b6eff2709ea..a7bc7e16009 100644 --- a/src/core.c/set_difference.pm6 +++ b/src/core.c/set_difference.pm6 @@ -33,7 +33,7 @@ multi sub infix:<(-)>(Setty:D \a, Map:D \b) { multi sub infix:<(-)>(Setty:D \a, Iterable:D \b) { nqp::if( (my $iterator := b.iterator).is-lazy, - Any.fail-iterator-cannot-be-lazy('set difference', 'set'), + Set.fail-iterator-cannot-be-lazy('set difference'), nqp::if( (my $raw := a.RAW-HASH) && nqp::elems($raw), nqp::create(a.Setty).SET-SELF( # elems in b @@ -117,7 +117,7 @@ multi sub infix:<(-)>(+@p) { # also Any nqp::if( (my $params := @p.iterator).is-lazy, - Any.fail-iterator-cannot-be-lazy('set difference'), # bye bye + Set.fail-iterator-cannot-be-lazy('set difference'), # bye bye nqp::stmts( # fixed list of things to diff (my $type := nqp::if( diff --git a/src/core.c/set_elem.pm6 b/src/core.c/set_elem.pm6 index 5bc094a330e..a6974d8a683 100644 --- a/src/core.c/set_elem.pm6 +++ b/src/core.c/set_elem.pm6 @@ -54,7 +54,7 @@ multi sub infix:<(elem)>(Any \a, Iterable:D \b --> Bool:D) { multi sub infix:<(elem)>(Any \a, Iterator:D \b --> Bool:D) { nqp::if( b.is-lazy, - Any.fail-iterator-cannot-be-lazy('(elem)'), + Any.fail-iterator-cannot-be-lazy('(elem)',''), nqp::stmts( (my str $needle = a.WHICH), nqp::until( diff --git a/src/core.c/set_symmetric_difference.pm6 b/src/core.c/set_symmetric_difference.pm6 index f0f89e3e905..29741b2da14 100644 --- a/src/core.c/set_symmetric_difference.pm6 +++ b/src/core.c/set_symmetric_difference.pm6 @@ -270,7 +270,7 @@ multi sub infix:<(^)>(+@p) { # also Any nqp::if( (my $params := @p.iterator).is-lazy, - Any.fail-iterator-cannot-be-lazy('symmetric diff'), # bye bye + Any.fail-iterator-cannot-be-lazy('symmetric diff',''), # bye bye nqp::stmts( # fixed list of things to diff (my \elems := nqp::create(Rakudo::Internals::IterationSet)), diff --git a/tools/build/makeNATIVE_ARRAY.raku b/tools/build/makeNATIVE_ARRAY.raku index 375b399384c..2dbe56e7579 100755 --- a/tools/build/makeNATIVE_ARRAY.raku +++ b/tools/build/makeNATIVE_ARRAY.raku @@ -235,7 +235,7 @@ while @lines { multi method STORE(#type#array:D: Seq:D \seq --> #type#array:D) { nqp::if( (my $iterator := seq.iterator).is-lazy, - self.throw-iterator-cannot-be-lazy('store', self.^name), + self.throw-iterator-cannot-be-lazy('store'), nqp::stmts( nqp::setelems(self,0), $iterator.push-all(self), @@ -301,7 +301,7 @@ while @lines { nqp::splice(self,$values,nqp::elems(self),0) } multi method append(#type#array:D: @values --> #type#array:D) { - return self.fail-iterator-cannot-be-lazy('.append', self.^name) + return self.fail-iterator-cannot-be-lazy('.append') if @values.is-lazy; nqp::push_#postfix#(self, $_) for flat @values; self @@ -310,13 +310,13 @@ while @lines { method pop(#type#array:D: --> #type#) { nqp::elems(self) ?? nqp::pop_#postfix#(self) - !! self.throw-cannot-be-empty('pop', self.^name) + !! self.throw-cannot-be-empty('pop') } method shift(#type#array:D: --> #type#) { nqp::elems(self) ?? nqp::shift_#postfix#(self) - !! self.throw-cannot-be-empty('shift', self.^name) + !! self.throw-cannot-be-empty('shift') } multi method unshift(#type#array:D: #type# $value --> #type#array:D) { @@ -328,7 +328,7 @@ while @lines { self } multi method unshift(#type#array:D: @values --> #type#array:D) { - return self.fail-iterator-cannot-be-lazy('.unshift', self.^name) + return self.fail-iterator-cannot-be-lazy('.unshift') if @values.is-lazy; nqp::unshift_#postfix#(self, @values.pop) while @values; self @@ -401,7 +401,7 @@ while @lines { multi method splice(#type#array:D: Int:D $offset, Int:D $size, Seq:D \seq --> #type#array:D) { nqp::if( seq.is-lazy, - self.throw-iterator-cannot-be-lazy('.splice', self.^name), + self.throw-iterator-cannot-be-lazy('.splice'), nqp::stmts( nqp::unless( nqp::istype(