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

filter: Statementstmt 76.8% 63 / 82 Branchbran 71.4% 20 / 28 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 66.6% 8 / 12 Podpod 0.0% 0 / 10 totaltotal 68.9% 91 / 132 CC 15 SCAR 11.0
CC
15
Cov
75%
runtime
5.2
runtime
5.2
get_native_method_names
3.1
CRAP 3.0
« blib/lib/SPVM/Builder/ScriptInfo.pm ↑ Summary blib/lib/SPVM/Builder/CommandInfo.pm »
1 package SPVM::Builder::Native::BasicType;
2  
3 867 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 888 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 0 ▶sub pointer {
Subroutine pointer: not called CC=2 SCAR=10.1
Pod undocumented
7 20 ▶ my $self = shift;
Subroutine pointer: called CC=2 SCAR=10.1
Pod undocumented
8 0 ▶ if (@_) {
Branch: 2 branches
BranchTrueFalseTotal
if (@_) { } 0 0 0
if (@_) { } 0 0 0
9 0 $self->{pointer} = $_[0];
10 0 return $self;
11 }
12 else {
13 0 return $self->{pointer};
14 }
15 }
16  
17 0 ▶sub runtime {
Subroutine runtime: not called CC=2 SCAR=16.5
Pod undocumented
18 0 ▶ my $self = shift;
Subroutine runtime: called CC=2 SCAR=16.5
Pod undocumented
19 0 ▶ if (@_) {
Branch: 2 branches
BranchTrueFalseTotal
if (@_) { } 0 0 0
if (@_) { } 0 0 0
20 0 $self->{runtime} = $_[0];
21 0 return $self;
22 }
23 else {
24 0 return $self->{runtime};
25 }
26 }
27  
28 # Private Instance Methods - Only used in core.
29 6586 ▶sub get_native_method_names {
Subroutine get_native_method_names: called CC=3 SCAR=11.3
Pod undocumented
30 0 ▶ my ($self) = @_;
Subroutine get_native_method_names: not called CC=3 SCAR=11.3
Pod undocumented
31
32 0 my $methods_length = $self->get_methods_length;
33
34 0 my $native_method_names = [];
35
36 0 ▶ for (my $method_index = 0; $method_index < $methods_length; $method_index++) {
Branch: 2 branches
BranchTrueFalseTotal
if ($method_index < $methods_length) 1388 124 1512
if ($method_index < $methods_length) 43944 6586 50530
37 0 my $method = $self->get_method_by_index($method_index);
38 0 my $method_name = $method->get_name;
39 124 ▶ if ($method->is_native) {
Branch: 2 branches
BranchTrueFalseTotal
if ($method->is_native) 198 1190 1388
if ($method->is_native) 2178 41766 43944
40 124 push @$native_method_names, $method_name;
41 }
42 }
43
44 124 return $native_method_names;
45 }
46  
47 6586 ▶sub get_precompile_method_names {
Subroutine get_precompile_method_names: called CC=3 SCAR=11.0
Pod undocumented
48 124 ▶ my ($self) = @_;
Subroutine get_precompile_method_names: not called CC=3 SCAR=11.0
Pod undocumented
49
50 1388 my $methods_length = $self->get_methods_length;
51
52 1388 my $precompile_method_names = [];
53
54 1388 ▶ for (my $method_index = 0; $method_index < $methods_length; $method_index++) {
Branch: 2 branches
BranchTrueFalseTotal
if ($method_index < $methods_length) 1388 124 1512
if ($method_index < $methods_length) 43944 6586 50530
55 198 my $method = $self->get_method_by_index($method_index);
56 124 my $method_name = $method->get_name;
57 124 ▶ if ($method->is_precompile) {
Branch: 2 branches
BranchTrueFalseTotal
if ($method->is_precompile) 210 1178 1388
if ($method->is_precompile) 2310 41634 43944
58 124 push @$precompile_method_names, $method_name;
59 }
60 }
61
62 124 return $precompile_method_names;
63 }
64  
65 6646 ▶sub get_class_file {
Subroutine get_class_file: called CC=2 SCAR=6.9
Pod undocumented
66 124 ▶ my ($self) = @_;
Subroutine get_class_file: called CC=2 SCAR=6.9
Pod undocumented
67
68 1388 my $class_dir = $self->get_class_dir;
69
70 1388 my $class_dir_sep;
71 1388 ▶ if (defined $class_dir) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $class_dir) { } 208 21 229
if (defined $class_dir) { } 4084 2562 6646
72 210 $class_dir_sep = "/";
73 }
74 else {
75 124 $class_dir_sep = "";
76 229 $class_dir = "";
77 }
78
79 229 my $class_rel_file = $self->get_class_rel_file;
80
81 229 my $class_file = "$class_dir/$class_rel_file";
82
83 229 return $class_file;
84 }
85  
86 1;
87  
88 =head1 Name
89  
90 SPVM::Builder::Native::BasicType - Basic Type Native APIs
91  
92 =head1 Copyright & License
93  
94 Copyright (c) 2023 Yuki Kimoto
95  
96 MIT License
« blib/lib/SPVM/Builder/ScriptInfo.pm ↑ Summary blib/lib/SPVM/Builder/CommandInfo.pm »