Skip to content

Commit

Permalink
Make Signature a first class citizen
Browse files Browse the repository at this point in the history
Signature.new(params => (Parameter.new,), returns => Int, arity => 1, count => Inf)
now works.  Part of fix for R#2594
  • Loading branch information
lizmat committed Jan 9, 2019
1 parent 095d216 commit f329d6c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/core/Signature.pm6
Expand Up @@ -8,6 +8,15 @@ my class Signature { # declared in BOOTSTRAP
# has Num $!count; # count
# has Code $!code;

method BUILD(
:@params, Mu :$returns, Int:D :$arity = 0, Num:D :$count = $arity.Num
) {
nqp::bind(@!params,nqp::getattr(@params,List,'$!reified')),
$!returns := $returns;
$!arity = $arity;
$!count := $count;
}

multi method ACCEPTS(Signature:D: Mu \topic) {
nqp::hllbool(nqp::istrue(try self.ACCEPTS: topic.Capture))
}
Expand Down

0 comments on commit f329d6c

Please sign in to comment.