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

filter: Statementstmt 91.0% 364 / 400 Branchbran 72.5% 174 / 240 Conditioncond 55.0% 176 / 320 MC/DCmcdc 21.3% 36 / 169 Subroutinesub 90.1% 55 / 61 Podpod 0.0% 0 / 23 totaltotal 66.3% 805 / 1213 CC 269 SCAR 29.7
CC
269
Cov
74%
_build_slots_for_object
62.2
__ANON__
56.0
_type_kind_name_code
30.2
CRAP 19.4
« blib/lib/GraphQL/Houtou/Runtime/NativeRuntime.pm ↑ Summary blib/lib/GraphQL/Houtou/Federation.pm »
1 package GraphQL::Houtou::Runtime::SchemaGraph;
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  
7 62 ▶use GraphQL::Houtou ();
Subroutine BEGIN: called CC=1 SCAR=0.0
8 62 ▶use GraphQL::Houtou::Runtime::DirectiveRuntime qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
9 slot_needs_runtime_wrapper
10 wrap_field_resolver
11 62 );
12 62 ▶use GraphQL::Houtou::Runtime::OperationCompiler ();
Subroutine BEGIN: called CC=1 SCAR=0.0
13 62 ▶use GraphQL::Houtou::Runtime::SchemaBlock ();
Subroutine BEGIN: called CC=1 SCAR=0.0
14 62 ▶use GraphQL::Houtou::Runtime::Slot ();
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 208 ▶sub compile_schema {
Subroutine compile_schema: called CC=2 SCAR=7.0
Pod undocumented
17 208 my ($class, $schema, %opts) = @_;
18 208 my $runtime_cache = $schema->prepare_runtime;
19  
20 208 ▶ my $type_index = _build_type_index($runtime_cache->{name2type} || {});
Condition50%1/2
$runtime_cache->{'name2type'} || {}
l!l
2080
MC/DC0%0/1
$runtime_cache->{'name2type'} || {}
$runtime_cache->{'name2type'}
Truth table50%1/2
A
A= $runtime_cache->{'name2type'}
Aresult
11
00
21 208 my $dispatch_index = _build_dispatch_index($runtime_cache);
22 208 my ($blocks, $root_blocks, $root_types) = _build_blocks($schema, $runtime_cache);
23 201 my $slot_catalog = _build_slot_catalog($blocks);
24  
25 201 return $class->new(
26 version => 1,
27 schema => $schema,
28 runtime_cache => $runtime_cache,
29 type_index => $type_index,
30 dispatch_index => $dispatch_index,
31 root_types => $root_types,
32 slot_catalog => $slot_catalog,
33 blocks => $blocks,
34 root_blocks => $root_blocks,
35 );
36 }
37  
38 4 ▶sub inflate_schema {
Subroutine inflate_schema: called CC=7 SCAR=21.2
Pod undocumented
39 4 my ($class, $schema, $struct) = @_;
40 4 my $runtime_cache = $schema->prepare_runtime;
41 4 my ($blocks, $root_blocks) = _inflate_blocks($struct);
42 4 ▶ my $slot_catalog = [ map { _inflate_slot($_) } @{ $struct->{slot_catalog} || [] } ];
Condition50%1/2
$struct->{'slot_catalog'} || []
l!l
40
MC/DC0%0/1
$struct->{'slot_catalog'} || []
$struct->{'slot_catalog'}
Truth table50%1/2
A
A= $struct->{'slot_catalog'}
Aresult
11
00
43 4 ▶ _apply_slot_catalog_to_blocks($blocks, $slot_catalog) if @$slot_catalog;
Branch: 1 branch
BranchTrueFalseTotal
if @$slot_catalog 4 0 4
44  
45 return $class->new(
46 version => $struct->{version} || 1,
47 schema => $schema,
48 runtime_cache => $runtime_cache,
49 type_index => $struct->{type_index} || {},
50 dispatch_index => $struct->{dispatch_index} || {},
51 root_types => $struct->{root_types} || {},
52 4 ▶ slot_catalog => $slot_catalog,
Condition50%4/8
$struct->{'version'} || 1
l!l
40
$struct->{'type_index'} || {}
l!l
40
$struct->{'dispatch_index'} || {}
l!l
40
$struct->{'root_types'} || {}
l!l
40
MC/DC0%0/1
$struct->{'version'} || 1
$struct->{'version'}
MC/DC0%0/1
$struct->{'type_index'} || {}
$struct->{'type_index'}
MC/DC0%0/1
$struct->{'dispatch_index'} || {}
$struct->{'dispatch_index'}
MC/DC0%0/1
$struct->{'root_types'} || {}
$struct->{'root_types'}
Truth table50%1/2
A
A= $struct->{'version'}
Aresult
11
00
Truth table50%1/2
A
A= $struct->{'type_index'}
Aresult
11
00
Truth table50%1/2
A
A= $struct->{'dispatch_index'}
Aresult
11
00
Truth table50%1/2
A
A= $struct->{'root_types'}
Aresult
11
00
53 blocks => $blocks,
54 root_blocks => $root_blocks,
55 );
56 }
57  
58 205 ▶sub new {
Subroutine new: called CC=9 SCAR=27.8
Pod undocumented
59 205 my ($class, %args) = @_;
60 return bless {
61 version => $args{version} || 1,
62 schema => $args{schema},
63 runtime_cache => $args{runtime_cache} || {},
64 type_index => $args{type_index} || {},
65 dispatch_index => $args{dispatch_index} || {},
66 root_types => $args{root_types} || {},
67 slot_catalog => $args{slot_catalog} || [],
68 blocks => $args{blocks} || [],
69 root_blocks => $args{root_blocks} || {},
70 205 ▶ }, $class;
Condition50%8/16
$args{'version'} || 1
l!l
2050
$args{'runtime_cache'} || {}
l!l
2050
$args{'type_index'} || {}
l!l
2050
$args{'dispatch_index'} || {}
l!l
2050
$args{'root_types'} || {}
l!l
2050
$args{'slot_catalog'} || []
l!l
2050
$args{'blocks'} || []
l!l
2050
$args{'root_blocks'} || {}
l!l
2050
MC/DC0%0/1
$args{'version'} || 1
$args{'version'}
MC/DC0%0/1
$args{'runtime_cache'} || {}
$args{'runtime_cache'}
MC/DC0%0/1
$args{'type_index'} || {}
$args{'type_index'}
MC/DC0%0/1
$args{'dispatch_index'} || {}
$args{'dispatch_index'}
MC/DC0%0/1
$args{'root_types'} || {}
$args{'root_types'}
MC/DC0%0/1
$args{'slot_catalog'} || []
$args{'slot_catalog'}
MC/DC0%0/1
$args{'blocks'} || []
$args{'blocks'}
MC/DC0%0/1
$args{'root_blocks'} || {}
$args{'root_blocks'}
Truth table50%1/2
A
A= $args{'version'}
Aresult
11
00
Truth table50%1/2
A
A= $args{'runtime_cache'}
Aresult
11
00
Truth table50%1/2
A
A= $args{'type_index'}
Aresult
11
00
Truth table50%1/2
A
A= $args{'dispatch_index'}
Aresult
11
00
Truth table50%1/2
A
A= $args{'root_types'}
Aresult
11
00
Truth table50%1/2
A
A= $args{'slot_catalog'}
Aresult
11
00
Truth table50%1/2
A
A= $args{'blocks'}
Aresult
11
00
Truth table50%1/2
A
A= $args{'root_blocks'}
Aresult
11
00
71 }
72  
73 0 ▶sub version { return $_[0]{version} }
Subroutine version: not called CC=1 SCAR=6.9
Pod undocumented
74 869 ▶sub schema { return $_[0]{schema} }
Subroutine schema: called CC=1 SCAR=0.0
Pod undocumented
75 117 ▶sub runtime_cache { return $_[0]{runtime_cache} }
Subroutine runtime_cache: called CC=1 SCAR=0.0
Pod undocumented
76 7 ▶sub type_index { return $_[0]{type_index} }
Subroutine type_index: called CC=1 SCAR=0.0
Pod undocumented
77 3 ▶sub dispatch_index { return $_[0]{dispatch_index} }
Subroutine dispatch_index: called CC=1 SCAR=0.0
Pod undocumented
78 2 ▶sub root_types { return $_[0]{root_types} }
Subroutine root_types: called CC=1 SCAR=0.0
Pod undocumented
79 12 ▶sub slot_catalog { return $_[0]{slot_catalog} }
Subroutine slot_catalog: called CC=1 SCAR=0.0
Pod undocumented
80 0 ▶sub blocks { return $_[0]{blocks} }
Subroutine blocks: not called CC=1 SCAR=6.9
Pod undocumented
81 0 ▶sub root_blocks { return $_[0]{root_blocks} }
Subroutine root_blocks: not called CC=1 SCAR=6.9
Pod undocumented
82  
83 1 ▶sub slot_by_index {
Subroutine slot_by_index: called CC=2 SCAR=7.1
Pod undocumented
84 1 my ($self, $index) = @_;
85 1 ▶ return if !defined $index;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $index 0 1 1
86 1 return $self->{slot_catalog}[$index];
87 }
88  
89 410 ▶sub root_block {
Subroutine root_block: called CC=1 SCAR=0.0
Pod undocumented
90 410 my ($self, $name) = @_;
91 410 return $self->{root_blocks}{$name};
92 }
93  
94 706 ▶sub block_by_type_name {
Subroutine block_by_type_name: called CC=6 SCAR=18.4
Pod undocumented
95 706 my ($self, $type_name) = @_;
96 706 ▶ return if !defined $type_name;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $type_name 0 706 706
97 706 ▶ for my $block (@{ $self->{blocks} || [] }) {
Condition50%1/2
$self->{'blocks'} || []
l!l
7060
MC/DC0%0/1
$self->{'blocks'} || []
$self->{'blocks'}
Truth table50%1/2
A
A= $self->{'blocks'}
Aresult
11
00
98 4472 ▶ next if !defined $block->root_type_name;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $block->root_type_name 0 4472 4472
99 4472 ▶ return $block if $block->root_type_name eq $type_name;
Branch: 1 branch
BranchTrueFalseTotal
if $block->root_type_name eq $type_name 666 3806 4472
100 }
101 40 return;
102 }
103  
104 395 ▶sub compile_program {
Subroutine compile_program: called CC=1 SCAR=0.0
Pod undocumented
105 395 my ($self, $document, %opts) = @_;
106 395 GraphQL::Houtou::_bootstrap_xs();
107 395 return GraphQL::Houtou::XS::VM::load_native_program_xs(
108 $self->_compile_native_program_descriptor($document, %opts),
109 );
110 }
111  
112 14 ▶sub compile_program_descriptor {
Subroutine compile_program_descriptor: called CC=1 SCAR=0.0
Pod undocumented
113 14 my ($self, $document, %opts) = @_;
114 14 return $self->_compile_native_program_descriptor($document, %opts);
115 }
116  
117 7 ▶sub inflate_program {
Subroutine inflate_program: called CC=1 SCAR=0.0
Pod undocumented
118 7 my ($self, $descriptor) = @_;
119 7 GraphQL::Houtou::Runtime::OperationCompiler::assert_supported_operation_descriptor(
120 $descriptor,
121 );
122 6 GraphQL::Houtou::_bootstrap_xs();
123 6 return GraphQL::Houtou::XS::VM::load_native_program_xs($descriptor);
124 }
125  
126 9 ▶sub execute_program {
Subroutine execute_program: called CC=1 SCAR=0.0
Pod undocumented
127 9 my ($self, $program, %opts) = @_;
128 9 return $self->_native_runtime->execute_program($program, %opts);
129 }
130  
131 9 ▶sub _native_runtime {
Subroutine _native_runtime: called CC=2 SCAR=6.9
132 9 my ($self) = @_;
133 9 ▶ return $self->{_compiled_native_runtime} if $self->{_compiled_native_runtime};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"_compiled_native_runtime"} 4 5 9
134 5 require GraphQL::Houtou::Runtime::NativeRuntime;
135 5 return $self->{_compiled_native_runtime} = GraphQL::Houtou::Runtime::NativeRuntime->new(
136 runtime_schema => $self,
137 );
138 }
139  
140 409 ▶sub _compile_native_program_descriptor {
Subroutine _compile_native_program_descriptor: called CC=1 SCAR=0.0
141 409 my ($self, $document, %opts) = @_;
142 409 return GraphQL::Houtou::Runtime::OperationCompiler->compile_operation_native_compact(
143 $self,
144 $document,
145 %opts,
146 );
147 }
148  
149 8 ▶sub to_struct {
Subroutine to_struct: called CC=8 SCAR=22.2
Pod undocumented
150 8 my ($self) = @_;
151 return {
152 version => $self->{version},
153 8 ▶ root_types => { %{ $self->{root_types} || {} } },
Condition50%1/2
$self->{'root_types'} || {}
l!l
80
MC/DC0%0/1
$self->{'root_types'} || {}
$self->{'root_types'}
Truth table50%1/2
A
A= $self->{'root_types'}
Aresult
11
00
154 8 ▶ type_index => { %{ $self->{type_index} || {} } },
Condition50%1/2
$self->{'type_index'} || {}
l!l
80
MC/DC0%0/1
$self->{'type_index'} || {}
$self->{'type_index'}
Truth table50%1/2
A
A= $self->{'type_index'}
Aresult
11
00
155 8 ▶ dispatch_index => { %{ $self->{dispatch_index} || {} } },
Condition50%1/2
$self->{'dispatch_index'} || {}
l!l
80
MC/DC0%0/1
$self->{'dispatch_index'} || {}
$self->{'dispatch_index'}
Truth table50%1/2
A
A= $self->{'dispatch_index'}
Aresult
11
00
156 432 ▶ slot_catalog => [ map { $_->to_struct } @{ $self->{slot_catalog} || [] } ],
Condition50%1/2
$self->{'slot_catalog'} || []
l!l
80
MC/DC0%0/1
$self->{'slot_catalog'} || []
$self->{'slot_catalog'}
Truth table50%1/2
A
A= $self->{'slot_catalog'}
Aresult
11
00
157 64 ▶ blocks => [ map { $_->to_struct } @{ $self->{blocks} || [] } ],
Condition50%1/2
$self->{'blocks'} || []
l!l
80
MC/DC0%0/1
$self->{'blocks'} || []
$self->{'blocks'}
Truth table50%1/2
A
A= $self->{'blocks'}
Aresult
11
00
158 root_blocks => {
159 map {
160 8 my $block = $self->{root_blocks}{$_};
161 8 ▶ ($_ => ($block ? $block->name : undef));
Branch: 1 branch
BranchTrueFalseTotal
$block ? : 8 0 8
162 8 ▶ } keys %{ $self->{root_blocks} || {} }
Condition50%1/2
$self->{'root_blocks'} || {}
l!l
80
MC/DC0%0/1
$self->{'root_blocks'} || {}
$self->{'root_blocks'}
Truth table50%1/2
A
A= $self->{'root_blocks'}
Aresult
11
00
163 },
164 };
165 }
166  
167 4 ▶sub to_native_struct {
Subroutine to_native_struct: called CC=7 SCAR=20.6
Pod undocumented
168 4 my ($self) = @_;
169 return {
170 version => $self->{version},
171 4 ▶ root_types => { %{ $self->{root_types} || {} } },
Condition50%1/2
$self->{'root_types'} || {}
l!l
40
MC/DC0%0/1
$self->{'root_types'} || {}
$self->{'root_types'}
Truth table50%1/2
A
A= $self->{'root_types'}
Aresult
11
00
172 type_index => {
173 map {
174 67 ▶ my $entry = $self->{type_index}{$_} || {};
Condition50%1/2
$self->{'type_index'}{$_} || {}
l!l
670
MC/DC0%0/1
$self->{'type_index'}{$_} || {}
$self->{'type_index'}{$_}
Truth table50%1/2
A
A= $self->{'type_index'}{$_}
Aresult
11
00
175 ($_ => {
176 %$entry,
177 kind_code => _type_kind_name_code($entry->{kind}),
178 67 completion_family_code => _family_code($entry->{completion_family}),
179 });
180 4 ▶ } keys %{ $self->{type_index} || {} }
Condition50%1/2
$self->{'type_index'} || {}
l!l
40
MC/DC0%0/1
$self->{'type_index'} || {}
$self->{'type_index'}
Truth table50%1/2
A
A= $self->{'type_index'}
Aresult
11
00
181 },
182 dispatch_index => {
183 map {
184 6 ▶ my $entry = $self->{dispatch_index}{$_} || {};
Condition50%1/2
$self->{'dispatch_index'}{$_} || {}
l!l
60
MC/DC0%0/1
$self->{'dispatch_index'}{$_} || {}
$self->{'dispatch_index'}{$_}
Truth table50%1/2
A
A= $self->{'dispatch_index'}{$_}
Aresult
11
00
185 ($_ => {
186 %$entry,
187 6 dispatch_family_code => _dispatch_family_code($entry->{dispatch_family}),
188 });
189 4 ▶ } keys %{ $self->{dispatch_index} || {} }
Condition50%1/2
$self->{'dispatch_index'} || {}
l!l
40
MC/DC0%0/1
$self->{'dispatch_index'} || {}
$self->{'dispatch_index'}
Truth table50%1/2
A
A= $self->{'dispatch_index'}
Aresult
11
00
190 },
191 4 ▶ slot_catalog => [ map { $_->to_native_struct } @{ $self->{slot_catalog} || [] } ],
Condition50%1/2
$self->{'slot_catalog'} || []
l!l
40
MC/DC0%0/1
$self->{'slot_catalog'} || []
$self->{'slot_catalog'}
Truth table50%1/2
A
A= $self->{'slot_catalog'}
Aresult
11
00
192 };
193 }
194  
195 264 ▶sub to_native_compact_struct {
Subroutine to_native_compact_struct: called CC=7 SCAR=20.6
Pod undocumented
196 264 my ($self) = @_;
197 return {
198 version => $self->{version},
199 264 ▶ root_types => { %{ $self->{root_types} || {} } },
Condition50%1/2
$self->{'root_types'} || {}
l!l
2640
MC/DC0%0/1
$self->{'root_types'} || {}
$self->{'root_types'}
Truth table50%1/2
A
A= $self->{'root_types'}
Aresult
11
00
200 type_index => {
201 map {
202 4186 ▶ my $entry = $self->{type_index}{$_} || {};
Condition50%1/2
$self->{'type_index'}{$_} || {}
l!l
41860
MC/DC0%0/1
$self->{'type_index'}{$_} || {}
$self->{'type_index'}{$_}
Truth table50%1/2
A
A= $self->{'type_index'}{$_}
Aresult
11
00
203 ($_ => {
204 %$entry,
205 kind_code => _type_kind_name_code($entry->{kind}),
206 4186 completion_family_code => _family_code($entry->{completion_family}),
207 });
208 264 ▶ } keys %{ $self->{type_index} || {} }
Condition50%1/2
$self->{'type_index'} || {}
l!l
2640
MC/DC0%0/1
$self->{'type_index'} || {}
$self->{'type_index'}
Truth table50%1/2
A
A= $self->{'type_index'}
Aresult
11
00
209 },
210 dispatch_index => {
211 map {
212 45 ▶ my $entry = $self->{dispatch_index}{$_} || {};
Condition50%1/2
$self->{'dispatch_index'}{$_} || {}
l!l
450
MC/DC0%0/1
$self->{'dispatch_index'}{$_} || {}
$self->{'dispatch_index'}{$_}
Truth table50%1/2
A
A= $self->{'dispatch_index'}{$_}
Aresult
11
00
213 ($_ => {
214 %$entry,
215 45 dispatch_family_code => _dispatch_family_code($entry->{dispatch_family}),
216 });
217 264 ▶ } keys %{ $self->{dispatch_index} || {} }
Condition50%1/2
$self->{'dispatch_index'} || {}
l!l
2640
MC/DC0%0/1
$self->{'dispatch_index'} || {}
$self->{'dispatch_index'}
Truth table50%1/2
A
A= $self->{'dispatch_index'}
Aresult
11
00
218 },
219 264 ▶ slot_catalog_compact => [ map { $_->to_native_compact_struct } @{ $self->{slot_catalog} || [] } ],
Condition50%1/2
$self->{'slot_catalog'} || []
l!l
2640
MC/DC0%0/1
$self->{'slot_catalog'} || []
$self->{'slot_catalog'}
Truth table50%1/2
A
A= $self->{'slot_catalog'}
Aresult
11
00
220 };
221 }
222  
223 243 ▶sub to_native_exec_struct {
Subroutine to_native_exec_struct: called CC=6 SCAR=18.2
Pod undocumented
224 243 my ($self) = @_;
225 243 my $struct = $self->to_native_compact_struct;
226 243 ▶ $struct->{slot_catalog_exec} = [ map { $_->to_native_exec_struct } @{ $self->{slot_catalog} || [] } ];
Condition50%1/2
$self->{'slot_catalog'} || []
l!l
2430
MC/DC0%0/1
$self->{'slot_catalog'} || []
$self->{'slot_catalog'}
Truth table50%1/2
A
A= $self->{'slot_catalog'}
Aresult
11
00
227 243 ▶ $struct->{slot_resolvers} = [ map { _slot_resolver($self, $_) } @{ $self->{slot_catalog} || [] } ];
Condition50%1/2
$self->{'slot_catalog'} || []
l!l
2430
MC/DC0%0/1
$self->{'slot_catalog'} || []
$self->{'slot_catalog'}
Truth table50%1/2
A
A= $self->{'slot_catalog'}
Aresult
11
00
228 $struct->{slot_loader_specs} = [
229 13155 ▶ map { $_ && $_->loader ? $_->loader : undef }
Branch: 1 branch
BranchTrueFalseTotal
$_ && $_->loader ? : 9 13146 13155
Condition66%2/3
$_ and $_->loader
!ll&&!rl&&r
0131469
MC/DC50%1/2
$_ and $_->loader
$_ $_->loader
Truth table66%2/3
A and B
A= $_B= $_->loader
ABresult
0X0
100
111
230 243 ▶ @{ $self->{slot_catalog} || [] }
Condition50%1/2
$self->{'slot_catalog'} || []
l!l
2430
MC/DC0%0/1
$self->{'slot_catalog'} || []
$self->{'slot_catalog'}
Truth table50%1/2
A
A= $self->{'slot_catalog'}
Aresult
11
00
231 ];
232 243 $struct->{runtime_cache} = $self->{runtime_cache};
233 243 $struct->{schema} = $self->{schema};
234 243 return $struct;
235 }
236  
237 13155 ▶sub _slot_resolver {
Subroutine _slot_resolver: called CC=19 SCAR=32.5
238 13155 my ($self, $slot) = @_;
239 13155 ▶ return undef if !$slot;
Branch: 1 branch
BranchTrueFalseTotal
unless $slot 0 13155 13155
240 13155 ▶ return undef if ($slot->resolver_shape || q()) ne 'EXPLICIT';
Branch: 1 branch
BranchTrueFalseTotal
if ($slot->resolver_shape || "") ne "EXPLICIT" 4585 8570 13155
Condition50%1/2
$slot->resolver_shape || ''
l!l
131550
MC/DC0%0/1
$slot->resolver_shape || ''
$slot->resolver_shape
Truth table50%1/2
A
A= $slot->resolver_shape
Aresult
11
00
241  
242 8570 my $key = $slot->schema_slot_key;
243 8570 ▶ return undef if !defined $key || $key eq q();
Branch: 1 branch
BranchTrueFalseTotal
if not defined $key or $key eq "" 0 8570 8570
Condition33%1/3
not defined $key or $key eq ""
l!l&&r!l&&!r
008570
MC/DC0%0/2
not defined $key or $key eq ""
not defined $key $key eq ""
Truth table33%1/3
not(A) or B
A= not defined $keyB= $key eq ""
ABresult
1X1
011
000
244  
245 8570 my ($type_name, $field_name) = $key =~ /\A(.+)\.([^.]+)\z/;
246 8570 ▶ return undef if !defined $type_name || !defined $field_name;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $type_name and defined $field_name 0 8570 8570
Condition33%1/3
defined $type_name and defined $field_name
!ll&&!rl&&r
008570
MC/DC0%0/2
defined $type_name and defined $field_name
defined $type_name defined $field_name
Truth table33%1/3
A and B
A= defined $type_nameB= defined $field_name
ABresult
0X0
100
111
247  
248 8570 ▶ if ($field_name eq '__schema' || $field_name eq '__type') {
Branch: 1 branch
BranchTrueFalseTotal
if ($field_name eq "__schema" or $field_name eq "__type") 486 8084 8570
Condition100%3/3
$field_name eq "__schema" or $field_name eq "__type"
l!l&&r!l&&!r
2432438084
MC/DC100%2/2
$field_name eq "__schema" or $field_name eq "__type"
$field_name eq "__schema" $field_name eq "__type"
Truth table100%3/3
A or B
A= $field_name eq "__schema"B= $field_name eq "__type"
ABresult
1X1
011
000
249 486 require GraphQL::Houtou::Introspection;
250 return $field_name eq '__schema'
251 ? wrap_field_resolver(
252 schema => $self->{schema},
253 field_name => '__schema',
254 field => $GraphQL::Houtou::Introspection::SCHEMA_META_FIELD_DEF,
255 resolver => $GraphQL::Houtou::Introspection::SCHEMA_META_FIELD_DEF->{resolve},
256 )
257 : wrap_field_resolver(
258 schema => $self->{schema},
259 field_name => '__type',
260 field => $GraphQL::Houtou::Introspection::TYPE_META_FIELD_DEF,
261 resolver => $GraphQL::Houtou::Introspection::TYPE_META_FIELD_DEF->{resolve},
262 486 ▶ );
Branch: 1 branch
BranchTrueFalseTotal
$field_name eq '__schema' ? : 243 243 486
263 }
264  
265 8084 ▶ if ($field_name eq '__typename') {
Branch: 1 branch
BranchTrueFalseTotal
if ($field_name eq "__typename") 0 8084 8084
266 0 return undef;
267 }
268  
269 8084 ▶ my $type = ($self->{runtime_cache}{name2type} || {})->{$type_name};
Condition50%1/2
$self->{'runtime_cache'}{'name2type'} || {}
l!l
80840
MC/DC0%0/1
$self->{'runtime_cache'}{'name2type'} || {}
$self->{'runtime_cache'}{'name2type'}
Truth table50%1/2
A
A= $self->{'runtime_cache'}{'name2type'}
Aresult
11
00
270 8084 ▶ return undef if !$type || !$type->can('fields');
Branch: 1 branch
BranchTrueFalseTotal
unless $type and $type->can("fields") 0 8084 8084
Condition33%1/3
$type and $type->can("fields")
!ll&&!rl&&r
008084
MC/DC0%0/2
$type and $type->can("fields")
$type $type->can("fields")
Truth table33%1/3
A and B
A= $typeB= $type->can("fields")
ABresult
0X0
100
111
271  
272 8084 ▶ my $field = ($type->fields || {})->{$field_name};
Condition50%1/2
$type->fields || {}
l!l
80840
MC/DC0%0/1
$type->fields || {}
$type->fields
Truth table50%1/2
A
A= $type->fields
Aresult
11
00
273 8084 ▶ return undef if ref($field) ne 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
if ref $field ne "HASH" 0 8084 8084
274  
275 return _loader_resolver($field->{loader})
276 8084 ▶ if $field->{loader};
Branch: 1 branch
BranchTrueFalseTotal
if $field->{"loader"} 9 8075 8084
277  
278 my $wrapped = slot_needs_runtime_wrapper(
279 schema => $self->{schema},
280 8075 field => $field,
281 );
282 8075 ▶ return $field->{resolve} if !$wrapped;
Branch: 1 branch
BranchTrueFalseTotal
unless $wrapped 8073 2 8075
283  
284 return wrap_field_resolver(
285 schema => $self->{schema},
286 field_name => $field_name,
287 field => $field,
288 resolver => $field->{resolve},
289 2 );
290 }
291  
292 0 ▶sub _loader_value {
Subroutine _loader_value: not called CC=4 SCAR=30.0
293 0 my ($spec, $source, $args) = @_;
294 0 ▶ if (exists $spec->{source_key}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $spec->{"source_key"}) 0 0 0
295 0 ▶ return undef if ref($source) ne 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
if ref $source ne "HASH" 0 0 0
296 0 return $source->{ $spec->{source_key} };
297 }
298 0 ▶ return undef if ref($args) ne 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
if ref $args ne "HASH" 0 0 0
299 0 return $args->{ $spec->{argument} };
300 }
301  
302 9 ▶sub _loader_resolver {
Subroutine _loader_resolver: called CC=2 SCAR=13.5
303 9 my ($spec) = @_;
304 9 my $key_spec = $spec->{key};
305 9 ▶ if (exists $spec->{context_key}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $spec->{"context_key"}) 7 2 9
306 7 my $context_key = $spec->{context_key};
307 0 ▶ return sub {
Subroutine __ANON__: not called CC=5 SCAR=34.0
308 0 my ($source, $args, $context) = @_;
309 0 ▶ my $loader = ref($context) eq 'HASH' ? $context->{$context_key} : undef;
Branch: 1 branch
BranchTrueFalseTotal
ref $context eq 'HASH' ? : 0 0 0
310 0 ▶ die "loader '$context_key' is not available in the request context\n"
Branch: 1 branch
BranchTrueFalseTotal
unless $loader and $loader->can("load") 0 0 0
Condition0%0/3
$loader and $loader->can("load")
!ll&&!rl&&r
000
MC/DC0%0/2
$loader and $loader->can("load")
$loader $loader->can("load")
Truth table0%0/3
A and B
A= $loaderB= $loader->can("load")
ABresult
0X0
100
111
311 if !$loader || !$loader->can('load');
312 0 my $key = _loader_value($key_spec, $source, $args);
313 0 ▶ die "loader key for '$context_key' is undefined\n" if !defined $key;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $key 0 0 0
314 0 return $loader->load($key);
315 7 };
316 }
317  
318 2 my $router_spec = $spec->{router};
319 2 my $router_context_key = $router_spec->{context_key};
320 2 my $route_key_spec = $router_spec->{route_key};
321 0 ▶ return sub {
Subroutine __ANON__: not called CC=7 SCAR=40.3
322 0 my ($source, $args, $context) = @_;
323 my $router = ref($context) eq 'HASH'
324 0 ▶ ? $context->{$router_context_key} : undef;
Branch: 1 branch
BranchTrueFalseTotal
ref $context eq 'HASH' ? : 0 0 0
325 0 ▶ die "loader router '$router_context_key' is not available in the request context\n"
Branch: 1 branch
BranchTrueFalseTotal
if ref $router ne "HASH" 0 0 0
326 if ref($router) ne 'HASH';
327 0 my $route_key = _loader_value($route_key_spec, $source, $args);
328 0 ▶ die "loader route key for '$router_context_key' is undefined\n"
Branch: 1 branch
BranchTrueFalseTotal
unless defined $route_key 0 0 0
329 if !defined $route_key;
330 0 my $loader = $router->{$route_key};
331 0 ▶ die "loader route '$route_key' is not registered in '$router_context_key'\n"
Branch: 1 branch
BranchTrueFalseTotal
unless $loader and $loader->can("load") 0 0 0
Condition0%0/3
$loader and $loader->can("load")
!ll&&!rl&&r
000
MC/DC0%0/2
$loader and $loader->can("load")
$loader $loader->can("load")
Truth table0%0/3
A and B
A= $loaderB= $loader->can("load")
ABresult
0X0
100
111
332 if !$loader || !$loader->can('load');
333 0 my $key = _loader_value($key_spec, $source, $args);
334 0 ▶ die "loader key for route '$route_key' is undefined\n" if !defined $key;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $key 0 0 0
335 0 return $loader->load($key);
336 2 };
337 }
338  
339 4253 ▶sub _type_kind_name_code {
Subroutine _type_kind_name_code: called CC=17 SCAR=34.1
340 4253 my ($kind) = @_;
341 4253 ▶ return 1 if ($kind || q()) eq 'SCALAR';
Branch: 1 branch
BranchTrueFalseTotal
if ($kind || "") eq "SCALAR" 1382 2871 4253
Condition50%1/2
$kind || ''
l!l
42530
MC/DC0%0/1
$kind || ''
$kind
Truth table50%1/2
A
A= $kind
Aresult
11
00
342 2871 ▶ return 2 if ($kind || q()) eq 'OBJECT';
Branch: 1 branch
BranchTrueFalseTotal
if ($kind || "") eq "OBJECT" 2234 637 2871
Condition50%1/2
$kind || ''
l!l
28710
MC/DC0%0/1
$kind || ''
$kind
Truth table50%1/2
A
A= $kind
Aresult
11
00
343 637 ▶ return 3 if ($kind || q()) eq 'LIST';
Branch: 1 branch
BranchTrueFalseTotal
if ($kind || "") eq "LIST" 0 637 637
Condition50%1/2
$kind || ''
l!l
6370
MC/DC0%0/1
$kind || ''
$kind
Truth table50%1/2
A
A= $kind
Aresult
11
00
344 637 ▶ return 4 if ($kind || q()) eq 'INTERFACE';
Branch: 1 branch
BranchTrueFalseTotal
if ($kind || "") eq "INTERFACE" 31 606 637
Condition50%1/2
$kind || ''
l!l
6370
MC/DC0%0/1
$kind || ''
$kind
Truth table50%1/2
A
A= $kind
Aresult
11
00
345 606 ▶ return 5 if ($kind || q()) eq 'UNION';
Branch: 1 branch
BranchTrueFalseTotal
if ($kind || "") eq "UNION" 20 586 606
Condition50%1/2
$kind || ''
l!l
6060
MC/DC0%0/1
$kind || ''
$kind
Truth table50%1/2
A
A= $kind
Aresult
11
00
346 586 ▶ return 6 if ($kind || q()) eq 'ENUM';
Branch: 1 branch
BranchTrueFalseTotal
if ($kind || "") eq "ENUM" 558 28 586
Condition50%1/2
$kind || ''
l!l
5860
MC/DC0%0/1
$kind || ''
$kind
Truth table50%1/2
A
A= $kind
Aresult
11
00
347 28 ▶ return 7 if ($kind || q()) eq 'INPUT_OBJECT';
Branch: 1 branch
BranchTrueFalseTotal
if ($kind || "") eq "INPUT_OBJECT" 28 0 28
Condition50%1/2
$kind || ''
l!l
280
MC/DC0%0/1
$kind || ''
$kind
Truth table50%1/2
A
A= $kind
Aresult
11
00
348 0 ▶ return 8 if ($kind || q()) eq 'NON_NULL';
Branch: 1 branch
BranchTrueFalseTotal
if ($kind || "") eq "NON_NULL" 0 0 0
Condition0%0/2
$kind || ''
l!l
00
MC/DC0%0/1
$kind || ''
$kind
Truth table0%0/2
A
A= $kind
Aresult
11
00
349 0 return 0;
350 }
351  
352 4253 ▶sub _family_code {
Subroutine _family_code: called CC=7 SCAR=20.3
353 4253 my ($family) = @_;
354 4253 ▶ return 2 if ($family || q()) eq 'OBJECT';
Branch: 1 branch
BranchTrueFalseTotal
if ($family || "") eq "OBJECT" 2234 2019 4253
Condition50%1/2
$family || ''
l!l
42530
MC/DC0%0/1
$family || ''
$family
Truth table50%1/2
A
A= $family
Aresult
11
00
355 2019 ▶ return 3 if ($family || q()) eq 'LIST';
Branch: 1 branch
BranchTrueFalseTotal
if ($family || "") eq "LIST" 0 2019 2019
Condition50%1/2
$family || ''
l!l
20190
MC/DC0%0/1
$family || ''
$family
Truth table50%1/2
A
A= $family
Aresult
11
00
356 2019 ▶ return 4 if ($family || q()) eq 'ABSTRACT';
Branch: 1 branch
BranchTrueFalseTotal
if ($family || "") eq "ABSTRACT" 51 1968 2019
Condition50%1/2
$family || ''
l!l
20190
MC/DC0%0/1
$family || ''
$family
Truth table50%1/2
A
A= $family
Aresult
11
00
357 1968 return 1;
358 }
359  
360 51 ▶sub _dispatch_family_code {
Subroutine _dispatch_family_code: called CC=7 SCAR=21.1
361 51 my ($family) = @_;
362 51 ▶ return 2 if ($family || q()) eq 'RESOLVE_TYPE';
Branch: 1 branch
BranchTrueFalseTotal
if ($family || "") eq "RESOLVE_TYPE" 9 42 51
Condition50%1/2
$family || ''
l!l
510
MC/DC0%0/1
$family || ''
$family
Truth table50%1/2
A
A= $family
Aresult
11
00
363 42 ▶ return 3 if ($family || q()) eq 'TAG';
Branch: 1 branch
BranchTrueFalseTotal
if ($family || "") eq "TAG" 39 3 42
Condition50%1/2
$family || ''
l!l
420
MC/DC0%0/1
$family || ''
$family
Truth table50%1/2
A
A= $family
Aresult
11
00
364 3 ▶ return 4 if ($family || q()) eq 'POSSIBLE_TYPES';
Branch: 1 branch
BranchTrueFalseTotal
if ($family || "") eq "POSSIBLE_TYPES" 3 0 3
Condition50%1/2
$family || ''
l!l
30
MC/DC0%0/1
$family || ''
$family
Truth table50%1/2
A
A= $family
Aresult
11
00
365 0 return 1;
366 }
367  
368 208 ▶sub _build_type_index {
Subroutine _build_type_index: called CC=5 SCAR=16.3
369 208 my ($name2type) = @_;
370 208 my %index;
371  
372 208 ▶ for my $name (sort keys %{$name2type || {}}) {
Condition50%1/2
$name2type || {}
l!l
2080
MC/DC0%0/1
$name2type || {}
$name2type
Truth table50%1/2
A
A= $name2type
Aresult
11
00
373 3351 ▶ my $type = $name2type->{$name} or next;
Branch: 1 branch
BranchTrueFalseTotal
my $type = $name2type->{$name} or next 3351 0 3351
374 3351 ▶ $index{$name} = {
Branch: 1 branch
BranchTrueFalseTotal
$type->can('runtime_tag') ? : 1762 1589 3351
375 kind => _type_kind($type),
376 completion_family => _completion_family_for_type($type),
377 runtime_tag => ($type->can('runtime_tag') ? $type->runtime_tag : undef),
378 };
379 }
380  
381 208 return \%index;
382 }
383  
384 208 ▶sub _build_dispatch_index {
Subroutine _build_dispatch_index: called CC=8 SCAR=21.1
385 208 my ($runtime_cache) = @_;
386 208 my %dispatch;
387  
388 208 ▶ for my $name (sort keys %{ $runtime_cache->{resolve_type_map} || {} }) {
Condition50%1/2
$runtime_cache->{'resolve_type_map'} || {}
l!l
2080
MC/DC0%0/1
$runtime_cache->{'resolve_type_map'} || {}
$runtime_cache->{'resolve_type_map'}
Truth table50%1/2
A
A= $runtime_cache->{'resolve_type_map'}
Aresult
11
00
389 12 $dispatch{$name}{dispatch_family} = 'RESOLVE_TYPE';
390 }
391 208 ▶ for my $name (sort keys %{ $runtime_cache->{tag_resolver_map} || {} }) {
Condition50%1/2
$runtime_cache->{'tag_resolver_map'} || {}
l!l
2080
MC/DC0%0/1
$runtime_cache->{'tag_resolver_map'} || {}
$runtime_cache->{'tag_resolver_map'}
Truth table50%1/2
A
A= $runtime_cache->{'tag_resolver_map'}
Aresult
11
00
392 53 $dispatch{$name}{dispatch_family} = 'TAG';
393 }
394 208 ▶ for my $name (sort keys %{ $runtime_cache->{possible_types} || {} }) {
Condition50%1/2
$runtime_cache->{'possible_types'} || {}
l!l
2080
MC/DC0%0/1
$runtime_cache->{'possible_types'} || {}
$runtime_cache->{'possible_types'}
Truth table50%1/2
A
A= $runtime_cache->{'possible_types'}
Aresult
11
00
395 65 ▶ $dispatch{$name}{dispatch_family} ||= 'POSSIBLE_TYPES';
Condition100%2/2
$dispatch{$name}{"dispatch_family"} ||= "POSSIBLE_TYPES"
l!l
614
MC/DC100%1/1
$dispatch{$name}{"dispatch_family"} ||= "POSSIBLE_TYPES"
$dispatch{$name}{"dispatch_family"}
Truth table100%2/2
A
A= $dispatch{$name}{"dispatch_family"}
Aresult
11
00
396 }
397  
398 208 return \%dispatch;
399 }
400  
401 208 ▶sub _build_blocks {
Subroutine _build_blocks: called CC=9 SCAR=22.1
402 208 my ($schema, $runtime_cache) = @_;
403 208 my @blocks;
404 my %root_blocks;
405 208 my %root_types;
406 208 my %blocks_by_type;
407  
408 208 ▶ for my $type_name (sort keys %{ $runtime_cache->{name2type} || {} }) {
Condition50%1/2
$runtime_cache->{'name2type'} || {}
l!l
2080
MC/DC0%0/1
$runtime_cache->{'name2type'} || {}
$runtime_cache->{'name2type'}
Truth table50%1/2
A
A= $runtime_cache->{'name2type'}
Aresult
11
00
409 3289 ▶ my $type = $runtime_cache->{name2type}{$type_name} or next;
Branch: 1 branch
BranchTrueFalseTotal
my $type = $runtime_cache->{"name2type"}{$type_name} or next 3289 0 3289
410 3289 ▶ next if !$type->isa('GraphQL::Houtou::Type::Object');
Branch: 1 branch
BranchTrueFalseTotal
unless $type->isa("GraphQL::Houtou::Type::Object") 1569 1720 3289
411 1720 my $block = GraphQL::Houtou::Runtime::SchemaBlock->new(
412 name => uc($type_name),
413 family => 'OBJECT',
414 root_type_name => $type->name,
415 slots => _build_slots_for_object($schema, $type),
416 );
417 1713 push @blocks, $block;
418 1713 $blocks_by_type{ $type->name } = $block;
419 }
420  
421 201 for my $root_name (qw(query mutation subscription)) {
422 603 ▶ my $root_type = $runtime_cache->{root_types}{$root_name} or next;
Branch: 1 branch
BranchTrueFalseTotal
my $root_type = $runtime_cache->{"root_types"}{$root_name} or next 218 385 603
423 218 ▶ my $block = $blocks_by_type{ $root_type->name } or next;
Branch: 1 branch
BranchTrueFalseTotal
my $block = $blocks_by_type{$root_type->name} or next 218 0 218
424 218 $root_blocks{$root_name} = $block;
425 218 $root_types{$root_name} = $root_type->name;
426 218 ▶ _add_introspection_meta_slots($block, $root_type)
Branch: 1 branch
BranchTrueFalseTotal
if $root_name eq "query" 201 17 218
427 if $root_name eq 'query';
428 }
429  
430 201 return (\@blocks, \%root_blocks, \%root_types);
431 }
432  
433 4 ▶sub _inflate_blocks {
Subroutine _inflate_blocks: called CC=7 SCAR=21.1
434 4 my ($struct) = @_;
435 4 ▶ my $legacy_program = $struct->{program} || {};
Condition50%1/2
$struct->{'program'} || {}
l!l
04
MC/DC0%0/1
$struct->{'program'} || {}
$struct->{'program'}
Truth table50%1/2
A
A= $struct->{'program'}
Aresult
11
00
436 4 ▶ my $blocks_struct = $struct->{blocks} || $legacy_program->{blocks} || [];
Condition40%2/5
$struct->{'blocks'} || $legacy_program->{'blocks'} || []
l!l
40
$struct->{"blocks"} or $legacy_program->{"blocks"}
l!l&&r!l&&!r
400
MC/DC0%0/2
$struct->{'blocks'} || $legacy_program->{'blocks'} || []
$struct->{"blocks"} $legacy_program->{"blocks"}
Truth table33%1/3
A or B
A= $struct->{"blocks"}B= $legacy_program->{"blocks"}
ABresult
1X1
011
000
437 4 ▶ my $root_blocks_struct = $struct->{root_blocks} || $legacy_program->{root_blocks} || {};
Condition40%2/5
$struct->{'root_blocks'} || $legacy_program->{'root_blocks'} || {}
l!l
40
$struct->{"root_blocks"} or $legacy_program->{"root_blocks"}
l!l&&r!l&&!r
400
MC/DC0%0/2
$struct->{'root_blocks'} || $legacy_program->{'root_blocks'} || {}
$struct->{"root_blocks"} $legacy_program->{"root_blocks"}
Truth table33%1/3
A or B
A= $struct->{"root_blocks"}B= $legacy_program->{"root_blocks"}
ABresult
1X1
011
000
438 4 my @blocks = map { _inflate_block($_) } @{ $blocks_struct };
439 4 my %by_name = map { ($_->name => $_) } @blocks;
440 my %root_blocks = map {
441 4 ▶ ($_ => ($root_blocks_struct->{$_} ? $by_name{ $root_blocks_struct->{$_} } : undef));
Branch: 1 branch
BranchTrueFalseTotal
$root_blocks_struct->{$_} ? : 4 0 4
442 4 } keys %{ $root_blocks_struct };
443  
444 4 return (\@blocks, \%root_blocks);
445 }
446  
447 32 ▶sub _inflate_block {
Subroutine _inflate_block: called CC=2 SCAR=7.0
448 32 my ($struct) = @_;
449 return GraphQL::Houtou::Runtime::SchemaBlock->new(
450 name => $struct->{name},
451 family => $struct->{family},
452 root_type_name => $struct->{root_type_name},
453 32 ▶ slots => [ map { _inflate_slot($_) } @{ $struct->{slots} || [] } ],
Condition50%1/2
$struct->{'slots'} || []
l!l
320
MC/DC0%0/1
$struct->{'slots'} || []
$struct->{'slots'}
Truth table50%1/2
A
A= $struct->{'slots'}
Aresult
11
00
454 );
455 }
456  
457 436 ▶sub _inflate_slot {
Subroutine _inflate_slot: called CC=5 SCAR=18.9
458 436 my ($struct) = @_;
459 return GraphQL::Houtou::Runtime::Slot->new(
460 schema_slot_key => $struct->{schema_slot_key},
461 schema_slot_index => $struct->{schema_slot_index},
462 field_name => $struct->{field_name},
463 result_name => $struct->{result_name},
464 accessor => $struct->{accessor},
465 loader => $struct->{loader},
466 return_type_name => $struct->{return_type_name},
467 resolver_shape => $struct->{resolver_shape},
468 resolver_mode => $struct->{resolver_mode},
469 completion_family => $struct->{completion_family},
470 dispatch_family => $struct->{dispatch_family},
471 arg_defs_compact => (
472 exists $struct->{arg_defs_compact}
473 ? $struct->{arg_defs_compact}
474 : ($struct->{arg_defs} || [])
475 ),
476 return_type_kind_code => $struct->{return_type_kind_code} || 0,
477 item_non_null => $struct->{item_non_null} || 0,
478 has_args => $struct->{has_args},
479 has_directives => $struct->{has_directives},
480 436 ▶ );
Branch: 1 branch
BranchTrueFalseTotal
exists $struct->{'arg_defs_compact'} ? : 436 0 436
Condition50%3/6
$struct->{"arg_defs"} or []
l!l
00
$struct->{'return_type_kind_code'} || 0
l!l
4360
$struct->{'item_non_null'} || 0
l!l
80356
MC/DC0%0/1
$struct->{"arg_defs"} or []
$struct->{"arg_defs"}
MC/DC0%0/1
$struct->{'return_type_kind_code'} || 0
$struct->{'return_type_kind_code'}
MC/DC100%1/1
$struct->{'item_non_null'} || 0
$struct->{'item_non_null'}
Truth table0%0/2
A
A= $struct->{"arg_defs"}
Aresult
11
00
Truth table50%1/2
A
A= $struct->{'return_type_kind_code'}
Aresult
11
00
Truth table100%2/2
A
A= $struct->{'item_non_null'}
Aresult
11
00
481 }
482  
483 1720 ▶sub _build_slots_for_object {
Subroutine _build_slots_for_object: called CC=45 SCAR=41.3
484 1720 my ($schema, $type) = @_;
485 1720 ▶ my $fields = $type->fields || {};
Condition50%1/2
$type->fields || {}
l!l
17200
MC/DC0%0/1
$type->fields || {}
$type->fields
Truth table50%1/2
A
A= $type->fields
Aresult
11
00
486 1720 my @slots = (
487 GraphQL::Houtou::Runtime::Slot->new(
488 schema_slot_key => join(q(.), $type->name, '__typename'),
489 field_name => '__typename',
490 result_name => '__typename',
491 return_type_name => 'String',
492 resolver_shape => 'DEFAULT',
493 resolver_mode => 'DEFAULT',
494 completion_family => 'GENERIC',
495 dispatch_family => 'GENERIC',
496 arg_defs_compact => [],
497 return_type_kind_code => 1,
498 has_args => 0,
499 has_directives => 0,
500 ),
501 );
502  
503 1720 for my $field_name (sort keys %$fields) {
504 8872 ▶ my $field = $fields->{$field_name} || {};
Condition50%1/2
$fields->{$field_name} || {}
l!l
88720
MC/DC0%0/1
$fields->{$field_name} || {}
$fields->{$field_name}
Truth table50%1/2
A
A= $fields->{$field_name}
Aresult
11
00
505 8872 my $return_type = $field->{type};
506 8872 ▶ my $resolver_mode = $field->{resolver_mode} || q();
Condition100%2/2
$field->{'resolver_mode'} || ''
l!l
548818
MC/DC100%1/1
$field->{'resolver_mode'} || ''
$field->{'resolver_mode'}
Truth table100%2/2
A
A= $field->{'resolver_mode'}
Aresult
11
00
507 8872 my $wrapped = slot_needs_runtime_wrapper(
508 schema => $schema,
509 field => $field,
510 );
511 8872 ▶ if ($resolver_mode ne q()
Branch: 1 branch
BranchTrueFalseTotal
if ($resolver_mode ne "" and not grep({$resolver_mode eq $_;} "native", "native_args", "native_no_args", "native_one_arg", "fast_resolve", "fast_resolve_no_args", "fast_resolve_one_arg")) 1 8871 8872
Condition100%3/3
$resolver_mode ne "" and not grep({$resolver_mode eq $_;} "native", "native_args", "native_no_args", "native_one_arg", "fast_resolve", "fast_resolve_no_args", "fast_resolve_one_arg")
!ll&&!rl&&r
8818531
MC/DC100%2/2
$resolver_mode ne "" and not grep({$resolver_mode eq $_;} "native", "native_args", "native_no_args", "native_one_arg", "fast_resolve", "fast_resolve_no_args", "fast_resolve_one_arg")
$resolver_mode ne "" not grep({$resolver_mode eq $_;} "native", "native_args", "native_no_args", "native_one_arg", "fast_resolve", "fast_resolve_no_args", "fast_resolve_one_arg")
Truth table100%3/3
A and not(B)
A= $resolver_mode ne ""B= not grep({$resolver_mode eq $_;} "native", "native_args", "native_no_args", "native_one_arg", "fast_resolve", "fast_resolve_no_args", "fast_resolve_one_arg")
ABresult
0X0
100
111
512 378 && !grep { $resolver_mode eq $_ } qw(
513 native native_args native_no_args native_one_arg
514 fast_resolve fast_resolve_no_args fast_resolve_one_arg
515 )) {
516 1 die "unknown resolver_mode '$resolver_mode'"
517 . " (" . $type->name . ".$field_name)\n";
518 }
519 8871 ▶ if (($resolver_mode eq 'native_no_args'
Branch: 1 branch
BranchTrueFalseTotal
if ($resolver_mode eq "native_no_args" || $resolver_mode eq "fast_resolve_no_args" and $field->{"args"} and keys %{$$field{"args"};}) 1 8870 8871
Condition77%7/9
$resolver_mode eq "native_no_args" || $resolver_mode eq "fast_resolve_no_args" and $field->{"args"} and keys %{$$field{"args"};}
!ll&&!rl&&r
887001
$resolver_mode eq "native_no_args" || $resolver_mode eq "fast_resolve_no_args" and $field->{"args"}
!ll&&!rl&&r
886191
$resolver_mode eq "native_no_args" or $resolver_mode eq "fast_resolve_no_args"
l!l&&r!l&&!r
0108861
MC/DC50%2/4
$resolver_mode eq "native_no_args" || $resolver_mode eq "fast_resolve_no_args" and $field->{"args"} and keys %{$$field{"args"};}
$resolver_mode eq "native_no_args" $resolver_mode eq "fast_resolve_no_args" $field->{"args"} keys %{$$field{"args"};}
Truth table42%3/7
A or B and C and D
A= $resolver_mode eq "native_no_args"B= $resolver_mode eq "fast_resolve_no_args"C= $field->{"args"}D= keys %{$$field{"args"};}
ABCDresult
00XX0
1X0X0
010X0
1X100
01100
1X111
01111
520 || $resolver_mode eq 'fast_resolve_no_args')
521 && $field->{args}
522 1 && keys %{ $field->{args} }) {
523 die "resolver_mode '" . $field->{resolver_mode}
524 1 . "' requires a field without arguments"
525 . " (" . $type->name . ".$field_name)\n";
526 }
527 8870 ▶ if (($resolver_mode eq 'native_one_arg'
Branch: 1 branch
BranchTrueFalseTotal
if ($resolver_mode eq "native_one_arg" || $resolver_mode eq "fast_resolve_one_arg" and !$field->{"args"} || keys %{$$field{"args"};} != 1) 1 8869 8870
Condition77%7/9
$resolver_mode eq "native_one_arg" || $resolver_mode eq "fast_resolve_one_arg" and !$field->{"args"} || keys %{$$field{"args"};} != 1
!ll&&!rl&&r
886091
$resolver_mode eq "native_one_arg" or $resolver_mode eq "fast_resolve_one_arg"
l!l&&r!l&&!r
0108860
not $field->{"args"} or keys %{$$field{"args"};} != 1
l!l&&r!l&&!r
109
MC/DC50%2/4
$resolver_mode eq "native_one_arg" || $resolver_mode eq "fast_resolve_one_arg" and !$field->{"args"} || keys %{$$field{"args"};} != 1
$resolver_mode eq "native_one_arg" $resolver_mode eq "fast_resolve_one_arg" not $field->{"args"} keys %{$$field{"args"};} != 1
Truth table42%3/7
A or B and not(C) or D
A= $resolver_mode eq "native_one_arg"B= $resolver_mode eq "fast_resolve_one_arg"C= not $field->{"args"}D= keys %{$$field{"args"};} != 1
ABCDresult
00XX0
1X000
01000
1X1X1
1X011
011X1
01011
528 || $resolver_mode eq 'fast_resolve_one_arg')
529 9 && (!$field->{args} || keys(%{ $field->{args} }) != 1)) {
530 die "resolver_mode '" . $field->{resolver_mode}
531 1 . "' requires exactly one argument"
532 . " (" . $type->name . ".$field_name)\n";
533 }
534 8869 ▶ if (defined $field->{accessor}
Branch: 1 branch
BranchTrueFalseTotal
if (defined $field->{"accessor"} and ref $field->{"accessor"} || $field->{"accessor"} eq "") 0 8869 8869
Condition50%3/6
defined $field->{"accessor"} and ref $field->{"accessor"} || $field->{"accessor"} eq ""
!ll&&!rl&&r
8857120
ref $field->{"accessor"} or $field->{"accessor"} eq ""
l!l&&r!l&&!r
0012
MC/DC0%0/3
defined $field->{"accessor"} and ref $field->{"accessor"} || $field->{"accessor"} eq ""
defined $field->{"accessor"} ref $field->{"accessor"} $field->{"accessor"} eq ""
Truth table50%2/4
A and B or C
A= defined $field->{"accessor"}B= ref $field->{"accessor"}C= $field->{"accessor"} eq ""
ABCresult
0XX0
1000
11X1
1011
535 && (ref($field->{accessor}) || $field->{accessor} eq q())) {
536 0 die "accessor requires a non-empty method name"
537 . " (" . $type->name . ".$field_name)\n";
538 }
539 8869 ▶ if (defined $field->{accessor} && $field->{resolve}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $field->{"accessor"} and $field->{"resolve"}) 1 8868 8869
Condition100%3/3
defined $field->{"accessor"} and $field->{"resolve"}
!ll&&!rl&&r
8857111
MC/DC100%2/2
defined $field->{"accessor"} and $field->{"resolve"}
defined $field->{"accessor"} $field->{"resolve"}
Truth table100%3/3
A and B
A= defined $field->{"accessor"}B= $field->{"resolve"}
ABresult
0X0
100
111
540 1 die "accessor and resolve cannot both be specified"
541 . " (" . $type->name . ".$field_name)\n";
542 }
543 8868 ▶ if (defined $field->{loader} && ref($field->{loader}) ne 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $field->{"loader"} and ref $field->{"loader"} ne "HASH") 0 8868 8868
Condition66%2/3
defined $field->{"loader"} and ref $field->{"loader"} ne "HASH"
!ll&&!rl&&r
8856120
MC/DC0%0/2
defined $field->{"loader"} and ref $field->{"loader"} ne "HASH"
defined $field->{"loader"} ref $field->{"loader"} ne "HASH"
Truth table66%2/3
A and B
A= defined $field->{"loader"}B= ref $field->{"loader"} ne "HASH"
ABresult
0X0
100
111
544 0 die "loader requires a hash specification"
545 . " (" . $type->name . ".$field_name)\n";
546 }
547 8868 ▶ if (defined $field->{loader}
Branch: 1 branch
BranchTrueFalseTotal
if (defined $field->{"loader"} and defined $field->{"accessor"} || $field->{"resolve"}) 0 8868 8868
Condition50%3/6
defined $field->{"loader"} and defined $field->{"accessor"} || $field->{"resolve"}
!ll&&!rl&&r
8856120
defined $field->{"accessor"} or $field->{"resolve"}
l!l&&r!l&&!r
0012
MC/DC0%0/3
defined $field->{"loader"} and defined $field->{"accessor"} || $field->{"resolve"}
defined $field->{"loader"} defined $field->{"accessor"} $field->{"resolve"}
Truth table50%2/4
A and B or C
A= defined $field->{"loader"}B= defined $field->{"accessor"}C= $field->{"resolve"}
ABCresult
0XX0
1000
11X1
1011
548 && (defined($field->{accessor}) || $field->{resolve})) {
549 0 die "loader cannot be combined with accessor or resolve"
550 . " (" . $type->name . ".$field_name)\n";
551 }
552 _validate_loader_spec($field->{loader}, $type->name, $field_name)
553 8868 ▶ if defined $field->{loader};
Branch: 1 branch
BranchTrueFalseTotal
if defined $field->{"loader"} 12 8856 8868
554 8865 ▶ if (defined $field->{accessor}
Branch: 1 branch
BranchTrueFalseTotal
if (defined $field->{"accessor"} and $field->{"args"} and keys %{$$field{"args"};}) 0 8865 8865
Condition50%3/6
defined $field->{"accessor"} and $field->{"args"} and keys %{$$field{"args"};}
!ll&&!rl&&r
886500
defined $field->{"accessor"} and $field->{"args"}
!ll&&!rl&&r
8854110
MC/DC0%0/3
defined $field->{"accessor"} and $field->{"args"} and keys %{$$field{"args"};}
defined $field->{"accessor"} $field->{"args"} keys %{$$field{"args"};}
Truth table50%2/4
A and B and C
A= defined $field->{"accessor"}B= $field->{"args"}C= keys %{$$field{"args"};}
ABCresult
0XX0
10X0
1100
1111
555 && $field->{args}
556 0 && keys %{ $field->{args} }) {
557 0 die "accessor requires a field without arguments"
558 . " (" . $type->name . ".$field_name)\n";
559 }
560 push @slots, GraphQL::Houtou::Runtime::Slot->new(
561 schema_slot_key => join(q(.), $type->name, $field_name),
562 field_name => $field_name,
563 result_name => $field_name,
564 accessor => $field->{accessor},
565 loader => $field->{loader},
566 return_type_name => _type_name($return_type),
567 resolver_shape => ($field->{resolve} || $wrapped || $field->{loader})
568 ? 'EXPLICIT' : 'DEFAULT',
569 resolver_mode => $wrapped
570 ? 'DEFAULT'
571 : (($resolver_mode eq 'native_one_arg'
572 || $resolver_mode eq 'fast_resolve_one_arg')
573 ? 'NATIVE_ONE_ARG'
574 : (($resolver_mode eq 'native_no_args'
575 || $resolver_mode eq 'fast_resolve_no_args')
576 ? 'NATIVE_NO_ARGS'
577 : (($resolver_mode eq 'native'
578 || $resolver_mode eq 'native_args'
579 || $resolver_mode eq 'fast_resolve')
580 ? 'NATIVE'
581 : 'DEFAULT'))),
582 completion_family => _completion_family_for_type($return_type),
583 dispatch_family => _dispatch_family_for_type($return_type),
584 arg_defs_compact => _build_input_defs_compact($field->{args} || {}),
585 return_type_kind_code => _type_kind_code($return_type),
586 item_non_null => _item_non_null_for_type($return_type),
587 1244 ▶ has_args => ($field->{args} && keys %{ $field->{args} }) ? 1 : 0,
Branch: 1 branch
BranchTrueFalseTotal
$field->{'directives'} && @{$field->{'directives'};} ? : 3 8862 8865
Condition100%3/3
$field->{"directives"} and @{$field->{"directives"};}
!ll&&!rl&&r
886113
MC/DC100%2/2
$field->{"directives"} and @{$field->{"directives"};}
$field->{"directives"} @{$field->{"directives"};}
Truth table100%3/3
A and B
A= $field->{"directives"}B= @{$field->{"directives"};}
ABresult
0X0
100
111
588 8865 ▶ has_directives => ($field->{directives} && @{ $field->{directives} }) ? 1 : 0,
Branch: 6 branches
BranchTrueFalseTotal
$field->{'resolve'} || $wrapped || $field->{'loader'} ? : 6668 2197 8865
$wrapped ? : 3 8862 8865
$resolver_mode eq 'native_one_arg' || $resolver_mode eq 'fast_resolve_one_arg' ? : 9 8853 8862
$resolver_mode eq 'native_no_args' || $resolver_mode eq 'fast_resolve_no_args' ? : 9 8844 8853
$resolver_mode eq 'native' || $resolver_mode eq 'native_args' || $resolver_mode eq 'fast_resolve' ? : 33 8811 8844
$field->{'args'} && keys %{$$field{'args'};} ? : 1244 7621 8865
Condition82%19/23
$field->{"resolve"} or $wrapped or $field->{"loader"}
l!l&&r!l&&!r
665992197
$field->{"resolve"} or $wrapped
l!l&&r!l&&!r
665812206
$resolver_mode eq "native_one_arg" or $resolver_mode eq "fast_resolve_one_arg"
l!l&&r!l&&!r
098853
$resolver_mode eq "native_no_args" or $resolver_mode eq "fast_resolve_no_args"
l!l&&r!l&&!r
098844
$resolver_mode eq "native" or $resolver_mode eq "native_args" or $resolver_mode eq "fast_resolve"
l!l&&r!l&&!r
3218811
$resolver_mode eq "native" or $resolver_mode eq "native_args"
l!l&&r!l&&!r
3208812
$field->{'args'} || {}
l!l
12447621
$field->{"args"} and keys %{$$field{"args"};}
!ll&&!rl&&r
762101244
MC/DC100%3/3
$field->{"resolve"} or $wrapped or $field->{"loader"}
$field->{"resolve"} $wrapped $field->{"loader"}
MC/DC50%1/2
$resolver_mode eq "native_one_arg" or $resolver_mode eq "fast_resolve_one_arg"
$resolver_mode eq "native_one_arg" $resolver_mode eq "fast_resolve_one_arg"
MC/DC50%1/2
$resolver_mode eq "native_no_args" or $resolver_mode eq "fast_resolve_no_args"
$resolver_mode eq "native_no_args" $resolver_mode eq "fast_resolve_no_args"
MC/DC66%2/3
$resolver_mode eq "native" or $resolver_mode eq "native_args" or $resolver_mode eq "fast_resolve"
$resolver_mode eq "native" $resolver_mode eq "native_args" $resolver_mode eq "fast_resolve"
MC/DC100%1/1
$field->{'args'} || {}
$field->{'args'}
MC/DC50%1/2
$field->{"args"} and keys %{$$field{"args"};}
$field->{"args"} keys %{$$field{"args"};}
Truth table100%4/4
A or B or C
A= $field->{"resolve"}B= $wrappedC= $field->{"loader"}
ABCresult
1XX1
01X1
0011
0000
Truth table66%2/3
A or B
A= $resolver_mode eq "native_one_arg"B= $resolver_mode eq "fast_resolve_one_arg"
ABresult
1X1
011
000
Truth table66%2/3
A or B
A= $resolver_mode eq "native_no_args"B= $resolver_mode eq "fast_resolve_no_args"
ABresult
1X1
011
000
Truth table75%3/4
A or B or C
A= $resolver_mode eq "native"B= $resolver_mode eq "native_args"C= $resolver_mode eq "fast_resolve"
ABCresult
1XX1
01X1
0011
0000
Truth table100%2/2
A
A= $field->{'args'}
Aresult
11
00
Truth table66%2/3
A and B
A= $field->{"args"}B= keys %{$$field{"args"};}
ABresult
0X0
100
111
589 );
590 }
591  
592 1713 return \@slots;
593 }
594  
595 12 ▶sub _validate_loader_value_spec {
Subroutine _validate_loader_value_spec: called CC=6 SCAR=19.6
596 12 my ($spec, $label, $coordinate) = @_;
597 12 ▶ die "$label requires a hash specification ($coordinate)\n"
Branch: 1 branch
BranchTrueFalseTotal
if ref $spec ne "HASH" 0 12 12
598 if ref($spec) ne 'HASH';
599 12 my @keys = grep { exists $spec->{$_} } qw(source_key argument);
600 12 ▶ die "$label requires exactly one of source_key or argument ($coordinate)\n"
Branch: 1 branch
BranchTrueFalseTotal
if @keys != 1 1 11 12
601 if @keys != 1;
602 11 my $value = $spec->{ $keys[0] };
603 11 ▶ die "$label requires a non-empty name ($coordinate)\n"
Branch: 1 branch
BranchTrueFalseTotal
if ref $value or not defined $value or $value eq "" 0 11 11
Condition33%2/6
ref $value or not defined $value or $value eq ""
l!l&&r!l&&!r
0011
ref $value or not defined $value
l!l&&r!l&&!r
0011
MC/DC0%0/3
ref $value or not defined $value or $value eq ""
ref $value not defined $value $value eq ""
Truth table25%1/4
A or not(B) or C
A= ref $valueB= not defined $valueC= $value eq ""
ABCresult
1XX1
01X1
0011
0000
604 if ref($value) || !defined($value) || $value eq q();
605 }
606  
607 12 ▶sub _validate_loader_spec {
Subroutine _validate_loader_spec: called CC=12 SCAR=27.2
608 12 my ($spec, $type_name, $field_name) = @_;
609 12 my $coordinate = "$type_name.$field_name";
610 12 my $has_fixed = exists $spec->{context_key};
611 12 my $has_router = exists $spec->{router};
612 12 ▶ die "loader requires exactly one of context_key or router ($coordinate)\n"
Branch: 3 branches
BranchTrueFalseTotal
if ($has_fixed ? 1 : 0) + ($has_router ? 1 : 0) != 1 2 10 12
$has_fixed ? : 9 3 12
$has_router ? : 3 9 12
613 if ($has_fixed ? 1 : 0) + ($has_router ? 1 : 0) != 1;
614 10 _validate_loader_value_spec($spec->{key}, 'loader key', $coordinate);
615 9 ▶ if ($has_fixed) {
Branch: 1 branch
BranchTrueFalseTotal
if ($has_fixed) 7 2 9
616 die "loader context_key requires a non-empty name ($coordinate)\n"
617 if ref($spec->{context_key}) || !defined($spec->{context_key})
618 7 ▶ || $spec->{context_key} eq q();
Branch: 1 branch
BranchTrueFalseTotal
if ref $spec->{"context_key"} or not defined $spec->{"context_key"} or $spec->{"context_key"} eq "" 0 7 7
Condition33%2/6
ref $spec->{"context_key"} or not defined $spec->{"context_key"} or $spec->{"context_key"} eq ""
l!l&&r!l&&!r
007
ref $spec->{"context_key"} or not defined $spec->{"context_key"}
l!l&&r!l&&!r
007
MC/DC0%0/3
ref $spec->{"context_key"} or not defined $spec->{"context_key"} or $spec->{"context_key"} eq ""
ref $spec->{"context_key"} not defined $spec->{"context_key"} $spec->{"context_key"} eq ""
Truth table25%1/4
A or not(B) or C
A= ref $spec->{"context_key"}B= not defined $spec->{"context_key"}C= $spec->{"context_key"} eq ""
ABCresult
1XX1
01X1
0011
0000
619 7 return;
620 }
621 2 my $router = $spec->{router};
622 2 ▶ die "loader router requires a hash specification ($coordinate)\n"
Branch: 1 branch
BranchTrueFalseTotal
if ref $router ne "HASH" 0 2 2
623 if ref($router) ne 'HASH';
624 die "loader router context_key requires a non-empty name ($coordinate)\n"
625 if ref($router->{context_key}) || !defined($router->{context_key})
626 2 ▶ || $router->{context_key} eq q();
Branch: 1 branch
BranchTrueFalseTotal
if ref $router->{"context_key"} or not defined $router->{"context_key"} or $router->{"context_key"} eq "" 0 2 2
Condition33%2/6
ref $router->{"context_key"} or not defined $router->{"context_key"} or $router->{"context_key"} eq ""
l!l&&r!l&&!r
002
ref $router->{"context_key"} or not defined $router->{"context_key"}
l!l&&r!l&&!r
002
MC/DC0%0/3
ref $router->{"context_key"} or not defined $router->{"context_key"} or $router->{"context_key"} eq ""
ref $router->{"context_key"} not defined $router->{"context_key"} $router->{"context_key"} eq ""
Truth table25%1/4
A or not(B) or C
A= ref $router->{"context_key"}B= not defined $router->{"context_key"}C= $router->{"context_key"} eq ""
ABCresult
1XX1
01X1
0011
0000
627 _validate_loader_value_spec(
628 2 $router->{route_key}, 'loader router route_key', $coordinate
629 );
630 }
631  
632 # True when the field is list-typed and its item type is Non-Null
633 # ([T!], [T!]!): a null item then propagates to the list position
634 # (spec 6.4.4). Nested list interiors ([[T!]]) are not tracked yet.
635 8865 ▶sub _item_non_null_for_type {
Subroutine _item_non_null_for_type: called CC=6 SCAR=18.0
636 8865 my ($type) = @_;
637 8865 ▶ return 0 if !$type;
Branch: 1 branch
BranchTrueFalseTotal
unless $type 0 8865 8865
638 8865 ▶ $type = $type->of if $type->isa('GraphQL::Houtou::Type::NonNull');
Branch: 1 branch
BranchTrueFalseTotal
if $type->isa("GraphQL::Houtou::Type::NonNull") 3619 5246 8865
639 8865 ▶ return 0 if !$type->isa('GraphQL::Houtou::Type::List');
Branch: 1 branch
BranchTrueFalseTotal
unless $type->isa("GraphQL::Houtou::Type::List") 6652 2213 8865
640 2213 ▶ return $type->of && $type->of->isa('GraphQL::Houtou::Type::NonNull') ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$type->of && $type->of->isa('GraphQL::Houtou::Type::NonNull') ? : 2021 192 2213
Condition66%2/3
$type->of and $type->of->isa("GraphQL::Houtou::Type::NonNull")
!ll&&!rl&&r
01922021
MC/DC50%1/2
$type->of and $type->of->isa("GraphQL::Houtou::Type::NonNull")
$type->of $type->of->isa("GraphQL::Houtou::Type::NonNull")
Truth table66%2/3
A and B
A= $type->ofB= $type->of->isa("GraphQL::Houtou::Type::NonNull")
ABresult
0X0
100
111
641 }
642  
643 201 ▶sub _add_introspection_meta_slots {
Subroutine _add_introspection_meta_slots: called CC=5 SCAR=16.1
644 201 my ($block, $root_type) = @_;
645 201 require GraphQL::Houtou::Introspection;
646  
647 201 for my $meta_def (
648 $GraphQL::Houtou::Introspection::SCHEMA_META_FIELD_DEF,
649 $GraphQL::Houtou::Introspection::TYPE_META_FIELD_DEF,
650 ) {
651 402 my $return_type = $meta_def->{type};
652 402 ▶ push @{ $block->{slots} }, GraphQL::Houtou::Runtime::Slot->new(
Branch: 1 branch
BranchTrueFalseTotal
$meta_def->{'args'} && keys %{$$meta_def{'args'};} ? : 201 201 402
Condition80%4/5
$meta_def->{'args'} || {}
l!l
201201
$meta_def->{"args"} and keys %{$$meta_def{"args"};}
!ll&&!rl&&r
2010201
MC/DC100%1/1
$meta_def->{'args'} || {}
$meta_def->{'args'}
MC/DC50%1/2
$meta_def->{"args"} and keys %{$$meta_def{"args"};}
$meta_def->{"args"} keys %{$$meta_def{"args"};}
Truth table100%2/2
A
A= $meta_def->{'args'}
Aresult
11
00
Truth table66%2/3
A and B
A= $meta_def->{"args"}B= keys %{$$meta_def{"args"};}
ABresult
0X0
100
111
653 schema_slot_key => join(q(.), $root_type->name, $meta_def->{name}),
654 field_name => $meta_def->{name},
655 result_name => $meta_def->{name},
656 return_type_name => _type_name($return_type),
657 resolver_shape => 'EXPLICIT',
658 resolver_mode => 'DEFAULT',
659 completion_family => _completion_family_for_type($return_type),
660 dispatch_family => _dispatch_family_for_type($return_type),
661 arg_defs_compact => _build_input_defs_compact($meta_def->{args} || {}),
662 return_type_kind_code => _type_kind_code($return_type),
663 402 has_args => ($meta_def->{args} && keys %{ $meta_def->{args} }) ? 1 : 0,
664 has_directives => 0,
665 );
666 }
667 }
668  
669 201 ▶sub _build_slot_catalog {
Subroutine _build_slot_catalog: called CC=9 SCAR=24.3
670 201 my ($blocks) = @_;
671 201 my @catalog;
672 my %seen;
673  
674 201 ▶ for my $block (@{ $blocks || [] }) {
Condition50%1/2
$blocks || []
l!l
2010
MC/DC0%0/1
$blocks || []
$blocks
Truth table50%1/2
A
A= $blocks
Aresult
11
00
675 1713 ▶ for my $slot (@{ $block->slots || [] }) {
Condition50%1/2
$block->slots || []
l!l
17130
MC/DC0%0/1
$block->slots || []
$block->slots
Truth table50%1/2
A
A= $block->slots
Aresult
11
00
676 10980 ▶ my $key = $slot->schema_slot_key // join(q(.), ($block->root_type_name || q()), $slot->field_name);
Condition25%1/4
$slot->schema_slot_key // join(".", $block->root_type_name || "", $slot->field_name)
l!l
109800
$block->root_type_name || ''
l!l
00
MC/DC0%0/1
$slot->schema_slot_key // join(".", $block->root_type_name || "", $slot->field_name)
$slot->schema_slot_key
MC/DC0%0/1
$block->root_type_name || ''
$block->root_type_name
Truth table50%1/2
A
A= $slot->schema_slot_key
Aresult
11
00
Truth table0%0/2
A
A= $block->root_type_name
Aresult
11
00
677 10980 ▶ next if exists $seen{$key};
Branch: 1 branch
BranchTrueFalseTotal
if exists $seen{$key} 0 10980 10980
678 10980 ▶ $slot->{schema_slot_key} ||= $key;
Condition33%1/3
$slot->{"schema_slot_key"} ||= $key
l!l&&r!l&&!r
1098000
MC/DC0%0/2
$slot->{"schema_slot_key"} ||= $key
$slot->{"schema_slot_key"} $key
Truth table33%1/3
A ||= B
A= $slot->{"schema_slot_key"}B= $key
ABresult
1X1
011
000
679 10980 $slot->{schema_slot_index} = scalar @catalog;
680 10980 $seen{$key} = $slot;
681 10980 push @catalog, $slot;
682 }
683 }
684  
685 201 return \@catalog;
686 }
687  
688 4 ▶sub _apply_slot_catalog_to_blocks {
Subroutine _apply_slot_catalog_to_blocks: called CC=10 SCAR=25.4
689 4 my ($blocks, $slot_catalog) = @_;
690 my %catalog_by_key = map {
691 4 my $slot = $slot_catalog->[$_];
692 218 ▶ $slot->{schema_slot_index} = $_ if !defined $slot->{schema_slot_index};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $slot->{"schema_slot_index"} 0 218 218
693 218 ▶ (($slot->schema_slot_key || q()) => $slot);
Condition50%1/2
$slot->schema_slot_key || ''
l!l
2180
MC/DC0%0/1
$slot->schema_slot_key || ''
$slot->schema_slot_key
Truth table50%1/2
A
A= $slot->schema_slot_key
Aresult
11
00
694 } 0 .. $#$slot_catalog;
695  
696 4 ▶ for my $block (@{ $blocks || [] }) {
Condition50%1/2
$blocks || []
l!l
40
MC/DC0%0/1
$blocks || []
$blocks
Truth table50%1/2
A
A= $blocks
Aresult
11
00
697 32 my @slots;
698 32 ▶ for my $slot (@{ $block->slots || [] }) {
Condition50%1/2
$block->slots || []
l!l
320
MC/DC0%0/1
$block->slots || []
$block->slots
Truth table50%1/2
A
A= $block->slots
Aresult
11
00
699 218 ▶ my $key = $slot->schema_slot_key // join(q(.), ($block->root_type_name || q()), $slot->field_name);
Condition25%1/4
$slot->schema_slot_key // join(".", $block->root_type_name || "", $slot->field_name)
l!l
2180
$block->root_type_name || ''
l!l
00
MC/DC0%0/1
$slot->schema_slot_key // join(".", $block->root_type_name || "", $slot->field_name)
$slot->schema_slot_key
MC/DC0%0/1
$block->root_type_name || ''
$block->root_type_name
Truth table50%1/2
A
A= $slot->schema_slot_key
Aresult
11
00
Truth table0%0/2
A
A= $block->root_type_name
Aresult
11
00
700 218 ▶ my $catalog_slot = $catalog_by_key{$key} || $slot;
Condition33%1/3
$catalog_by_key{$key} || $slot
l!l&&r!l&&!r
21800
MC/DC0%0/2
$catalog_by_key{$key} || $slot
$catalog_by_key{$key} $slot
Truth table33%1/3
A || B
A= $catalog_by_key{$key}B= $slot
ABresult
1X1
011
000
701 218 push @slots, $catalog_slot;
702 }
703 32 $block->{slots} = \@slots;
704 }
705  
706 4 return $blocks;
707 }
708  
709 9267 ▶sub _build_input_defs_compact {
Subroutine _build_input_defs_compact: called CC=5 SCAR=16.3
710 9267 my ($defs) = @_;
711 9267 my @built;
712 9267 ▶ for my $name (sort keys %{$defs || {}}) {
Condition50%1/2
$defs || {}
l!l
92670
MC/DC0%0/1
$defs || {}
$defs
Truth table50%1/2
A
A= $defs
Aresult
11
00
713 1602 ▶ my $def = $defs->{$name} || {};
Condition50%1/2
$defs->{$name} || {}
l!l
16020
MC/DC0%0/1
$defs->{$name} || {}
$defs->{$name}
Truth table50%1/2
A
A= $defs->{$name}
Aresult
11
00
714 push @built, [
715 $name,
716 _typedef_for_type($def->{type}),
717 exists $def->{default_value} ? 1 : 0,
718 $def->{default_value},
719 1602 ▶ ];
Branch: 1 branch
BranchTrueFalseTotal
exists $def->{'default_value'} ? : 1011 591 1602
720 }
721 9267 return \@built;
722 }
723  
724 9267 ▶sub _type_kind_code {
Subroutine _type_kind_code: called CC=9 SCAR=22.0
725 9267 my ($type) = @_;
726 9267 ▶ return 0 if !$type;
Branch: 1 branch
BranchTrueFalseTotal
unless $type 0 9267 9267
727 9267 ▶ return 8 if $type->isa('GraphQL::Houtou::Type::NonNull');
Branch: 1 branch
BranchTrueFalseTotal
if $type->isa("GraphQL::Houtou::Type::NonNull") 3820 5447 9267
728 5447 ▶ return 3 if $type->isa('GraphQL::Houtou::Type::List');
Branch: 1 branch
BranchTrueFalseTotal
if $type->isa("GraphQL::Houtou::Type::List") 1187 4260 5447
729 4260 ▶ return 2 if $type->isa('GraphQL::Houtou::Type::Object');
Branch: 1 branch
BranchTrueFalseTotal
if $type->isa("GraphQL::Houtou::Type::Object") 1056 3204 4260
730 3204 ▶ return 4 if $type->isa('GraphQL::Houtou::Type::Interface');
Branch: 1 branch
BranchTrueFalseTotal
if $type->isa("GraphQL::Houtou::Type::Interface") 12 3192 3204
731 3192 ▶ return 5 if $type->isa('GraphQL::Houtou::Type::Union');
Branch: 1 branch
BranchTrueFalseTotal
if $type->isa("GraphQL::Houtou::Type::Union") 5 3187 3192
732 3187 ▶ return 6 if $type->isa('GraphQL::Houtou::Type::Enum');
Branch: 1 branch
BranchTrueFalseTotal
if $type->isa("GraphQL::Houtou::Type::Enum") 7 3180 3187
733 3180 ▶ return 7 if $type->isa('GraphQL::Houtou::Type::InputObject');
Branch: 1 branch
BranchTrueFalseTotal
if $type->isa("GraphQL::Houtou::Type::InputObject") 0 3180 3180
734 3180 return 1;
735 }
736  
737 3351 ▶sub _type_kind {
Subroutine _type_kind: called CC=8 SCAR=20.8
738 3351 my ($type) = @_;
739 3351 ▶ return 'NON_NULL' if $type->isa('GraphQL::Houtou::Type::NonNull');
Branch: 1 branch
BranchTrueFalseTotal
if $type->isa("GraphQL::Houtou::Type::NonNull") 0 3351 3351
740 3351 ▶ return 'LIST' if $type->isa('GraphQL::Houtou::Type::List');
Branch: 1 branch
BranchTrueFalseTotal
if $type->isa("GraphQL::Houtou::Type::List") 0 3351 3351
741 3351 ▶ return 'OBJECT' if $type->isa('GraphQL::Houtou::Type::Object');
Branch: 1 branch
BranchTrueFalseTotal
if $type->isa("GraphQL::Houtou::Type::Object") 1762 1589 3351
742 1589 ▶ return 'INTERFACE' if $type->isa('GraphQL::Houtou::Type::Interface');
Branch: 1 branch
BranchTrueFalseTotal
if $type->isa("GraphQL::Houtou::Type::Interface") 35 1554 1589
743 1554 ▶ return 'UNION' if $type->isa('GraphQL::Houtou::Type::Union');
Branch: 1 branch
BranchTrueFalseTotal
if $type->isa("GraphQL::Houtou::Type::Union") 30 1524 1554
744 1524 ▶ return 'ENUM' if $type->isa('GraphQL::Houtou::Type::Enum');
Branch: 1 branch
BranchTrueFalseTotal
if $type->isa("GraphQL::Houtou::Type::Enum") 429 1095 1524
745 1095 ▶ return 'INPUT_OBJECT' if $type->isa('GraphQL::Houtou::Type::InputObject');
Branch: 1 branch
BranchTrueFalseTotal
if $type->isa("GraphQL::Houtou::Type::InputObject") 19 1076 1095
746 1076 return 'SCALAR';
747 }
748  
749 16438 ▶sub _completion_family_for_type {
Subroutine _completion_family_for_type: called CC=7 SCAR=19.5
750 16438 my ($type) = @_;
751 16438 ▶ return 'GENERIC' if !$type;
Branch: 1 branch
BranchTrueFalseTotal
unless $type 0 16438 16438
752 16438 ▶ return _completion_family_for_type($type->of) if $type->isa('GraphQL::Houtou::Type::NonNull');
Branch: 1 branch
BranchTrueFalseTotal
if $type->isa("GraphQL::Houtou::Type::NonNull") 3820 12618 16438
753 12618 ▶ return 'OBJECT' if $type->isa('GraphQL::Houtou::Type::Object');
Branch: 1 branch
BranchTrueFalseTotal
if $type->isa("GraphQL::Houtou::Type::Object") 3672 8946 12618
754 8946 ▶ return 'LIST' if $type->isa('GraphQL::Houtou::Type::List');
Branch: 1 branch
BranchTrueFalseTotal
if $type->isa("GraphQL::Houtou::Type::List") 2213 6733 8946
755 6733 ▶ return 'ABSTRACT'
Branch: 1 branch
BranchTrueFalseTotal
if $type->isa("GraphQL::Houtou::Type::Interface") or $type->isa("GraphQL::Houtou::Type::Union") 82 6651 6733
Condition100%3/3
$type->isa("GraphQL::Houtou::Type::Interface") or $type->isa("GraphQL::Houtou::Type::Union")
l!l&&r!l&&!r
47356651
MC/DC100%2/2
$type->isa("GraphQL::Houtou::Type::Interface") or $type->isa("GraphQL::Houtou::Type::Union")
$type->isa("GraphQL::Houtou::Type::Interface") $type->isa("GraphQL::Houtou::Type::Union")
Truth table100%3/3
A or B
A= $type->isa("GraphQL::Houtou::Type::Interface")B= $type->isa("GraphQL::Houtou::Type::Union")
ABresult
1X1
011
000
756 if $type->isa('GraphQL::Houtou::Type::Interface')
757 || $type->isa('GraphQL::Houtou::Type::Union');
758 6651 return 'GENERIC';
759 }
760  
761 17321 ▶sub _dispatch_family_for_type {
Subroutine _dispatch_family_for_type: called CC=16 SCAR=29.4
762 17321 my ($type) = @_;
763 17321 ▶ return _dispatch_family_for_type($type->of) if $type && $type->isa('GraphQL::Houtou::Type::NonNull');
Branch: 1 branch
BranchTrueFalseTotal
if $type and $type->isa("GraphQL::Houtou::Type::NonNull") 5841 11480 17321
Condition66%2/3
$type and $type->isa("GraphQL::Houtou::Type::NonNull")
!ll&&!rl&&r
0114805841
MC/DC50%1/2
$type and $type->isa("GraphQL::Houtou::Type::NonNull")
$type $type->isa("GraphQL::Houtou::Type::NonNull")
Truth table66%2/3
A and B
A= $typeB= $type->isa("GraphQL::Houtou::Type::NonNull")
ABresult
0X0
100
111
764 11480 ▶ return 'TAG' if $type && ($type->isa('GraphQL::Houtou::Type::Interface') || $type->isa('GraphQL::Houtou::Type::Union'));
Branch: 1 branch
BranchTrueFalseTotal
if $type and $type->isa("GraphQL::Houtou::Type::Interface") || $type->isa("GraphQL::Houtou::Type::Union") 48 11432 11480
Condition83%5/6
$type and $type->isa("GraphQL::Houtou::Type::Interface") || $type->isa("GraphQL::Houtou::Type::Union")
!ll&&!rl&&r
01143248
$type->isa("GraphQL::Houtou::Type::Interface") or $type->isa("GraphQL::Houtou::Type::Union")
l!l&&r!l&&!r
202811432
MC/DC66%2/3
$type and $type->isa("GraphQL::Houtou::Type::Interface") || $type->isa("GraphQL::Houtou::Type::Union")
$type $type->isa("GraphQL::Houtou::Type::Interface") $type->isa("GraphQL::Houtou::Type::Union")
Truth table75%3/4
A and B or C
A= $typeB= $type->isa("GraphQL::Houtou::Type::Interface")C= $type->isa("GraphQL::Houtou::Type::Union")
ABCresult
0XX0
1000
11X1
1011
765 11432 ▶ if ($type && $type->isa('GraphQL::Houtou::Type::List')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($type and $type->isa("GraphQL::Houtou::Type::List")) 2213 9219 11432
Condition66%2/3
$type and $type->isa("GraphQL::Houtou::Type::List")
!ll&&!rl&&r
092192213
MC/DC50%1/2
$type and $type->isa("GraphQL::Houtou::Type::List")
$type $type->isa("GraphQL::Houtou::Type::List")
Truth table66%2/3
A and B
A= $typeB= $type->isa("GraphQL::Houtou::Type::List")
ABresult
0X0
100
111
766 # A list of an interface/union dispatches per item: the op must carry
767 # the abstract dispatch family or the runtime's member-block selection
768 # never runs for the items.
769 2213 my $inner = _dispatch_family_for_type($type->of);
770 2213 ▶ return $inner if $inner eq 'TAG' || $inner eq 'RESOLVE_TYPE' || $inner eq 'ABSTRACT';
Branch: 1 branch
BranchTrueFalseTotal
if $inner eq "TAG" or $inner eq "RESOLVE_TYPE" or $inner eq "ABSTRACT" 31 2182 2213
Condition66%4/6
$inner eq "TAG" or $inner eq "RESOLVE_TYPE" or $inner eq "ABSTRACT"
l!l&&r!l&&!r
3102182
$inner eq "TAG" or $inner eq "RESOLVE_TYPE"
l!l&&r!l&&!r
3102182
MC/DC33%1/3
$inner eq "TAG" or $inner eq "RESOLVE_TYPE" or $inner eq "ABSTRACT"
$inner eq "TAG" $inner eq "RESOLVE_TYPE" $inner eq "ABSTRACT"
Truth table50%2/4
A or B or C
A= $inner eq "TAG"B= $inner eq "RESOLVE_TYPE"C= $inner eq "ABSTRACT"
ABCresult
1XX1
01X1
0011
0000
771 2182 return 'LIST';
772 }
773 9219 ▶ return 'OBJECT' if $type && $type->isa('GraphQL::Houtou::Type::Object');
Branch: 1 branch
BranchTrueFalseTotal
if $type and $type->isa("GraphQL::Houtou::Type::Object") 3852 5367 9219
Condition66%2/3
$type and $type->isa("GraphQL::Houtou::Type::Object")
!ll&&!rl&&r
053673852
MC/DC50%1/2
$type and $type->isa("GraphQL::Houtou::Type::Object")
$type $type->isa("GraphQL::Houtou::Type::Object")
Truth table66%2/3
A and B
A= $typeB= $type->isa("GraphQL::Houtou::Type::Object")
ABresult
0X0
100
111
774 5367 ▶ return 'ABSTRACT' if $type && ($type->isa('GraphQL::Houtou::Type::Interface') || $type->isa('GraphQL::Houtou::Type::Union'));
Branch: 1 branch
BranchTrueFalseTotal
if $type and $type->isa("GraphQL::Houtou::Type::Interface") || $type->isa("GraphQL::Houtou::Type::Union") 0 5367 5367
Condition33%2/6
$type and $type->isa("GraphQL::Houtou::Type::Interface") || $type->isa("GraphQL::Houtou::Type::Union")
!ll&&!rl&&r
053670
$type->isa("GraphQL::Houtou::Type::Interface") or $type->isa("GraphQL::Houtou::Type::Union")
l!l&&r!l&&!r
005367
MC/DC0%0/3
$type and $type->isa("GraphQL::Houtou::Type::Interface") || $type->isa("GraphQL::Houtou::Type::Union")
$type $type->isa("GraphQL::Houtou::Type::Interface") $type->isa("GraphQL::Houtou::Type::Union")
Truth table25%1/4
A and B or C
A= $typeB= $type->isa("GraphQL::Houtou::Type::Interface")C= $type->isa("GraphQL::Houtou::Type::Union")
ABCresult
0XX0
1000
11X1
1011
775 5367 return 'GENERIC';
776 }
777  
778 9267 ▶sub _type_name {
Subroutine _type_name: called CC=3 SCAR=12.5
779 9267 my ($type) = @_;
780 9267 ▶ return if !$type;
Branch: 1 branch
BranchTrueFalseTotal
unless $type 0 9267 9267
781 9267 ▶ return $type->name if $type->can('name');
Branch: 1 branch
BranchTrueFalseTotal
if $type->can("name") 9267 0 9267
782 0 return;
783 }
784  
785 1875 ▶sub _typedef_for_type {
Subroutine _typedef_for_type: called CC=5 SCAR=16.6
786 1875 my ($type) = @_;
787 1875 ▶ return if !$type;
Branch: 1 branch
BranchTrueFalseTotal
unless $type 0 1875 1875
788 1875 ▶ return { type => ['non_null', _typedef_for_type($type->of)] }
Branch: 1 branch
BranchTrueFalseTotal
if $type->isa("GraphQL::Houtou::Type::NonNull") 239 1636 1875
789 if $type->isa('GraphQL::Houtou::Type::NonNull');
790 1636 ▶ return { type => ['list', _typedef_for_type($type->of)] }
Branch: 1 branch
BranchTrueFalseTotal
if $type->isa("GraphQL::Houtou::Type::List") 34 1602 1636
791 if $type->isa('GraphQL::Houtou::Type::List');
792 1602 ▶ return { type => $type->name } if $type->can('name');
Branch: 1 branch
BranchTrueFalseTotal
if $type->can("name") 1602 0 1602
793 0 return;
794 }
795  
796 62 1;
« blib/lib/GraphQL/Houtou/Runtime/NativeRuntime.pm ↑ Summary blib/lib/GraphQL/Houtou/Federation.pm »