Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
No word parcels for descriptive texts, skids++
  • Loading branch information
lizmat committed Jul 10, 2015
1 parent 5f7ce71 commit 97ebe47
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 26 deletions.
6 changes: 3 additions & 3 deletions src/core/Array.pm
Expand Up @@ -271,7 +271,7 @@ class Array { # declared in BOOTSTRAP

multi method push(Array:D: \value) {
if nqp::iscont(value) || nqp::not_i(nqp::istype(value, Iterable)) && nqp::not_i(nqp::istype(value, Parcel)) {
fail X::Cannot::Infinite.new(:action<.push to>)
fail X::Cannot::Infinite.new(:action('.push to'))
if self.infinite;
self.gimme(*);
nqp::p6listitems(self);
Expand All @@ -291,7 +291,7 @@ class Array { # declared in BOOTSTRAP
if @values.infinite;
nqp::p6listitems(self);
my $elems = self.gimme(*);
fail X::Cannot::Infinite.new(:action<.push to>)
fail X::Cannot::Infinite.new(:action('.push to'))
if self.infinite;

# push is always eager
Expand Down Expand Up @@ -328,7 +328,7 @@ class Array { # declared in BOOTSTRAP
if @values.infinite;
nqp::p6listitems(self);
my $elems = self.gimme(*);
fail X::Cannot::Infinite.new(:action<.push to>)
fail X::Cannot::Infinite.new(:action('.push to'))
if self.infinite;

# push is always eager
Expand Down
2 changes: 1 addition & 1 deletion src/core/Cool.pm
Expand Up @@ -280,7 +280,7 @@ my class Cool { # declared in BOOTSTRAP
multi method UInt() {
my $got := self.Int;
fail X::OutOfRange.new(
:what<Coercion to UInt>,
:what('Coercion to UInt'),
:$got,
:range("0..Inf")
) if $got < 0;
Expand Down
28 changes: 14 additions & 14 deletions src/core/List.pm
Expand Up @@ -178,14 +178,14 @@ my class List does Positional { # declared in BOOTSTRAP

proto method pick(|) is nodal { * }
multi method pick() {
fail X::Cannot::Infinite.new(:action<.pick from>) if self.infinite;
fail X::Cannot::Infinite.new(:action('.pick from')) if self.infinite;
my $elems = self.elems;
$elems ?? nqp::atpos($!items,$elems.rand.floor) !! Nil;
}
multi method pick(Whatever, :$eager!) {
return self.pick(*) if !$eager;

fail X::Cannot::Infinite.new(:action<.pick from>) if self.infinite;
fail X::Cannot::Infinite.new(:action('.pick from')) if self.infinite;

my Int $elems = self.elems;
return () unless $elems;
Expand All @@ -204,7 +204,7 @@ my class List does Positional { # declared in BOOTSTRAP
nqp::p6parcel($picked,Any);
}
multi method pick(Whatever) {
fail X::Cannot::Infinite.new(:action<.pick from>) if self.infinite;
fail X::Cannot::Infinite.new(:action('.pick from')) if self.infinite;

my Int $elems = self.elems;
return () unless $elems;
Expand All @@ -220,7 +220,7 @@ my class List does Positional { # declared in BOOTSTRAP
}
}
multi method pick(\number) {
fail X::Cannot::Infinite.new(:action<.pick from>) if self.infinite;
fail X::Cannot::Infinite.new(:action('.pick from')) if self.infinite;
## We use a version of Fisher-Yates shuffle here to
## replace picked elements with elements from the end
## of the list, resulting in an O(n) algorithm.
Expand All @@ -244,7 +244,7 @@ my class List does Positional { # declared in BOOTSTRAP

method pop() is parcel is nodal {
my $elems = self.gimme(*);
fail X::Cannot::Infinite.new(:action<.pop from>) if $!nextiter.defined;
fail X::Cannot::Infinite.new(:action('.pop from')) if $!nextiter.defined;
$elems > 0
?? nqp::pop($!items)
!! fail X::Cannot::Empty.new(:action<.pop>, :what(self.^name));
Expand All @@ -260,7 +260,7 @@ my class List does Positional { # declared in BOOTSTRAP
multi method push(List:D: \value) {
if nqp::iscont(value) || nqp::not_i(nqp::istype(value, Iterable)) && nqp::not_i(nqp::istype(value, Parcel)) {
$!nextiter.DEFINITE && self.gimme(*);
fail X::Cannot::Infinite.new(:action<.push to>)
fail X::Cannot::Infinite.new(:action('.push to'))
if $!nextiter.DEFINITE;
nqp::p6listitems(self);
nqp::push( $!items, my $ = value);
Expand All @@ -276,7 +276,7 @@ my class List does Positional { # declared in BOOTSTRAP
if @values.infinite;
nqp::p6listitems(self);
my $elems = self.gimme(*);
fail X::Cannot::Infinite.new(:action<.push to>) if $!nextiter.DEFINITE;
fail X::Cannot::Infinite.new(:action('.push to')) if $!nextiter.DEFINITE;

# push is always eager
@values.gimme(*);
Expand Down Expand Up @@ -310,7 +310,7 @@ my class List does Positional { # declared in BOOTSTRAP
method plan(List:D: |args) is nodal {
nqp::p6listitems(self);
my $elems = self.gimme(*);
fail X::Cannot::Infinite.new(:action<.plan to>) if $!nextiter.defined;
fail X::Cannot::Infinite.new(:action('.plan to')) if $!nextiter.defined;

# # need type checks?
# my $of := self.of;
Expand All @@ -329,12 +329,12 @@ my class List does Positional { # declared in BOOTSTRAP

proto method roll(|) is nodal { * }
multi method roll() {
fail X::Cannot::Infinite.new(:action<.roll from>) if self.infinite;
fail X::Cannot::Infinite.new(:action('.roll from')) if self.infinite;
my $elems = self.elems;
$elems ?? nqp::atpos($!items,$elems.rand.floor) !! Nil;
}
multi method roll(Whatever) {
fail X::Cannot::Infinite.new(:action<.roll from>) if self.infinite;
fail X::Cannot::Infinite.new(:action('.roll from')) if self.infinite;
my $elems = self.elems;
return () unless $elems;

Expand All @@ -347,7 +347,7 @@ my class List does Positional { # declared in BOOTSTRAP
multi method roll(\number) {
return self.roll(*) if number == Inf;

fail X::Cannot::Infinite.new(:action<.roll from>) if self.infinite;
fail X::Cannot::Infinite.new(:action('.roll from')) if self.infinite;
my $elems = self.elems;
return () unless $elems;

Expand Down Expand Up @@ -399,7 +399,7 @@ my class List does Positional { # declared in BOOTSTRAP
@ret;
}
multi method splice(List:D: $offset=0, $size=Whatever, *@values, :$SINK) {
fail X::Cannot::Infinite.new(:action<splice in>) if @values.infinite;
fail X::Cannot::Infinite.new(:action('splice in')) if @values.infinite;

self.gimme(*);
my $elems = self.elems;
Expand All @@ -409,7 +409,7 @@ my class List does Positional { # declared in BOOTSTRAP
?? $elems
!! $offset.Int;
X::OutOfRange.new(
:what<Offset argument to splice>,
:what('Offset argument to splice'),
:got($o),
:range("0..$elems"),
).fail if $o < 0 || $o > $elems; # one after list allowed for "push"
Expand All @@ -420,7 +420,7 @@ my class List does Positional { # declared in BOOTSTRAP
?? $elems - ($o min $elems)
!! $size.Int;
X::OutOfRange.new(
:what<Size argument to splice>,
:what('Size argument to splice'),
:got($s),
:range("0..^{$elems - $o}"),
).fail if $s < 0;
Expand Down
4 changes: 2 additions & 2 deletions src/core/Str.pm
Expand Up @@ -1741,7 +1741,7 @@ sub chrs(*@c) returns Str:D {

sub SUBSTR-START-OOR(\from,\max) {
X::OutOfRange.new(
:what<Start argument to substr>,
:what('Start argument to substr'),
:got(from.gist),
:range("0.." ~ max),
:comment( nqp::istype(from, Callable) || -from > max
Expand All @@ -1751,7 +1751,7 @@ sub SUBSTR-START-OOR(\from,\max) {
}
sub SUBSTR-CHARS-OOR(\chars) {
X::OutOfRange.new(
:what<Number of characters argument to substr>,
:what('Number of characters argument to substr'),
:got(chars.gist),
:range("0..Inf"),
:comment("use *{chars} if you want to index relative to the end"),
Expand Down
12 changes: 6 additions & 6 deletions src/core/native_array.pm
Expand Up @@ -105,7 +105,7 @@ class array is Iterable is repr('VMArray') {
}

multi method splice(array:D: $offset=0, $size=Whatever, *@values, :$SINK) {
fail X::Cannot::Infinite.new(:action<splice in>)
fail X::Cannot::Infinite.new(:action('splice in'))
if @values.infinite;

my $elems = self.elems;
Expand All @@ -115,7 +115,7 @@ class array is Iterable is repr('VMArray') {
?? $elems
!! $offset.Int;
X::OutOfRange.new(
:what<Offset argument to splice>,
:what('Offset argument to splice'),
:got($o),
:range("0..$elems"),
).fail if $o < 0 || $o > $elems; # one after list allowed for "push"
Expand All @@ -126,7 +126,7 @@ class array is Iterable is repr('VMArray') {
?? $elems - ($o min $elems)
!! $size.Int;
X::OutOfRange.new(
:what<Size argument to splice>,
:what('Size argument to splice'),
:got($s),
:range("0..^{$elems - $o}"),
).fail if $s < 0;
Expand Down Expand Up @@ -311,7 +311,7 @@ class array is Iterable is repr('VMArray') {
}

multi method splice(array:D: $offset=0, $size=Whatever, *@values, :$SINK) {
fail X::Cannot::Infinite.new(:action<splice in>)
fail X::Cannot::Infinite.new(:action('splice in'))
if @values.infinite;

my $elems = self.elems;
Expand All @@ -321,7 +321,7 @@ class array is Iterable is repr('VMArray') {
?? $elems
!! $offset.Int;
X::OutOfRange.new(
:what<Offset argument to splice>,
:what('Offset argument to splice'),
:got($o),
:range("0..$elems"),
).fail if $o < 0 || $o > $elems; # one after list allowed for "push"
Expand All @@ -332,7 +332,7 @@ class array is Iterable is repr('VMArray') {
?? $elems - ($o min $elems)
!! $size.Int;
X::OutOfRange.new(
:what<Size argument to splice>,
:what('Size argument to splice'),
:got($s),
:range("0..^{$elems - $o}"),
).fail if $s < 0;
Expand Down

0 comments on commit 97ebe47

Please sign in to comment.