Skip to content

Commit

Permalink
Only bind to @!list in Capture.BUILD if the list given isn't empty
Browse files Browse the repository at this point in the history
This should save some memory.
  • Loading branch information
Kaiepi committed Mar 31, 2020
1 parent b98d2e0 commit 61b5e48
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/core.c/Capture.pm6
Expand Up @@ -6,10 +6,10 @@ my class Capture { # declared in BOOTSTRAP
method from-args(|c) { c }

submethod BUILD(:@list, :%hash --> Nil) {
@list.elems; # force reification of all
my Int:D $elems = @list.elems; # force reification of all
nqp::bindattr(self, Capture, '@!list',
nqp::getattr(nqp::decont(@list.list), List, '$!reified')
);
nqp::getattr(nqp::decont(@list.list), List, '$!reified'))
if $elems;
nqp::bindattr(self,Capture,'%!hash',
nqp::getattr(nqp::decont(%hash),Map,'$!storage'))
if nqp::attrinited(nqp::decont(%hash),Map,'$!storage')
Expand Down

0 comments on commit 61b5e48

Please sign in to comment.