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

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