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

filter: Statementstmt 100% 21 / 21 Branchbran 100% 2 / 2 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 2 / 2 Podpod 100% 1 / 1 totaltotal 93.1% 27 / 29 CC 4 SCAR 12.2
CC
4
Cov
96%
print
4.0
BEGIN
1.0
CRAP 3.4
« blib/lib/Erlang/Parser/Node/Directive.pm ↑ Summary blib/lib/Erlang/Parser/Node/If.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::Begin;
6  
7 4 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 4 with 'Erlang::Parser::Node';
9  
10 4 has 'exprs' => (is => 'rw', required => 1, isa => 'ArrayRef[Erlang::Parser::Node]');
11  
12 sub print {
13 12 ▶ my ($self, $fh, $depth) = @_;
Subroutine print: called CC=4 SCAR=13.9
Pod documented
14 12 ▶ $depth ||= 0;
Condition50%1/2
$depth ||= 0
l!l
120
MC/DC0%0/1
$depth ||= 0
$depth
Truth table50%1/2
A
A= $depth
Aresult
11
00
15  
16 12 print $fh "begin\n";
17  
18 12 $depth++;
19 12 print $fh "\t" x $depth;
20  
21 12 my $first = 1;
22 12 foreach (@{$self->exprs}) {
23 32 ▶ if ($first) { $first = 0 } else { print $fh ",\n", "\t" x $depth }
Branch: 1 branch
BranchTrueFalseTotal
if ($first) { } 12 20 32
24 32 $_->print($fh, $depth);
25 }
26  
27 12 $depth--;
28  
29 12 print $fh "\n", "\t" x $depth, 'end';
30 }
31  
32 4 __PACKAGE__->meta->make_immutable;
33  
34 =head1 NAME
35  
36 Erlang::Parser::Node::Begin - a block of statements
37  
38 =head1 DESCRIPTION
39  
40 A block of statements; a glorified parenthesis.
41  
42 =head2 Accessors
43  
44 =over 4
45  
46 =item C<exprs>
47  
48 A list of L<Erlang::Parser::Node>s; the body for this block. The last
49 expression is the value for the block.
50  
51 =back
52  
53 =head2 Methods
54  
55 =over 4
56  
57 =item C<print>
58  
59 Pretty-prints the node to its filehandle argument.
60  
61 =back
62  
63 =head1 EXAMPLE
64  
65 begin
66 do_this(),
67 xyz:do_that()
68 end
69  
70 =cut
71  
72 4 1;
73  
74 # vim: set sw=4 ts=4:
« blib/lib/Erlang/Parser/Node/Directive.pm ↑ Summary blib/lib/Erlang/Parser/Node/If.pm »