Skip to content

Commit

Permalink
Make sigils2bit mapper a setting compiler time thing
Browse files Browse the repository at this point in the history
No further changes
  • Loading branch information
lizmat committed Oct 31, 2020
1 parent 97d473b commit a541aed
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions src/core.c/Parameter.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,17 @@ my class Parameter { # declared in BOOTSTRAP
+| $SIG_ELEM_IS_COPY
+| $SIG_ELEM_IS_RAW;

my $sigils2bit := nqp::null;
my constant $sigils2bit = do {
nqp::hash(
Q/@/, $SIG_ELEM_ARRAY_SIGIL,
Q/%/, $SIG_ELEM_HASH_SIGIL,
Q/&/, $SIG_ELEM_CODE_SIGIL,
Q/\/, $SIG_ELEM_IS_RAW,
Q/|/, $SIG_ELEM_IS_CAPTURE +| $SIG_ELEM_IS_RAW,
)
}
sub set-sigil-bits(str $sigil, \flags --> Nil) {
if nqp::atkey(
nqp::ifnull(
$sigils2bit,
$sigils2bit := nqp::hash(
Q/@/, $SIG_ELEM_ARRAY_SIGIL,
Q/%/, $SIG_ELEM_HASH_SIGIL,
Q/&/, $SIG_ELEM_CODE_SIGIL,
Q/\/, $SIG_ELEM_IS_RAW,
Q/|/, $SIG_ELEM_IS_CAPTURE +| $SIG_ELEM_IS_RAW,
)
),
$sigil
) -> $bit {
if nqp::atkey($sigils2bit,$sigil) -> $bit {
flags +|= $bit
}
}
Expand Down

0 comments on commit a541aed

Please sign in to comment.