Permalink
Browse files

Refactor Signature.count to properly handle arity for capture paramet…

…ers. Fixes RT #111646.
  • Loading branch information...
1 parent 4d6754b commit 69920db5858544f310d993bbc8e9713437660510 @pmichaud pmichaud committed Mar 23, 2012
Showing with 4 additions and 2 deletions.
  1. +4 −2 src/core/Signature.pm
View
@@ -21,11 +21,13 @@ my class Signature {
my $param;
while $iter {
$param := nqp::shift($iter);
- if $param.positional {
+ if $param.capture || $param.slurpy && !$param.named {
+ $count = Inf;
+ }
+ elsif $param.positional {
$count++;
$arity++ unless $param.optional;
}
- $count = Inf if $param.capture || $param.slurpy && !$param.named;
}
nqp::bindattr(self, Signature, '$!arity', $arity);
nqp::bindattr(self, Signature, '$!count', $count);

0 comments on commit 69920db

Please sign in to comment.