MinCaml/Node.pm

filter: Statementstmt 96.5% 28 / 29 Branchbran 100% 2 / 2 Conditioncond 100% 2 / 2 MC/DCmcdc 100% 1 / 1 Subroutinesub 83.3% 5 / 6 Podpod 50.0% 1 / 2 totaltotal 92.8% 39 / 42 CC 4 SCAR 8.5
CC
4
Cov
97%
to_str
4.0
__ANON__
1.1
BEGIN
1.0
CRAP 2.3
« MinCaml/Lexer.pm ↑ Summary MinCaml/Parser.pm »
1 package Language::MinCaml::Node;
2 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 6 ▶use base qw(Class::Accessor::Fast Exporter);
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 6 __PACKAGE__->mk_accessors(qw(kind children));
6  
7 6 our @EXPORT = qw(Node_Unit Node_Bool Node_Int Node_Float Node_Tuple
8 Node_Array Node_Var Node_Not Node_Neg Node_Add Node_Sub
9 Node_FNeg Node_FAdd Node_FSub Node_FMul Node_FDiv
10 Node_Eq Node_LE Node_If Node_Let Node_LetRec Node_App
11 Node_LetTuple Node_Get Node_Put);
12  
13 6 for my $routine_name (@EXPORT){
14 150 my $kind = $routine_name;
15 150 $kind =~ s/^Node_//;
16 0 ▶ my $routine = sub { __PACKAGE__->new($kind, @_); };
Subroutine __ANON__: not called CC=1 SCAR=1.2
17 6 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
18 150 *{$routine_name} = $routine;
19 }
20  
21 5 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
22 5 my($class, $kind, @children) = @_;
23 5 return bless { kind => $kind, children => \@children }, $class;
24 }
25  
26 4 ▶sub to_str {
Subroutine to_str: called CC=4 SCAR=13.9
Pod undocumented
27 4 my($self, $depth) = @_;
28 4 ▶ $depth ||= 0;
Condition100%2/2
$depth ||= 0
l!l
22
MC/DC100%1/1
$depth ||= 0
$depth
Truth table100%2/2
A
A= $depth
Aresult
11
00
29 4 my $content = "\t" x $depth . "$self->{kind}\n";
30  
31 4 for my $child (@{$self->{children}}) {
32 6 ▶ if (ref($child) eq __PACKAGE__) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $child eq __PACKAGE__) 1 5 6
33 1 $content .= $child->to_str($depth + 1);
34 }
35 }
36  
37 4 $content;
38 }
39  
40 6 1;
« MinCaml/Lexer.pm ↑ Summary MinCaml/Parser.pm »