Skip to content

Commit

Permalink
Make Signature.ACCEPTS coerce args to Capture
Browse files Browse the repository at this point in the history
- Instead of relying to Any.ACCEPTS to always give False
- We already did do this for Positional and Associative arguments
  • Loading branch information
zoffixznet committed Oct 9, 2017
1 parent cd5864c commit 27131ed
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/core/Signature.pm
Expand Up @@ -8,18 +8,12 @@ my class Signature { # declared in BOOTSTRAP
# has Num $!count; # count
# has Code $!code;

multi method ACCEPTS(Signature:D: Mu \topic) {
nqp::p6bool(try self.ACCEPTS: topic.Capture)
}
multi method ACCEPTS(Signature:D: Capture $topic) {
nqp::p6bool(nqp::p6isbindable(self, nqp::decont($topic)));
}

multi method ACCEPTS(Signature:D: @topic) {
self.ACCEPTS(@topic.Capture)
}

multi method ACCEPTS(Signature:D: %topic) {
self.ACCEPTS(%topic.Capture)
}

multi method ACCEPTS(Signature:D: Signature:D $topic) {
my $sclass = self.params.classify({.named});
my $tclass = $topic.params.classify({.named});
Expand Down

0 comments on commit 27131ed

Please sign in to comment.