blib/lib/SPVM/Builder/Native/Runtime.pm

filter: Statementstmt 37.2% 32 / 86 Branchbran 22.2% 8 / 36 Conditioncond 25.0% 1 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 50.0% 5 / 10 Podpod 0.0% 0 / 8 totaltotal 31.5% 46 / 146 CC 23 SCAR 29.4
CC
23
Cov
33%
get_basic_types
30.3
get_basic_types
30.3
env
6.0
CRAP 18.9
« blib/lib/SPVM/Builder/API.pm ↑ Summary blib/lib/SPVM/Builder/Config.pm »
1 package SPVM::Builder::Native::Runtime;
2  
3 673 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 673 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 # Fields
7 0 ▶sub pointer {
Subroutine pointer: not called CC=2 SCAR=10.1
Pod undocumented
8 6 ▶ my $self = shift;
Subroutine pointer: called CC=2 SCAR=10.1
Pod undocumented
9 0 ▶ if (@_) {
Branch: 2 branches
BranchTrueFalseTotal
if (@_) { } 0 0 0
if (@_) { } 0 0 0
10 0 $self->{pointer} = $_[0];
11 0 return $self;
12 }
13 else {
14 0 return $self->{pointer};
15 }
16 }
17  
18 0 ▶sub compiler {
Subroutine compiler: not called CC=2 SCAR=16.5
Pod undocumented
19 0 ▶ my $self = shift;
Subroutine compiler: called CC=2 SCAR=16.5
Pod undocumented
20 0 ▶ if (@_) {
Branch: 2 branches
BranchTrueFalseTotal
if (@_) { } 0 0 0
if (@_) { } 0 0 0
21 0 $self->{compiler} = $_[0];
22 0 return $self;
23 }
24 else {
25 0 return $self->{compiler};
26 }
27 }
28  
29 0 ▶sub env {
Subroutine env: not called CC=2 SCAR=17.9
Pod undocumented
30 0 ▶ my $self = shift;
Subroutine env: not called CC=2 SCAR=17.9
Pod undocumented
31 0 ▶ if (@_) {
Branch: 2 branches
BranchTrueFalseTotal
if (@_) { } 0 0 0
if (@_) { } 0 0 0
32 0 $self->{env} = $_[0];
33 0 return $self;
34 }
35 else {
36 0 return $self->{env};
37 }
38 }
39  
40 750 ▶sub get_basic_types {
Subroutine get_basic_types: called CC=9 SCAR=34.1
Pod undocumented
41 0 ▶ my ($self, $options) = @_;
Subroutine get_basic_types: not called CC=9 SCAR=34.1
Pod undocumented
42
43 0 ▶ $options ||= {};
Condition25%1/4
$options ||= {}
l!l
00
$options ||= {}
l!l
7500
MC/DC0%0/1
$options ||= {}
$options
MC/DC0%0/1
$options ||= {}
$options
Truth table0%0/2
A
A= $options
Aresult
11
00
Truth table50%1/2
A
A= $options
Aresult
11
00
44
45 0 my $basic_types_length = $self->get_basic_types_length;
46
47 0 my $basic_types = [];
48
49 0 my $match = 1;
50
51 0 ▶ for (my $id = 0; $id < $basic_types_length; $id++) {
Branch: 2 branches
BranchTrueFalseTotal
if ($id < $basic_types_length) 0 0 0
if ($id < $basic_types_length) 30984 750 31734
52 0 my $basic_type = $self->get_basic_type_by_id($id);
53
54 0 ▶ if (exists $options->{category}) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $options->{"category"}) 0 0 0
if (exists $options->{"category"}) 30984 0 30984
55 0 my $categories = $options->{category};
56
57 0 my $category_match = 0;
58 0 for my $category (@$categories) {
59 0 ▶ if ($basic_type->get_category == $category) {
Branch: 2 branches
BranchTrueFalseTotal
if ($basic_type->get_category == $category) 0 0 0
if ($basic_type->get_category == $category) 22734 51276 74010
60 0 $category_match = 1;
61 0 last;
62 }
63 }
64
65 0 ▶ unless ($category_match) {
Branch: 2 branches
BranchTrueFalseTotal
unless ($category_match) 0 0 0
unless ($category_match) 8250 22734 30984
66 0 next;
67 }
68 }
69
70 0 ▶ if (exists $options->{is_anon}) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $options->{"is_anon"}) 0 0 0
if (exists $options->{"is_anon"}) 0 22734 22734
71 0 my $is_anon = $options->{is_anon};
72
73 0 my $basic_type_name = $basic_type->get_name;
74 0 my $basic_type_is_anon = $basic_type->is_anon;
75
76 0 my $is_anon_match = !!$basic_type->is_anon == !!$is_anon;
77
78 0 ▶ unless ($is_anon_match) {
Branch: 2 branches
BranchTrueFalseTotal
unless ($is_anon_match) 0 0 0
unless ($is_anon_match) 0 0 0
79 0 next;
80 }
81 }
82
83 0 push @$basic_types, $basic_type;
84 }
85
86 0 return $basic_types;
87 }
88  
89 1;
90  
91 =head1 Name
92  
93 SPVM::Builder::Native::Runtime - Runtime
94  
95 =head1 Copyright & License
96  
97 Copyright (c) 2023 Yuki Kimoto
98  
99 MIT License
« blib/lib/SPVM/Builder/API.pm ↑ Summary blib/lib/SPVM/Builder/Config.pm »