Skip to content

Commit

Permalink
Concrete Signature objects can also have roles mixed in
Browse files Browse the repository at this point in the history
Bypass normal object build logic, just as with Parameter
  • Loading branch information
lizmat committed Jan 11, 2019
1 parent 3eeb727 commit 9cd42b1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/core/Signature.pm6
Expand Up @@ -8,13 +8,18 @@ my class Signature { # declared in BOOTSTRAP
# has Num $!count; # count
# has Code $!code;

method BUILD(
multi method new(Signature:U:
:@params, Mu :$returns, Int:D :$arity = 0, Num:D :$count = $arity.Num
) {
nqp::create(self)!SET-SELF(@params, $returns, $arity, $count)
}

method !SET-SELF(@params, $returns, $arity, $count) {
nqp::bind(@!params,nqp::getattr(@params,List,'$!reified')),
$!returns := $returns;
$!arity = $arity;
$!count := $count;
self
}

multi method ACCEPTS(Signature:D: Mu \topic) {
Expand Down

0 comments on commit 9cd42b1

Please sign in to comment.