Skip to content
Permalink
Browse files

Match: Check for onlyname Only Once

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 93ea7ed1f4243a945dafa74f1cc936b21cd7e054
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/core/Match.pm6
@@ -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);
}
}

0 comments on commit 93ea7ed

Please sign in to comment.
You can’t perform that action at this time.