Skip to content

Commit

Permalink
Throw when splicing lazy Seq into native array
Browse files Browse the repository at this point in the history
  • Loading branch information
jstuder-gh committed Aug 28, 2018
1 parent fc8c7f8 commit bb963a2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
12 changes: 3 additions & 9 deletions src/core/native_array.pm6
Expand Up @@ -293,9 +293,7 @@ my class array does Iterable {
multi method splice(strarray:D: Int:D $offset, Int:D $size, Seq:D \seq) {
nqp::if(
seq.is-lazy,
Failure.new(X::Cannot::Lazy.new(
:action<splice>, :what(self.^name)
)),
X::Cannot::Lazy.new(:action<splice>, :what(self.^name)).throw,
nqp::stmts(
nqp::unless(
nqp::istype(
Expand Down Expand Up @@ -778,9 +776,7 @@ my class array does Iterable {
multi method splice(intarray:D: Int:D $offset, Int:D $size, Seq:D \seq) {
nqp::if(
seq.is-lazy,
Failure.new(X::Cannot::Lazy.new(
:action<splice>, :what(self.^name)
)),
X::Cannot::Lazy.new(:action<splice>, :what(self.^name)).throw,
nqp::stmts(
nqp::unless(
nqp::istype(
Expand Down Expand Up @@ -1315,9 +1311,7 @@ my class array does Iterable {
multi method splice(numarray:D: Int:D $offset, Int:D $size, Seq:D \seq) {
nqp::if(
seq.is-lazy,
Failure.new(X::Cannot::Lazy.new(
:action<splice>, :what(self.^name)
)),
X::Cannot::Lazy.new(:action<splice>, :what(self.^name)).throw,
nqp::stmts(
nqp::unless(
nqp::istype(
Expand Down
4 changes: 1 addition & 3 deletions tools/build/makeNATIVE_ARRAY.p6
Expand Up @@ -250,9 +250,7 @@ for $*IN.lines -> $line {
multi method splice(#type#array:D: Int:D $offset, Int:D $size, Seq:D \seq) {
nqp::if(
seq.is-lazy,
Failure.new(X::Cannot::Lazy.new(
:action<splice>, :what(self.^name)
)),
X::Cannot::Lazy.new(:action<splice>, :what(self.^name)).throw,
nqp::stmts(
nqp::unless(
nqp::istype(
Expand Down

0 comments on commit bb963a2

Please sign in to comment.