| 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'
$args{'ops'} || []
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'}
Truth table50%1/2
A
A= $args{'ops'}
| |||||||||||||||||||||||||||||
| 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] || []
MC/DC0%0/1
$_[1] || []
$_[1]
Truth table0%0/2
A
A= $_[1]
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 37 | 51 | ▶ | for my $op (@{ $self->ops || [] }) { | ||||||||||||||||||||||||||
|
Condition50%1/2
$self->ops || []
MC/DC0%0/1
$self->ops || []
$self->ops
Truth table50%1/2
A
A= $self->ops
| |||||||||||||||||||||||||||||
| 38 | 65 | ▶ | next if !$op || !$op->can('set_block'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$op and $op->can("set_block")
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")
| |||||||||||||||||||||||||||||
| 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 || []
MC/DC0%0/1
$self->ops || []
$self->ops
Truth table0%0/2
A
A= $self->ops
| |||||||||||||||||||||||||||||
| 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 || []
MC/DC0%0/1
$self->ops || []
$self->ops
Truth table0%0/2
A
A= $self->ops
| |||||||||||||||||||||||||||||
| 59 | 0 | ▶ | my $slot = $op->bound_slot or next; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 60 | 0 | ▶ | my $id = join("\x1E", refaddr($slot), ($op->result_name // q())); | ||||||||||||||||||||||||||
|
Condition0%0/2
$op->result_name // ""
MC/DC0%0/1
$op->result_name // ""
$op->result_name
Truth table0%0/2
A
A= $op->result_name
| |||||||||||||||||||||||||||||
| 61 | 0 | ▶ | next if exists $slot_index{$id}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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 || []
MC/DC0%0/1
$self->ops || []
$self->ops
Truth table0%0/2
A
A= $self->ops
| |||||||||||||||||||||||||||||
| 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 || []
MC/DC0%0/1
$self->ops || []
$self->ops
Truth table0%0/2
A
A= $self->ops
| |||||||||||||||||||||||||||||
| 82 | 0 | ▶ | my $slot = $op->bound_slot or next; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 83 | 0 | ▶ | my $id = join("\x1E", refaddr($slot), ($op->result_name // q())); | ||||||||||||||||||||||||||
|
Condition0%0/2
$op->result_name // ""
MC/DC0%0/1
$op->result_name // ""
$op->result_name
Truth table0%0/2
A
A= $op->result_name
| |||||||||||||||||||||||||||||
| 84 | 0 | ▶ | next if exists $slot_index{$id}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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]
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]
| |||||||||||||||||||||||||||||
| 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 || []
MC/DC0%0/1
$self->ops || []
$self->ops
Truth table0%0/2
A
A= $self->ops
| |||||||||||||||||||||||||||||
| 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
Condition0%0/2
$family || ''
MC/DC0%0/1
$family || ''
$family
Truth table0%0/2
A
A= $family
| |||||||||||||||||||||||||||||
| 102 | 0 | ▶ | return 3 if ($family || q()) eq 'LIST'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$family || ''
MC/DC0%0/1
$family || ''
$family
Truth table0%0/2
A
A= $family
| |||||||||||||||||||||||||||||
| 103 | 0 | ▶ | return 4 if ($family || q()) eq 'ABSTRACT'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$family || ''
MC/DC0%0/1
$family || ''
$family
Truth table0%0/2
A
A= $family
| |||||||||||||||||||||||||||||
| 104 | 0 | return 1; | |||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||
| 107 | 62 | 1; | |||||||||||||||||||||||||||