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

filter: Statementstmt 56.9% 49 / 86 Branchbran 44.4% 16 / 36 Conditioncond 50.0% 2 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 50.0% 5 / 10 Podpod 0.0% 0 / 8 totaltotal 49.3% 72 / 146 CC 23 SCAR 21.0
CC
23
Cov
53%
get_basic_types
11.4
get_basic_types
11.4
env
6.0
CRAP 8.2
« blib/lib/SPVM/ExchangeAPI.pm ↑ Summary blib/lib/SPVM/Global.pm »
1 package SPVM::Builder::Native::Runtime;
2  
3 754 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 754 ▶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 10 ▶ 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 462 ▶sub get_basic_types {
Subroutine get_basic_types: called CC=9 SCAR=24.3
Pod undocumented
41 0 ▶ my ($self, $options) = @_;
Subroutine get_basic_types: not called CC=9 SCAR=24.3
Pod undocumented
42
43 0 ▶ $options ||= {};
Condition50%2/4
$options ||= {}
l!l
120
$options ||= {}
l!l
4620
MC/DC0%0/1
$options ||= {}
$options
MC/DC0%0/1
$options ||= {}
$options
Truth table50%1/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) 384 12 396
if ($id < $basic_types_length) 16188 462 16650
52 12 my $basic_type = $self->get_basic_type_by_id($id);
53
54 12 ▶ if (exists $options->{category}) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $options->{"category"}) 384 0 384
if (exists $options->{"category"}) 16188 0 16188
55 12 my $categories = $options->{category};
56
57 12 my $category_match = 0;
58 12 for my $category (@$categories) {
59 12 ▶ if ($basic_type->get_category == $category) {
Branch: 2 branches
BranchTrueFalseTotal
if ($basic_type->get_category == $category) 252 684 936
if ($basic_type->get_category == $category) 11106 27876 38982
60 384 $category_match = 1;
61 384 last;
62 }
63 }
64
65 384 ▶ unless ($category_match) {
Branch: 2 branches
BranchTrueFalseTotal
unless ($category_match) 132 252 384
unless ($category_match) 5082 11106 16188
66 384 next;
67 }
68 }
69
70 384 ▶ if (exists $options->{is_anon}) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $options->{"is_anon"}) 0 252 252
if (exists $options->{"is_anon"}) 0 11106 11106
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/ExchangeAPI.pm ↑ Summary blib/lib/SPVM/Global.pm »