blib/lib/Erlang/Parser/Node/FunLocalCase.pm

filter: Statementstmt 100% 29 / 29 Branchbran 100% 4 / 4 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 2 / 2 Podpod 100% 1 / 1 totaltotal 94.8% 37 / 39 CC 6 SCAR 16.7
CC
6
Cov
97%
print
6.0
BEGIN
1.0
CRAP 5.3
« blib/lib/Erlang/Parser/Node/IfExpr.pm ↑ Summary blib/lib/Erlang/Parser/Node/Def.pm »
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::FunLocalCase;
6  
7 4 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 4 with 'Erlang::Parser::Node';
9  
10 4 has 'args' => (is => 'rw', required => 1, isa => 'ArrayRef[Erlang::Parser::Node]');
11 4 has 'whens' => (is => 'rw', required => 1, isa => 'Erlang::Parser::Node::WhenList');
12 4 has 'stmts' => (is => 'rw', required => 1, isa => 'ArrayRef[Erlang::Parser::Node]');
13  
14 sub print {
15 266 ▶ my ($self, $fh, $depth) = @_;
Subroutine print: called CC=6 SCAR=17.9
Pod documented
16 266 ▶ $depth ||= 0;
Condition50%1/2
$depth ||= 0
l!l
2660
MC/DC0%0/1
$depth ||= 0
$depth
Truth table50%1/2
A
A= $depth
Aresult
11
00
17  
18 266 print $fh '(';
19 266 my $first = 1;
20 266 foreach (@{$self->args}) {
21 314 ▶ if ($first) { $first = 0 } else { print $fh ', ' }
Branch: 1 branch
BranchTrueFalseTotal
if ($first) { } 244 70 314
22 314 $_->print($fh, $depth);
23 }
24  
25 266 print $fh ') ';
26  
27 266 $self->whens->print($fh, $depth);
28
29 266 print $fh '-> ';
30 266 $first = 1;
31 266 foreach (@{$self->stmts}) {
32 392 ▶ if ($first) { $first = 0 } else { print $fh ', ' }
Branch: 1 branch
BranchTrueFalseTotal
if ($first) { } 266 126 392
33 392 $_->print($fh, $depth);
34 }
35 }
36  
37 4 __PACKAGE__->meta->make_immutable;
38  
39 =head1 NAME
40  
41 Erlang::Parser::Node::FunLocalCase - one case in a local fun
42  
43 =head1 DESCRIPTION
44  
45 To L<Erlang::Parser::Node::FunLocal> as L<Erlang::Parser::Node::Def> is to
46 L<Erlang::Parser::Node::DefList>.
47  
48 =head2 Accessors
49  
50 =over 4
51  
52 =item C<args>
53  
54 A list of L<Erlang::Parser::Node>s which constitute the argument patterns to be
55 matched.
56  
57 =item C<whens>
58  
59 The L<Erlang::Parser::Node::WhenList> containing guard expressions/sequences.
60  
61 =item C<stmts>
62  
63 A list of L<Erlang::Parser::Node>s; the body for the function.
64  
65 =back
66  
67 =head2 Methods
68  
69 =over 4
70  
71 =item C<print>
72  
73 Pretty-prints the node to its filehandle argument.
74  
75 =back
76  
77 =head1 EXAMPLE
78  
79 (X) when is_bool(X) -> 4
80  
81 =cut
82  
83 4 1;
84  
85 # vim: set sw=4 ts=4:
« blib/lib/Erlang/Parser/Node/IfExpr.pm ↑ Summary blib/lib/Erlang/Parser/Node/Def.pm »