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

filter: Statementstmt 100% 21 / 21 Branchbran 100% 2 / 2 Conditioncond 100% 2 / 2 MC/DCmcdc 100% 1 / 1 Subroutinesub 100% 2 / 2 Podpod 100% 1 / 1 totaltotal 100% 29 / 29 CC 4 SCAR 12.2
CC
4
Cov
100%
print
4.0
BEGIN
1.0
CRAP 3.4
« blib/lib/Erlang/Parser/Node/Case.pm ↑ Summary blib/lib/Erlang/Parser/Node/Tuple.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::RecordNew;
6  
7 4 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 4 with 'Erlang::Parser::Node';
9  
10 4 has 'record' => (is => 'rw', required => 1, isa => 'Erlang::Parser::Node::Atom');
11 4 has 'exprs' => (is => 'rw', required => 1, isa => 'ArrayRef[Erlang::Parser::Node]');
12  
13 sub print {
14 448 ▶ my ($self, $fh, $depth) = @_;
Subroutine print: called CC=4 SCAR=13.9
Pod documented
15 448 ▶ $depth ||= 0;
Condition100%2/2
$depth ||= 0
l!l
218230
MC/DC100%1/1
$depth ||= 0
$depth
Truth table100%2/2
A
A= $depth
Aresult
11
00
16  
17 448 print $fh '#';
18 448 $self->record->print($fh, $depth);
19 448 print $fh '{';
20  
21 448 my $first = 1;
22 448 foreach (@{$self->exprs}) {
23 596 ▶ if ($first) { $first = 0 } else { print $fh ', ' }
Branch: 1 branch
BranchTrueFalseTotal
if ($first) { } 416 180 596
24 596 $_->print($fh, $depth);
25 }
26  
27 448 print $fh '}';
28 }
29  
30 4 __PACKAGE__->meta->make_immutable;
31  
32 =head1 NAME
33  
34 Erlang::Parser::Node::RecordNew - creation of a new record
35  
36 =head1 DESCRIPTION
37  
38 Creation of a record based on a record definition.
39  
40 =head2 Accessors
41  
42 =over 4
43  
44 =item C<record>
45  
46 The name of the record definition being used.
47  
48 =item C<exprs>
49  
50 A list of L<Erlang::Parser::Node>s which instantiate fields in the record.
51  
52 =back
53  
54 =head2 Methods
55  
56 =over 4
57  
58 =item C<print>
59  
60 Pretty-prints the node to its filehandle argument.
61  
62 =back
63  
64 =head1 EXAMPLE
65  
66 #state{S=4}
67  
68 =cut
69  
70 4 1;
71  
72 # vim: set sw=4 ts=4:
« blib/lib/Erlang/Parser/Node/Case.pm ↑ Summary blib/lib/Erlang/Parser/Node/Tuple.pm »