Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Signature.ACCEPTS(Signature)
The method was mostly written by jnthn.
  • Loading branch information
amire80 authored and moritz committed Nov 28, 2012
1 parent bfbb051 commit 797af56
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/core/Signature.pm
Expand Up @@ -17,6 +17,16 @@ my class Signature {
self.ACCEPTS(%topic.Capture)
}

multi method ACCEPTS(Signature:D: Signature:D $topic) {
return False unless $topic.params == self.params;

for $topic.params Z self.params -> $t, $s {
return False unless $t.type ~~ $s.type;
}

return True;
}

method arity() {
self.count if nqp::isnull($!arity) || !$!arity.defined;
$!arity;
Expand Down
1 change: 1 addition & 0 deletions t/spectest.data
Expand Up @@ -209,6 +209,7 @@ S03-smartmatch/hash-hash.t
S03-smartmatch/range-range.t
S03-smartmatch/regex-hash.t
S03-smartmatch/scalar-hash.t
S03-smartmatch/signature-signature.t
S04-blocks-and-statements/let.t
S04-blocks-and-statements/pointy-rw.t
S04-blocks-and-statements/pointy.t
Expand Down

0 comments on commit 797af56

Please sign in to comment.