Skip to content

Commit

Permalink
empty array at start of STORE
Browse files Browse the repository at this point in the history
so that assigning a Seq into a native array won't
make it grow more and more each time
  • Loading branch information
timo committed Nov 18, 2018
1 parent 0d5a813 commit f1fa5ad
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/core/native_array.pm6
Expand Up @@ -89,7 +89,7 @@ my class array does Iterable {

my role strarray[::T] does Positional[T] is array_type(T) {
#- start of generated part of strarray role -----------------------------------
#- Generated on 2018-09-15T11:00:21+02:00 by tools/build/makeNATIVE_ARRAY.p6
#- Generated on 2018-11-18T17:27:23+01:00 by tools/build/makeNATIVE_ARRAY.p6
#- PLEASE DON'T CHANGE ANYTHING BELOW THIS LINE

multi method AT-POS(strarray:D: int $idx) is raw {
Expand Down Expand Up @@ -135,6 +135,7 @@ my class array does Iterable {
:action<store>, :what(self.^name)
).throw,
nqp::stmts(
nqp::setelems(self,0),
$iterator.push-all(self),
self
)
Expand Down Expand Up @@ -572,7 +573,7 @@ my class array does Iterable {

my role intarray[::T] does Positional[T] is array_type(T) {
#- start of generated part of intarray role -----------------------------------
#- Generated on 2018-09-15T11:00:21+02:00 by tools/build/makeNATIVE_ARRAY.p6
#- Generated on 2018-11-18T17:27:23+01:00 by tools/build/makeNATIVE_ARRAY.p6
#- PLEASE DON'T CHANGE ANYTHING BELOW THIS LINE

multi method AT-POS(intarray:D: int $idx) is raw {
Expand Down Expand Up @@ -618,6 +619,7 @@ my class array does Iterable {
:action<store>, :what(self.^name)
).throw,
nqp::stmts(
nqp::setelems(self,0),
$iterator.push-all(self),
self
)
Expand Down Expand Up @@ -1107,7 +1109,7 @@ my class array does Iterable {

my role numarray[::T] does Positional[T] is array_type(T) {
#- start of generated part of numarray role -----------------------------------
#- Generated on 2018-09-15T11:00:21+02:00 by tools/build/makeNATIVE_ARRAY.p6
#- Generated on 2018-11-18T17:27:23+01:00 by tools/build/makeNATIVE_ARRAY.p6
#- PLEASE DON'T CHANGE ANYTHING BELOW THIS LINE

multi method AT-POS(numarray:D: int $idx) is raw {
Expand Down Expand Up @@ -1153,6 +1155,7 @@ my class array does Iterable {
:action<store>, :what(self.^name)
).throw,
nqp::stmts(
nqp::setelems(self,0),
$iterator.push-all(self),
self
)
Expand Down
1 change: 1 addition & 0 deletions tools/build/makeNATIVE_ARRAY.p6 100755 → 100644
Expand Up @@ -92,6 +92,7 @@ for $*IN.lines -> $line {
:action<store>, :what(self.^name)
).throw,
nqp::stmts(
nqp::setelems(self,0),
$iterator.push-all(self),
self
)
Expand Down

0 comments on commit f1fa5ad

Please sign in to comment.