blib/lib/GraphQL/Houtou/Runtime/VMBlock.pm

filter: Statementstmt 42.0% 29 / 69 Branchbran 11.1% 2 / 18 Conditioncond 11.7% 4 / 34 MC/DCmcdc 0.0% 0 / 18 Subroutinesub 64.7% 11 / 17 Podpod 0.0% 0 / 11 totaltotal 27.5% 46 / 167 CC 29 SCAR 34.7
CC
29
Cov
29%
to_native_compact_struct
72.0
to_native_struct
56.0
_family_code
56.0
CRAP 32.1
« blib/lib/GraphQL/Houtou/Schema.pm ↑ Summary blib/lib/GraphQL/Houtou/Runtime/NativeRuntime.pm »
1 package GraphQL::Houtou::Runtime::VMBlock;
2  
3 62 ▶use 5.014;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 62 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 62 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 62 ▶use Scalar::Util qw(refaddr weaken);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 62 ▶use constant {
Subroutine BEGIN: called CC=1 SCAR=0.0
9 62 NAME_SLOT => 0,
10 TYPE_NAME_SLOT => 1,
11 FAMILY_SLOT => 2,
12 OPS_SLOT => 3,
13 PROGRAM_SLOT => 4,
14 62 };
15  
16 20 ▶sub new {
Subroutine new: called CC=3 SCAR=12.0
Pod undocumented
17 20 my ($class, %args) = @_;
18 return bless [
19 $args{name},
20 $args{type_name},
21 $args{family} || 'OBJECT',
22 20 ▶ $args{ops} || [],
Condition50%2/4
$args{'family'} || 'OBJECT'
l!l
200
$args{'ops'} || []
l!l
200
MC/DC0%0/1
$args{'family'} || 'OBJECT'
$args{'family'}
MC/DC0%0/1
$args{'ops'} || []
$args{'ops'}
Truth table50%1/2
A
A= $args{'family'}
Aresult
11
00
Truth table50%1/2
A
A= $args{'ops'}
Aresult
11
00
23 undef,
24 ], $class;
25 }
26  
27 76 ▶sub name { return $_[0][NAME_SLOT] }
Subroutine name: called CC=1 SCAR=0.0
Pod undocumented
28 2 ▶sub type_name { return $_[0][TYPE_NAME_SLOT] }
Subroutine type_name: called CC=1 SCAR=0.0
Pod undocumented
29 0 ▶sub family { return $_[0][FAMILY_SLOT] }
Subroutine family: not called CC=1 SCAR=6.9
Pod undocumented
30 115 ▶sub ops { return $_[0][OPS_SLOT] }
Subroutine ops: called CC=1 SCAR=0.0
Pod undocumented
31 53 ▶sub program { return $_[0][PROGRAM_SLOT] }
Subroutine program: called CC=1 SCAR=0.0
Pod undocumented
32 0 ▶sub set_ops { $_[0][OPS_SLOT] = $_[1] || []; return $_[0][OPS_SLOT] }
Subroutine set_ops: not called CC=2 SCAR=17.9
Pod undocumented
Condition0%0/2
$_[1] || []
l!l
00
MC/DC0%0/1
$_[1] || []
$_[1]
Truth table0%0/2
A
A= $_[1]
Aresult
11
00
33 51 ▶sub set_program {
Subroutine set_program: called CC=6 SCAR=19.3
Pod undocumented
34 51 my ($self, $program) = @_;
35 51 $self->[PROGRAM_SLOT] = $program;
36 51 ▶ weaken($self->[PROGRAM_SLOT]) if ref($self->[PROGRAM_SLOT]);
Branch: 1 branch
BranchTrueFalseTotal
if ref $self->[4] 51 0 51
37 51 ▶ for my $op (@{ $self->ops || [] }) {
Condition50%1/2
$self->ops || []
l!l
510
MC/DC0%0/1
$self->ops || []
$self->ops
Truth table50%1/2
A
A= $self->ops
Aresult
11
00
38 65 ▶ next if !$op || !$op->can('set_block');
Branch: 1 branch
BranchTrueFalseTotal
unless $op and $op->can("set_block") 0 65 65
Condition33%1/3
$op and $op->can("set_block")
!ll&&!rl&&r
0065
MC/DC0%0/2
$op and $op->can("set_block")
$op $op->can("set_block")
Truth table33%1/3
A and B
A= $opB= $op->can("set_block")
ABresult
0X0
100
111
39 65 $op->set_block($self);
40 }
41 51 return $self->[PROGRAM_SLOT];
42 }
43  
44 0 ▶sub to_struct {
Subroutine to_struct: not called CC=2 SCAR=17.9
Pod undocumented
45 0 my ($self) = @_;
46 return {
47 name => $self->name,
48 type_name => $self->type_name,
49 family => $self->family,
50 0 ▶ ops => [ map { $_->to_struct } @{ $self->ops || [] } ],
Condition0%0/2
$self->ops || []
l!l
00
MC/DC0%0/1
$self->ops || []
$self->ops
Truth table0%0/2
A
A= $self->ops
Aresult
11
00
51 };
52 }
53  
54 0 ▶sub to_native_struct {
Subroutine to_native_struct: not called CC=7 SCAR=40.3
Pod undocumented
55 0 my ($self, $block_index, $payload_catalog) = @_;
56 0 my @slot_table;
57 my %slot_index;
58 0 ▶ for my $op (@{ $self->ops || [] }) {
Condition0%0/2
$self->ops || []
l!l
00
MC/DC0%0/1
$self->ops || []
$self->ops
Truth table0%0/2
A
A= $self->ops
Aresult
11
00
59 0 ▶ my $slot = $op->bound_slot or next;
Branch: 1 branch
BranchTrueFalseTotal
my $slot = $op->bound_slot or next 0 0 0
60 0 ▶ my $id = join("\x1E", refaddr($slot), ($op->result_name // q()));
Condition0%0/2
$op->result_name // ""
l!l
00
MC/DC0%0/1
$op->result_name // ""
$op->result_name
Truth table0%0/2
A
A= $op->result_name
Aresult
11
00
61 0 ▶ next if exists $slot_index{$id};
Branch: 1 branch
BranchTrueFalseTotal
if exists $slot_index{$id} 0 0 0
62 0 $slot_index{$id} = scalar @slot_table;
63 0 my $native_slot = $slot->to_native_struct(include_arg_defs => 1);
64 0 $native_slot->{result_name} = $op->result_name;
65 0 push @slot_table, $native_slot;
66 }
67 return {
68 name => $self->name,
69 type_name => $self->type_name,
70 family => $self->family,
71 family_code => _family_code($self->family),
72 slots => \@slot_table,
73 0 ▶ ops => [ map { $_->to_native_struct($block_index, \%slot_index, $payload_catalog) } @{ $self->ops || [] } ],
Condition0%0/2
$self->ops || []
l!l
00
MC/DC0%0/1
$self->ops || []
$self->ops
Truth table0%0/2
A
A= $self->ops
Aresult
11
00
74 };
75 }
76  
77 0 ▶sub to_native_compact_struct {
Subroutine to_native_compact_struct: not called CC=8 SCAR=42.8
Pod undocumented
78 0 my ($self, $block_index, $payload_catalog) = @_;
79 0 my @slot_table;
80 my %slot_index;
81 0 ▶ for my $op (@{ $self->ops || [] }) {
Condition0%0/2
$self->ops || []
l!l
00
MC/DC0%0/1
$self->ops || []
$self->ops
Truth table0%0/2
A
A= $self->ops
Aresult
11
00
82 0 ▶ my $slot = $op->bound_slot or next;
Branch: 1 branch
BranchTrueFalseTotal
my $slot = $op->bound_slot or next 0 0 0
83 0 ▶ my $id = join("\x1E", refaddr($slot), ($op->result_name // q()));
Condition0%0/2
$op->result_name // ""
l!l
00
MC/DC0%0/1
$op->result_name // ""
$op->result_name
Truth table0%0/2
A
A= $op->result_name
Aresult
11
00
84 0 ▶ next if exists $slot_index{$id};
Branch: 1 branch
BranchTrueFalseTotal
if exists $slot_index{$id} 0 0 0
85 0 $slot_index{$id} = scalar @slot_table;
86 0 my $native_slot = $slot->to_native_compact_struct(include_arg_defs => 1);
87 0 ▶ $native_slot->[1] = ($op->result_name // $native_slot->[1]);
Condition0%0/3
$op->result_name // $native_slot->[1]
l!l&&r!l&&!r
000
MC/DC0%0/2
$op->result_name // $native_slot->[1]
$op->result_name $native_slot->[1]
Truth table0%0/3
A // B
A= $op->result_nameB= $native_slot->[1]
ABresult
1X1
011
000
88 0 push @slot_table, $native_slot;
89 }
90 return [
91 $self->name,
92 $self->type_name,
93 _family_code($self->family),
94 \@slot_table,
95 0 ▶ [ map { $_->to_native_compact_struct($block_index, \%slot_index, $payload_catalog) } @{ $self->ops || [] } ],
Condition0%0/2
$self->ops || []
l!l
00
MC/DC0%0/1
$self->ops || []
$self->ops
Truth table0%0/2
A
A= $self->ops
Aresult
11
00
96 ];
97 }
98  
99 0 ▶sub _family_code {
Subroutine _family_code: not called CC=7 SCAR=40.3
100 0 my ($family) = @_;
101 0 ▶ return 2 if ($family || q()) eq 'OBJECT';
Branch: 1 branch
BranchTrueFalseTotal
if ($family || "") eq "OBJECT" 0 0 0
Condition0%0/2
$family || ''
l!l
00
MC/DC0%0/1
$family || ''
$family
Truth table0%0/2
A
A= $family
Aresult
11
00
102 0 ▶ return 3 if ($family || q()) eq 'LIST';
Branch: 1 branch
BranchTrueFalseTotal
if ($family || "") eq "LIST" 0 0 0
Condition0%0/2
$family || ''
l!l
00
MC/DC0%0/1
$family || ''
$family
Truth table0%0/2
A
A= $family
Aresult
11
00
103 0 ▶ return 4 if ($family || q()) eq 'ABSTRACT';
Branch: 1 branch
BranchTrueFalseTotal
if ($family || "") eq "ABSTRACT" 0 0 0
Condition0%0/2
$family || ''
l!l
00
MC/DC0%0/1
$family || ''
$family
Truth table0%0/2
A
A= $family
Aresult
11
00
104 0 return 1;
105 }
106  
107 62 1;
« blib/lib/GraphQL/Houtou/Schema.pm ↑ Summary blib/lib/GraphQL/Houtou/Runtime/NativeRuntime.pm »