Skip to content

Commit

Permalink
Don't allocate a nqp::list if it's not necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed Jan 5, 2018
1 parent f719a47 commit 00797d0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/core/Match.pm
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ my class Match is Capture is Cool does NQPMatchRole {
my int $start = 1;
my int $nomod = im == 0;

my Mu $order := nqp::list();
my Mu $order;

# Looks something we need to loop over
if !nqp::iscont(var) {
Expand Down Expand Up @@ -280,7 +280,7 @@ my class Match is Capture is Cool does NQPMatchRole {
# Now run the NFA
my Mu \fates := nqp::findmethod(nfa,'run')(nfa,$tgt,$pos);
my int $count = nqp::elems(fates);
nqp::setelems($order,$count);
nqp::setelems(($order := nqp::list),$count);
$j = -1;
nqp::bindpos($order,$j,
nqp::atpos(alts,nqp::atpos_i(fates,$j)))
Expand All @@ -290,7 +290,7 @@ my class Match is Capture is Cool does NQPMatchRole {

# Use the var as it is if it's not array-ish.
else {
nqp::push($order, var);
$order := nqp::list(var);
}

my str $topic_str;
Expand Down

0 comments on commit 00797d0

Please sign in to comment.