Skip to content

Commit

Permalink
Match: Check for onlyname Only Once
Browse files Browse the repository at this point in the history
instead of checking every run around the loop.

Looking at spesh made me realize that every
time it goes through the loop it also tried to
sink the result of the if.
  • Loading branch information
timo committed Nov 29, 2018
1 parent defc2c5 commit 93ea7ed
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/Match.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ my class Match is Capture is Cool does NQPMatchRole {
$namecount = nqp::add_i($namecount, 1);
if nqp::iterval(nqp::shift($iter)) >= 2 {
$name = nqp::iterkey_s($iter);
$onlyname = $name if nqp::iseq_i($namecount, 1);
nqp::iscclass(nqp::const::CCLASS_NUMERIC, $name, 0)
?? nqp::bindpos(
nqp::if(nqp::isconcrete($list), $list, ($list := nqp::list())),
nqp::fromstr_I($name, Int), [])
!! nqp::bindkey($hash, $name, []);
}
}
$onlyname = $name if nqp::iseq_i($namecount, 1);
}
}

Expand Down

0 comments on commit 93ea7ed

Please sign in to comment.