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

filter: Statementstmt 100% 26 / 26 Branchbran 100% 8 / 8 Conditioncond 100% 2 / 2 MC/DCmcdc 100% 1 / 1 Subroutinesub 100% 2 / 2 Podpod 100% 1 / 1 totaltotal 100% 40 / 40 CC 7 SCAR 18.3
CC
7
Cov
100%
print
7.0
BEGIN
1.0
CRAP 6.2
« blib/lib/Erlang/Parser.pm ↑ Summary blib/lib/Erlang/Parser/Node/Comprehension.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::Call;
6  
7 3 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 3 with 'Erlang::Parser::Node';
9  
10 3 has 'module' => (is => 'rw', required => 0, isa => 'Erlang::Parser::Node');
11 3 has 'function' => (is => 'rw', required => 1, isa => 'Erlang::Parser::Node');
12 3 has 'args' => (is => 'rw', required => 1, isa => 'ArrayRef[Erlang::Parser::Node]');
13  
14 6828 ▶sub print {
Subroutine print: called CC=7 SCAR=19.5
Pod documented
15 6828 my ($self, $fh, $depth) = @_;
16 6828 ▶ $depth ||= 0;
Condition100%2/2
$depth ||= 0
l!l
678246
MC/DC100%1/1
$depth ||= 0
$depth
Truth table100%2/2
A
A= $depth
Aresult
11
00
17  
18 6828 ▶ if (defined $self->module) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->module) 1802 5026 6828
19 1802 $self->module->print($fh, $depth);
20 1802 print $fh ':';
21 }
22  
23 6828 ▶ print $fh '(' if $self->function->blessed ne 'Erlang::Parser::Node::Atom';
Branch: 1 branch
BranchTrueFalseTotal
if $self->function->blessed ne "Erlang::Parser::Node::Atom" 1178 5650 6828
24 6828 $self->function->print($fh, $depth);
25 6828 ▶ print $fh ')' if $self->function->blessed ne 'Erlang::Parser::Node::Atom';
Branch: 1 branch
BranchTrueFalseTotal
if $self->function->blessed ne "Erlang::Parser::Node::Atom" 1178 5650 6828
26 6828 print $fh '(';
27 6828 my $first = 1;
28 6828 foreach (@{$self->args}) {
29 11272 ▶ if ($first) { $first = 0 } else { print $fh ', ' }
Branch: 1 branch
BranchTrueFalseTotal
if ($first) { } 6678 4594 11272
30 11272 $_->print($fh, $depth);
31 }
32 6828 print $fh ')';
33 }
34  
35 3 __PACKAGE__->meta->make_immutable;
36  
37 =head1 NAME
38  
39 Erlang::Parser::Node::Call - a function call
40  
41 =head1 DESCRIPTION
42  
43 A call to a function, either local or external.
44  
45 =head2 Accessors
46  
47 =over 4
48  
49 =item C<module>
50  
51 A L<Erlang::Parser::Node> which returns the name of the module to use as an
52 atom; or C<undef>.
53  
54 =item C<function>
55  
56 A L<Erlang::Parser::Node> which either returns an atom which corresponds to a
57 local function or a function in C<module> if specified; or which returns a
58 calculated fun or fun reference itself.
59  
60 =item C<args>
61  
62 A list of L<Erlang::Parser::Node>s which are passed as arguments to the
63 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 lists:reverse([1, 2, 3])
80  
81 =cut
82  
83 3 1;
84  
85 # vim: set sw=4 ts=4:
« blib/lib/Erlang/Parser.pm ↑ Summary blib/lib/Erlang/Parser/Node/Comprehension.pm »