Skip to content
Permalink
Browse files

Make Signature a first class citizen

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 f329d6c6cab9782d56af43d75a33d4977d637694
Showing with 9 additions and 0 deletions.
  1. +9 −0 src/core/Signature.pm6
@@ -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))
}

0 comments on commit f329d6c

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