Skip to content
Permalink
Browse files

Simplify creation of the Signal enum

Also fixes R#2773
  • Loading branch information...
lizmat committed Mar 19, 2019
1 parent 6d8077c commit 76b6416d00dca8dc2f669b438581e34fefdf49bb
Showing with 8 additions and 13 deletions.
  1. +8 −13 src/core/signals.pm6
@@ -4,20 +4,15 @@ my role Signally {
nextsame
}
}
my enum Signal does Signally (
|nqp::stmts(
( my $res := nqp::list ),
( my $iter := nqp::iterator(nqp::getsignals) ),
nqp::while(
$iter,
nqp::stmts(
( my $p := nqp::p6bindattrinvres(nqp::create(Pair), Pair, '$!key', nqp::shift($iter)) ),
nqp::bindattr($p, Pair, '$!value', nqp::abs_i(nqp::shift($iter)) ),
nqp::push($res, $p),
),
),
my enum Signal does Signally ( |do {
my $res := nqp::list;
my $iter := nqp::iterator(nqp::getsignals);
nqp::push(
$res,
Pair.new(nqp::shift($iter), nqp::abs_i(nqp::shift($iter)))
) while $iter;
$res
)
}
);

proto sub signal($, |) {*}

0 comments on commit 76b6416

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