| 1 | # Copyright 2011-2012 Yuki Izumi. ( anneli AT cpan DOT org ) | ||||||||||||
| 2 | # This is free software; you can redistribute it and/or modify it under the | ||||||||||||
| 3 | # same terms as Perl itself. | ||||||||||||
| 4 | |||||||||||||
| 5 | package Erlang::Parser::Node::FunLocal; | ||||||||||||
| 6 | |||||||||||||
| 7 | 4 | ▶ | use Moose; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 8 | 4 | with 'Erlang::Parser::Node'; | |||||||||||
| 9 | |||||||||||||
| 10 | 4 | has 'cases' => (is => 'rw', required => 1, isa => 'ArrayRef[Erlang::Parser::Node::FunLocalCase]'); | |||||||||||
| 11 | |||||||||||||
| 12 | sub print { | ||||||||||||
| 13 | 236 | ▶ | my ($self, $fh, $depth) = @_; | ||||||||||
|
Subroutine
print: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||
| 14 | 236 | ▶ | $depth ||= 0; | ||||||||||
|
Condition50%1/2
$depth ||= 0
MC/DC0%0/1
$depth ||= 0
$depth
Truth table50%1/2
A
A= $depth
| |||||||||||||
| 15 | |||||||||||||
| 16 | 236 | print $fh 'fun '; | |||||||||||
| 17 | |||||||||||||
| 18 | 236 | my $first = 1; | |||||||||||
| 19 | 236 | foreach (@{$self->cases}) { | |||||||||||
| 20 | 266 | ▶ | if ($first) { $first = 0 } else { print $fh '; ' } | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 21 | |||||||||||||
| 22 | 266 | $_->print($fh, $depth); | |||||||||||
| 23 | } | ||||||||||||
| 24 | |||||||||||||
| 25 | 236 | print $fh ' end'; | |||||||||||
| 26 | } | ||||||||||||
| 27 | |||||||||||||
| 28 | 4 | __PACKAGE__->meta->make_immutable; | |||||||||||
| 29 | |||||||||||||
| 30 | =head1 NAME | ||||||||||||
| 31 | |||||||||||||
| 32 | Erlang::Parser::Node::FunLocal - a lambda-style local fun | ||||||||||||
| 33 | |||||||||||||
| 34 | =head1 DESCRIPTION | ||||||||||||
| 35 | |||||||||||||
| 36 | A lambda-ish local fun definition, comprised of multiple cases; see | ||||||||||||
| 37 | L<Erlang::Parser::Node::DefList>. | ||||||||||||
| 38 | |||||||||||||
| 39 | =head2 Accessors | ||||||||||||
| 40 | |||||||||||||
| 41 | =over 4 | ||||||||||||
| 42 | |||||||||||||
| 43 | =item C<cases> | ||||||||||||
| 44 | |||||||||||||
| 45 | A list of L<Erlang::Parser::Node::FunLocalCase>s. | ||||||||||||
| 46 | |||||||||||||
| 47 | =back | ||||||||||||
| 48 | |||||||||||||
| 49 | =head2 Methods | ||||||||||||
| 50 | |||||||||||||
| 51 | =over 4 | ||||||||||||
| 52 | |||||||||||||
| 53 | =item C<print> | ||||||||||||
| 54 | |||||||||||||
| 55 | Pretty-prints the node to its filehandle argument. | ||||||||||||
| 56 | |||||||||||||
| 57 | =back | ||||||||||||
| 58 | |||||||||||||
| 59 | =head1 EXAMPLE | ||||||||||||
| 60 | |||||||||||||
| 61 | fun (0) -> 1; (N) -> N + 1 end % wtf does this do | ||||||||||||
| 62 | |||||||||||||
| 63 | =cut | ||||||||||||
| 64 | |||||||||||||
| 65 | 4 | 1; | |||||||||||
| 66 | |||||||||||||
| 67 | # vim: set sw=4 ts=4: | ||||||||||||