blib/lib/GraphQL/Houtou/XS/Parser.pm

filter: Statementstmt 36.3% 115 / 316 Branchbran 58.3% 21 / 36 Conditioncond 64.7% 11 / 17 MC/DCmcdc 50.0% 5 / 10 Subroutinesub 31.6% 31 / 98 Podpod n/a totaltotal 38.3% 183 / 477 CC 27 SCAR 14.0
CC
27
Cov
40%
_block_string_value
14.3
_line_column
12.6
_materialize
6.0
CRAP 4.0
« blib/lib/GraphQL/Houtou/Internal/TypeSupport.pm ↑ Summary blib/lib/GraphQL/Houtou/Promise/PromiseXS.pm »
1 package GraphQL::Houtou::XS::Parser;
2  
3 86 ▶use 5.014;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 86 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 86 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 86 ▶use GraphQL::Houtou ();
Subroutine BEGIN: called CC=1 SCAR=0.0
7 86 ▶use GraphQL::Houtou::Error ();
Subroutine BEGIN: called CC=1 SCAR=0.0
8 86 ▶use JSON::MaybeXS ();
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 86 our $VERSION = '0.08';
11  
12 86 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
13 86 GraphQL::Houtou::_bootstrap_xs();
14 }
15  
16 package GraphQL::Houtou::Parser::Internal;
17  
18 86 ▶use 5.014;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 86 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 86 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 86 ▶use GraphQL::Houtou::Error ();
Subroutine BEGIN: called CC=1 SCAR=0.0
22 86 ▶use JSON::MaybeXS qw(JSON);
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 77 ▶sub _make_bool {
Subroutine _make_bool: called CC=2 SCAR=6.9
25 # JSON::MaybeXS::true()/false() as bare package-qualified calls only work
26 # when the chosen backend happens to install them into the JSON::MaybeXS
27 # namespace itself - not guaranteed across JSON::MaybeXS versions/backends
28 # (observed failing under JSON::MaybeXS 1.003009 falling back to JSON::PP:
29 # "Undefined subroutine &JSON::MaybeXS::true called"). JSON()->true/false
30 # is the documented, backend-agnostic form already used in Type::Scalar.
31 77 ▶ return $_[0] ? JSON->true : JSON->false;
Branch: 1 branch
BranchTrueFalseTotal
$_[0] ? : 65 12 77
32 }
33  
34 0 ▶sub _string_value {
Subroutine _string_value: not called CC=1 SCAR=6.9
35 0 my ($str) = @_;
36 # https://spec.graphql.org/October2021/#EscapedCharacter
37 0 $str =~ s|\\(["\\/bfnrt])|"qq!\\$1!"|gee;
38 0 return $str;
39 }
40  
41 289 ▶sub _block_string_value {
Subroutine _block_string_value: called CC=14 SCAR=26.6
42 289 my ($str) = @_;
43 # https://spec.graphql.org/October2021/#BlockStringValue()
44 289 my @lines = split(/(?:\n|\r(?!\n)|\r\n)/s, $str);
45 289 ▶ if (1 < @lines) {
Branch: 1 branch
BranchTrueFalseTotal
if (1 < @lines) 73 216 289
46 73 my $common_indent;
47 73 for my $line (@lines[1..$#lines]) {
48 347 my $length = length($line);
49 347 ▶ my $indent = length(($line =~ /^([\t ]*)/)[0] || '');
Condition100%2/2
($line =~ /^([\t ]*)/u)[0] || ''
l!l
3389
MC/DC100%1/1
($line =~ /^([\t ]*)/u)[0] || ''
($line =~ /^([\t ]*)/u)[0]
Truth table100%2/2
A
A= ($line =~ /^([\t ]*)/u)[0]
Aresult
11
00
50 347 ▶ if ($indent < $length && (!defined($common_indent) || $indent < $common_indent)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($indent < $length and !defined($common_indent) || $indent < $common_indent) 73 274 347
Condition83%5/6
$indent < $length and !defined($common_indent) || $indent < $common_indent
!ll&&!rl&&r
7020473
not defined $common_indent or $indent < $common_indent
l!l&&r!l&&!r
730204
MC/DC66%2/3
$indent < $length and !defined($common_indent) || $indent < $common_indent
$indent < $length not defined $common_indent $indent < $common_indent
Truth table75%3/4
A and not(B) or C
A= $indent < $lengthB= not defined $common_indentC= $indent < $common_indent
ABCresult
0XX0
1000
11X1
1011
51 73 $common_indent = $indent;
52 }
53 }
54 73 ▶ if (defined $common_indent) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $common_indent) 73 0 73
55 73 for my $line (@lines[1..$#lines]) {
56 347 $line =~ s/^[\t ]{0,$common_indent}//;
57 }
58 }
59 }
60 289 my ($start, $end);
61 289 ▶ for ($start = 0; $start < @lines && $lines[$start] =~ /^[\t ]*$/; ++$start) {}
Branch: 1 branch
BranchTrueFalseTotal
if ($start < @lines and $lines[$start] =~ /^[\t ]*$/u) 74 289 363
Condition66%2/3
$start < @lines and $lines[$start] =~ /^[\t ]*$/u
!ll&&!rl&&r
028974
MC/DC50%1/2
$start < @lines and $lines[$start] =~ /^[\t ]*$/u
$start < @lines $lines[$start] =~ /^[\t ]*$/u
Truth table66%2/3
A and B
A= $start < @linesB= $lines[$start] =~ /^[\t ]*$/u
ABresult
0X0
100
111
62 289 ▶ for ($end = $#lines; $end >= 0 && $lines[$end] =~ /^[\t ]*$/; --$end) {}
Branch: 1 branch
BranchTrueFalseTotal
if ($end >= 0 and $lines[$end] =~ /^[\t ]*$/u) 69 289 358
Condition66%2/3
$end >= 0 and $lines[$end] =~ /^[\t ]*$/u
!ll&&!rl&&r
028969
MC/DC50%1/2
$end >= 0 and $lines[$end] =~ /^[\t ]*$/u
$end >= 0 $lines[$end] =~ /^[\t ]*$/u
Truth table66%2/3
A and B
A= $end >= 0B= $lines[$end] =~ /^[\t ]*$/u
ABresult
0X0
100
111
63 289 ▶ @lines = $start <= $end ? @lines[$start..$end] : ();
Branch: 1 branch
BranchTrueFalseTotal
$start <= $end ? : 289 0 289
64 289 my $formatted = join("\n", @lines);
65 289 $formatted =~ s/\\"""/"""/g;
66 289 return $formatted;
67 }
68  
69 34 ▶sub _format_error {
Subroutine _format_error: called CC=3 SCAR=11.0
70 34 my ($source, $position, $msg) = @_;
71 34 my ($line, $column) = _line_column($source, $position);
72 34 ▶ my $pretext = substr(
Branch: 2 branches
BranchTrueFalseTotal
$position < 50 ? : 27 7 34
$position < 50 ? : 27 7 34
73 $source,
74 $position < 50 ? 0 : $position - 50,
75 $position < 50 ? $position : 50,
76 );
77 34 my $context = substr($source, $position, 50);
78 34 $pretext =~ s/.*\n//gs;
79 34 $context =~ s/\n/\\n/g;
80 34 return GraphQL::Houtou::Error->new(
81 locations => [ { line => $line, column => $column } ],
82 message => <<EOF,
83 Error parsing Pegex document:
84 msg: $msg
85 context: $pretext$context
86 34 ${\ (' ' x (length($pretext)) . '^')}
87 position: $position (0 pre-lookahead)
88 EOF
89 );
90 }
91  
92 34 ▶sub _line_column {
Subroutine _line_column: called CC=7 SCAR=25.3
93 34 my ($source, $position) = @_;
94 34 my $line = 1;
95 34 my $column = 1;
96 34 my $i = 0;
97 34 my $length = length $source;
98 34 ▶ $position = $length if $position > $length;
Branch: 1 branch
BranchTrueFalseTotal
if $position > $length 0 34 34
99 34 ▶ while ($i < $position) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $position) 4960 34 4994
100 4960 my $char = substr($source, $i, 1);
101 4960 ▶ if ($char eq "\r") {
Branch: 1 branch
BranchTrueFalseTotal
if ($char eq "\r") 0 4960 4960
102 0 ++$line;
103 0 $column = 1;
104 0 ++$i;
105 0 ▶ ++$i if $i < $position && substr($source, $i, 1) eq "\n";
Branch: 1 branch
BranchTrueFalseTotal
if $i < $position and substr($source, $i, 1) eq "\n" 0 0 0
Condition0%0/3
$i < $position and substr($source, $i, 1) eq "\n"
!ll&&!rl&&r
000
MC/DC0%0/2
$i < $position and substr($source, $i, 1) eq "\n"
$i < $position substr($source, $i, 1) eq "\n"
Truth table0%0/3
A and B
A= $i < $positionB= substr($source, $i, 1) eq "\n"
ABresult
0X0
100
111
106 0 next;
107 }
108 4960 ▶ if ($char eq "\n") {
Branch: 1 branch
BranchTrueFalseTotal
if ($char eq "\n") 0 4960 4960
109 0 ++$line;
110 0 $column = 1;
111 0 ++$i;
112 0 next;
113 }
114 4960 ++$column;
115 4960 ++$i;
116 }
117 34 return ($line, $column);
118 }
119  
120 0 ▶sub _new_lazy_array_ref {
Subroutine _new_lazy_array_ref: not called CC=1 SCAR=6.9
121 0 my ($class, $state, $ptr) = @_;
122 0 my @items;
123 0 tie @items, $class, $state, $ptr;
124 0 return \@items;
125 }
126  
127 0 ▶sub _new_lazy_array_tie {
Subroutine _new_lazy_array_tie: not called CC=1 SCAR=6.9
128 0 my ($class, $state, $ptr, $kind) = @_;
129 # NOTE: these keys are part of the XS fast-path contract in gql_parser_fetch_array().
130 # If you rename them, update the XS reader and the contract test together.
131 0 return bless {
132 state => $state,
133 ptr => $ptr,
134 kind => $kind,
135 data => undef,
136 }, $class;
137 }
138  
139 package GraphQL::Houtou::Parser::Internal::LazyLoc;
140  
141 86 ▶use 5.014;
Subroutine BEGIN: called CC=1 SCAR=0.0
142 86 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
143 86 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
144  
145 0 ▶sub start {
Subroutine start: not called CC=1 SCAR=6.9
146 0 return $_[0][0];
147 }
148  
149 0 ▶sub as_hash {
Subroutine as_hash: not called CC=1 SCAR=6.9
150 0 my ($self, $source) = @_;
151 0 my ($line, $column) = GraphQL::Houtou::Parser::Internal::_line_column($source, $self->[0]);
152 return {
153 0 line => $line,
154 column => $column,
155 };
156 }
157  
158 0 ▶sub line {
Subroutine line: not called CC=1 SCAR=6.9
159 0 my ($self, $source) = @_;
160 0 my ($line) = GraphQL::Houtou::Parser::Internal::_line_column($source, $self->[0]);
161 0 return $line;
162 }
163  
164 0 ▶sub column {
Subroutine column: not called CC=1 SCAR=6.9
165 0 my ($self, $source) = @_;
166 0 my (undef, $column) = GraphQL::Houtou::Parser::Internal::_line_column($source, $self->[0]);
167 0 return $column;
168 }
169  
170 package GraphQL::Houtou::Parser::Internal::LazyArray::Arguments;
171  
172 86 ▶use 5.014;
Subroutine BEGIN: called CC=1 SCAR=0.0
173 86 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
174 86 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
175  
176 0 ▶sub _new {
Subroutine _new: not called CC=1 SCAR=6.9
177 0 my ($state, $ptr) = @_;
178 0 return GraphQL::Houtou::Parser::Internal::_new_lazy_array_ref(__PACKAGE__, $state, $ptr);
179 }
180  
181 0 ▶sub TIEARRAY {
Subroutine TIEARRAY: not called CC=1 SCAR=6.9
182 0 my ($class, $state, $ptr) = @_;
183 0 return GraphQL::Houtou::Parser::Internal::_new_lazy_array_tie($class, $state, $ptr, 1);
184 }
185  
186 0 ▶sub _materialize {
Subroutine _materialize: not called CC=2 SCAR=17.9
187 0 my ($self) = @_;
188 0 ▶ return $self->{data} if $self->{data};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"data"} 0 0 0
189 $self->{data} = GraphQL::Houtou::XS::Parser::_materialize_arguments_xs(
190 $self->{state},
191 $self->{ptr},
192 0 );
193 0 return $self->{data};
194 }
195  
196 0 ▶sub FETCHSIZE {
Subroutine FETCHSIZE: not called CC=1 SCAR=6.9
197 0 my ($self) = @_;
198 0 return scalar @{ $self->_materialize };
199 }
200  
201 0 ▶sub STORESIZE {
Subroutine STORESIZE: not called CC=1 SCAR=6.9
202 0 my ($self, $count) = @_;
203 0 $#{ $self->_materialize } = $count - 1;
204 0 return;
205 }
206  
207 0 ▶sub FETCH {
Subroutine FETCH: not called CC=1 SCAR=6.9
208 0 my ($self, $index) = @_;
209 0 return $self->_materialize->[$index];
210 }
211  
212 0 ▶sub STORE {
Subroutine STORE: not called CC=1 SCAR=6.9
213 0 my ($self, $index, $value) = @_;
214 0 $self->_materialize->[$index] = $value;
215 0 return $value;
216 }
217  
218 0 ▶sub CLEAR {
Subroutine CLEAR: not called CC=1 SCAR=6.9
219 0 my ($self) = @_;
220 0 @{ $self->_materialize } = ();
221 0 return;
222 }
223  
224 0 ▶sub PUSH {
Subroutine PUSH: not called CC=1 SCAR=6.9
225 0 my ($self, @values) = @_;
226 0 return push @{ $self->_materialize }, @values;
227 }
228  
229 0 ▶sub POP {
Subroutine POP: not called CC=1 SCAR=6.9
230 0 my ($self) = @_;
231 0 return pop @{ $self->_materialize };
232 }
233  
234 0 ▶sub SHIFT {
Subroutine SHIFT: not called CC=1 SCAR=6.9
235 0 my ($self) = @_;
236 0 return shift @{ $self->_materialize };
237 }
238  
239 0 ▶sub UNSHIFT {
Subroutine UNSHIFT: not called CC=1 SCAR=6.9
240 0 my ($self, @values) = @_;
241 0 return unshift @{ $self->_materialize }, @values;
242 }
243  
244 0 ▶sub EXISTS {
Subroutine EXISTS: not called CC=1 SCAR=6.9
245 0 my ($self, $index) = @_;
246 0 return exists $self->_materialize->[$index];
247 }
248  
249 0 ▶sub DELETE {
Subroutine DELETE: not called CC=1 SCAR=6.9
250 0 my ($self, $index) = @_;
251 0 return delete $self->_materialize->[$index];
252 }
253  
254 0 ▶sub SPLICE {
Subroutine SPLICE: not called CC=1 SCAR=6.9
255 0 my $self = shift;
256 0 return splice @{ $self->_materialize }, @_;
257 }
258  
259 package GraphQL::Houtou::Parser::Internal::LazyArray::Directives;
260  
261 86 ▶use 5.014;
Subroutine BEGIN: called CC=1 SCAR=0.0
262 86 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
263 86 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
264  
265 0 ▶sub _new {
Subroutine _new: not called CC=1 SCAR=6.9
266 0 my ($state, $ptr) = @_;
267 0 return GraphQL::Houtou::Parser::Internal::_new_lazy_array_ref(__PACKAGE__, $state, $ptr);
268 }
269  
270 0 ▶sub TIEARRAY {
Subroutine TIEARRAY: not called CC=1 SCAR=6.9
271 0 my ($class, $state, $ptr) = @_;
272 0 return GraphQL::Houtou::Parser::Internal::_new_lazy_array_tie($class, $state, $ptr, 2);
273 }
274  
275 0 ▶sub _materialize {
Subroutine _materialize: not called CC=2 SCAR=17.9
276 0 my ($self) = @_;
277 0 ▶ return $self->{data} if $self->{data};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"data"} 0 0 0
278 $self->{data} = GraphQL::Houtou::XS::Parser::_materialize_directives_xs(
279 $self->{state},
280 $self->{ptr},
281 0 );
282 0 return $self->{data};
283 }
284  
285 0 ▶sub FETCHSIZE {
Subroutine FETCHSIZE: not called CC=1 SCAR=6.9
286 0 my ($self) = @_;
287 0 return scalar @{ $self->_materialize };
288 }
289  
290 0 ▶sub STORESIZE {
Subroutine STORESIZE: not called CC=1 SCAR=6.9
291 0 my ($self, $count) = @_;
292 0 $#{ $self->_materialize } = $count - 1;
293 0 return;
294 }
295  
296 0 ▶sub FETCH {
Subroutine FETCH: not called CC=1 SCAR=6.9
297 0 my ($self, $index) = @_;
298 0 return $self->_materialize->[$index];
299 }
300  
301 0 ▶sub STORE {
Subroutine STORE: not called CC=1 SCAR=6.9
302 0 my ($self, $index, $value) = @_;
303 0 $self->_materialize->[$index] = $value;
304 0 return $value;
305 }
306  
307 0 ▶sub CLEAR {
Subroutine CLEAR: not called CC=1 SCAR=6.9
308 0 my ($self) = @_;
309 0 @{ $self->_materialize } = ();
310 0 return;
311 }
312  
313 0 ▶sub PUSH {
Subroutine PUSH: not called CC=1 SCAR=6.9
314 0 my ($self, @values) = @_;
315 0 return push @{ $self->_materialize }, @values;
316 }
317  
318 0 ▶sub POP {
Subroutine POP: not called CC=1 SCAR=6.9
319 0 my ($self) = @_;
320 0 return pop @{ $self->_materialize };
321 }
322  
323 0 ▶sub SHIFT {
Subroutine SHIFT: not called CC=1 SCAR=6.9
324 0 my ($self) = @_;
325 0 return shift @{ $self->_materialize };
326 }
327  
328 0 ▶sub UNSHIFT {
Subroutine UNSHIFT: not called CC=1 SCAR=6.9
329 0 my ($self, @values) = @_;
330 0 return unshift @{ $self->_materialize }, @values;
331 }
332  
333 0 ▶sub EXISTS {
Subroutine EXISTS: not called CC=1 SCAR=6.9
334 0 my ($self, $index) = @_;
335 0 return exists $self->_materialize->[$index];
336 }
337  
338 0 ▶sub DELETE {
Subroutine DELETE: not called CC=1 SCAR=6.9
339 0 my ($self, $index) = @_;
340 0 return delete $self->_materialize->[$index];
341 }
342  
343 0 ▶sub SPLICE {
Subroutine SPLICE: not called CC=1 SCAR=6.9
344 0 my $self = shift;
345 0 return splice @{ $self->_materialize }, @_;
346 }
347  
348 package GraphQL::Houtou::Parser::Internal::LazyArray::VariableDefinitions;
349  
350 86 ▶use 5.014;
Subroutine BEGIN: called CC=1 SCAR=0.0
351 86 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
352 86 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
353  
354 0 ▶sub _new {
Subroutine _new: not called CC=1 SCAR=6.9
355 0 my ($state, $ptr) = @_;
356 0 return GraphQL::Houtou::Parser::Internal::_new_lazy_array_ref(__PACKAGE__, $state, $ptr);
357 }
358  
359 0 ▶sub TIEARRAY {
Subroutine TIEARRAY: not called CC=1 SCAR=6.9
360 0 my ($class, $state, $ptr) = @_;
361 0 return GraphQL::Houtou::Parser::Internal::_new_lazy_array_tie($class, $state, $ptr, 3);
362 }
363  
364 0 ▶sub _materialize {
Subroutine _materialize: not called CC=2 SCAR=17.9
365 0 my ($self) = @_;
366 0 ▶ return $self->{data} if $self->{data};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"data"} 0 0 0
367 $self->{data} = GraphQL::Houtou::XS::Parser::_materialize_variable_definitions_xs(
368 $self->{state},
369 $self->{ptr},
370 0 );
371 0 return $self->{data};
372 }
373  
374 0 ▶sub FETCHSIZE {
Subroutine FETCHSIZE: not called CC=1 SCAR=6.9
375 0 my ($self) = @_;
376 0 return scalar @{ $self->_materialize };
377 }
378  
379 0 ▶sub STORESIZE {
Subroutine STORESIZE: not called CC=1 SCAR=6.9
380 0 my ($self, $count) = @_;
381 0 $#{ $self->_materialize } = $count - 1;
382 0 return;
383 }
384  
385 0 ▶sub FETCH {
Subroutine FETCH: not called CC=1 SCAR=6.9
386 0 my ($self, $index) = @_;
387 0 return $self->_materialize->[$index];
388 }
389  
390 0 ▶sub STORE {
Subroutine STORE: not called CC=1 SCAR=6.9
391 0 my ($self, $index, $value) = @_;
392 0 $self->_materialize->[$index] = $value;
393 0 return $value;
394 }
395  
396 0 ▶sub CLEAR {
Subroutine CLEAR: not called CC=1 SCAR=6.9
397 0 my ($self) = @_;
398 0 @{ $self->_materialize } = ();
399 0 return;
400 }
401  
402 0 ▶sub PUSH {
Subroutine PUSH: not called CC=1 SCAR=6.9
403 0 my ($self, @values) = @_;
404 0 return push @{ $self->_materialize }, @values;
405 }
406  
407 0 ▶sub POP {
Subroutine POP: not called CC=1 SCAR=6.9
408 0 my ($self) = @_;
409 0 return pop @{ $self->_materialize };
410 }
411  
412 0 ▶sub SHIFT {
Subroutine SHIFT: not called CC=1 SCAR=6.9
413 0 my ($self) = @_;
414 0 return shift @{ $self->_materialize };
415 }
416  
417 0 ▶sub UNSHIFT {
Subroutine UNSHIFT: not called CC=1 SCAR=6.9
418 0 my ($self, @values) = @_;
419 0 return unshift @{ $self->_materialize }, @values;
420 }
421  
422 0 ▶sub EXISTS {
Subroutine EXISTS: not called CC=1 SCAR=6.9
423 0 my ($self, $index) = @_;
424 0 return exists $self->_materialize->[$index];
425 }
426  
427 0 ▶sub DELETE {
Subroutine DELETE: not called CC=1 SCAR=6.9
428 0 my ($self, $index) = @_;
429 0 return delete $self->_materialize->[$index];
430 }
431  
432 0 ▶sub SPLICE {
Subroutine SPLICE: not called CC=1 SCAR=6.9
433 0 my $self = shift;
434 0 return splice @{ $self->_materialize }, @_;
435 }
436  
437 package GraphQL::Houtou::Parser::Internal::LazyArray::ObjectFields;
438  
439 86 ▶use 5.014;
Subroutine BEGIN: called CC=1 SCAR=0.0
440 86 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
441 86 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
442  
443 0 ▶sub _new {
Subroutine _new: not called CC=1 SCAR=6.9
444 0 my ($state, $ptr) = @_;
445 0 return GraphQL::Houtou::Parser::Internal::_new_lazy_array_ref(__PACKAGE__, $state, $ptr);
446 }
447  
448 0 ▶sub TIEARRAY {
Subroutine TIEARRAY: not called CC=1 SCAR=6.9
449 0 my ($class, $state, $ptr) = @_;
450 0 return GraphQL::Houtou::Parser::Internal::_new_lazy_array_tie($class, $state, $ptr, 4);
451 }
452  
453 0 ▶sub _materialize {
Subroutine _materialize: not called CC=2 SCAR=17.9
454 0 my ($self) = @_;
455 0 ▶ return $self->{data} if $self->{data};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"data"} 0 0 0
456 $self->{data} = GraphQL::Houtou::XS::Parser::_materialize_object_fields_xs(
457 $self->{state},
458 $self->{ptr},
459 0 );
460 0 return $self->{data};
461 }
462  
463 0 ▶sub FETCHSIZE {
Subroutine FETCHSIZE: not called CC=1 SCAR=6.9
464 0 my ($self) = @_;
465 0 return scalar @{ $self->_materialize };
466 }
467  
468 0 ▶sub STORESIZE {
Subroutine STORESIZE: not called CC=1 SCAR=6.9
469 0 my ($self, $count) = @_;
470 0 $#{ $self->_materialize } = $count - 1;
471 0 return;
472 }
473  
474 0 ▶sub FETCH {
Subroutine FETCH: not called CC=1 SCAR=6.9
475 0 my ($self, $index) = @_;
476 0 return $self->_materialize->[$index];
477 }
478  
479 0 ▶sub STORE {
Subroutine STORE: not called CC=1 SCAR=6.9
480 0 my ($self, $index, $value) = @_;
481 0 $self->_materialize->[$index] = $value;
482 0 return $value;
483 }
484  
485 0 ▶sub CLEAR {
Subroutine CLEAR: not called CC=1 SCAR=6.9
486 0 my ($self) = @_;
487 0 @{ $self->_materialize } = ();
488 0 return;
489 }
490  
491 0 ▶sub PUSH {
Subroutine PUSH: not called CC=1 SCAR=6.9
492 0 my ($self, @values) = @_;
493 0 return push @{ $self->_materialize }, @values;
494 }
495  
496 0 ▶sub POP {
Subroutine POP: not called CC=1 SCAR=6.9
497 0 my ($self) = @_;
498 0 return pop @{ $self->_materialize };
499 }
500  
501 0 ▶sub SHIFT {
Subroutine SHIFT: not called CC=1 SCAR=6.9
502 0 my ($self) = @_;
503 0 return shift @{ $self->_materialize };
504 }
505  
506 0 ▶sub UNSHIFT {
Subroutine UNSHIFT: not called CC=1 SCAR=6.9
507 0 my ($self, @values) = @_;
508 0 return unshift @{ $self->_materialize }, @values;
509 }
510  
511 0 ▶sub EXISTS {
Subroutine EXISTS: not called CC=1 SCAR=6.9
512 0 my ($self, $index) = @_;
513 0 return exists $self->_materialize->[$index];
514 }
515  
516 0 ▶sub DELETE {
Subroutine DELETE: not called CC=1 SCAR=6.9
517 0 my ($self, $index) = @_;
518 0 return delete $self->_materialize->[$index];
519 }
520  
521 0 ▶sub SPLICE {
Subroutine SPLICE: not called CC=1 SCAR=6.9
522 0 my $self = shift;
523 0 return splice @{ $self->_materialize }, @_;
524 }
525  
526 86 1;
« blib/lib/GraphQL/Houtou/Internal/TypeSupport.pm ↑ Summary blib/lib/GraphQL/Houtou/Promise/PromiseXS.pm »