~ubuntu-branches/ubuntu/precise/rakudo/precise

« back to all changes in this revision

Viewing changes to src/setting/Block.pm

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghedini
  • Date: 2011-05-17 11:31:09 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20110517113109-rmfir654u1axbpt4
Tags: 0.1~2011.04-1
* New upstream release (Closes: #601862, #585762, #577502)
* New maintainer
* Switch to 3.0 (quilt) format
* Update dependencies (Closes: #584498)
* Update debian/copyright to lastest DEP5 revision
* Do not generate/install perl6 manpage (now done by the build system)
* Enable tests
* Bump Standards-Version to 3.9.2 (no changes needed)
* Do not install extra LICENSE files and duplicated docs
* Remove debian/clean (no more needed)
* Add Vcs-* fields in debian/control
* Rewrite (short) description
* Update upstream copyright years
* Upload to unstable

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
class Block is also {
2
 
 
3
 
=begin item arity
4
 
 
5
 
=end item
6
 
    method arity() {
7
 
        if $.signature -> $sig {
8
 
            my $arity = 0;
9
 
            for $sig.params -> $p {
10
 
                $arity++ unless $p.slurpy || $p.optional;
11
 
            }
12
 
            $arity
13
 
        }
14
 
        else {
15
 
            Q:PIR {
16
 
                $P0 = find_lex 'self'
17
 
                $P0 = descalarref $P0
18
 
                $P1 = inspect $P0, "pos_required"
19
 
                $P2 = inspect $P0, "named_required"
20
 
                %r = $P1 + $P2
21
 
            };
22
 
        }
23
 
    }
24
 
 
25
 
=begin item count
26
 
 
27
 
=end item
28
 
    method count() {
29
 
        if $.signature -> $sig {
30
 
            my $count = 0;
31
 
            for $sig.params -> $p {
32
 
                $count++ unless $p.slurpy;
33
 
            }
34
 
            $count
35
 
        }
36
 
        else {
37
 
            Q:PIR {
38
 
                $P0 = find_lex 'self'
39
 
                $P0 = descalarref $P0
40
 
                $P1 = inspect $P0, "pos_required"
41
 
                $P2 = inspect $P0, "pos_optional"
42
 
                $P3 = $P1 + $P2
43
 
                $P1 = inspect $P0, "named_required"
44
 
                $P2 = inspect $P0, "named_optional"
45
 
                $P4 = $P1 + $P2
46
 
                %r = $P3 + $P4
47
 
            };
48
 
        }
49
 
    }
50
 
 
51
 
}
52
 
 
53
 
# vim: ft=perl6