| 1 |
|
| package GraphQL::Language::Receiver; |
| 2 |
|
| |
| 3 |
21 |
▶ | use 5.014; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 4 |
21 |
▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 5 |
21 |
▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 6 |
21 |
▶ | use base 'Pegex::Receiver'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 7 |
21 |
▶ | use Types::Standard -all; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 8 |
21 |
▶ | use GraphQL::MaybeTypeCheck; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 9 |
21 |
▶ | use JSON::MaybeXS; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 10 |
21 |
▶ | use Carp; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 11 |
|
| |
| 12 |
21 |
| my $JSON = JSON::MaybeXS->new->allow_nonref->canonical; |
| 13 |
|
| |
| 14 |
21 |
| my @KINDHASH = qw( |
| 15 |
|
| scalar |
| 16 |
|
| union |
| 17 |
|
| field |
| 18 |
|
| inline_fragment |
| 19 |
|
| fragment_spread |
| 20 |
|
| fragment |
| 21 |
|
| directive |
| 22 |
|
| ); |
| 23 |
21 |
| my %KINDHASH21 = map { ($_ => 1) } @KINDHASH; |
| 24 |
|
| |
| 25 |
21 |
| my @KINDFIELDS = qw( |
| 26 |
|
| type |
| 27 |
|
| input |
| 28 |
|
| interface |
| 29 |
|
| ); |
| 30 |
21 |
| my %KINDFIELDS21 = map { ($_ => 1) } @KINDFIELDS; |
| 31 |
|
| |
| 32 |
|
| =head1 NAME |
| 33 |
|
| |
| 34 |
|
| GraphQL::Language::Receiver - GraphQL Pegex AST constructor |
| 35 |
|
| |
| 36 |
|
| =head1 VERSION |
| 37 |
|
| |
| 38 |
|
| Version 0.02 |
| 39 |
|
| |
| 40 |
|
| =cut |
| 41 |
|
| |
| 42 |
21 |
| our $VERSION = '0.02'; |
| 43 |
|
| |
| 44 |
|
| =head1 SYNOPSIS |
| 45 |
|
| |
| 46 |
|
| # this class used internally by: |
| 47 |
|
| use GraphQL::Language::Parser qw(parse); |
| 48 |
|
| my $parsed = parse($source); |
| 49 |
|
| |
| 50 |
|
| =head1 DESCRIPTION |
| 51 |
|
| |
| 52 |
|
| Subclass of L<Pegex::Receiver> to turn Pegex parsing events into data |
| 53 |
|
| usable by GraphQL. |
| 54 |
|
| |
| 55 |
|
| =cut |
| 56 |
|
| |
| 57 |
10492 |
▶ | method gotrule (Any $param = undef) { |
|
Subroutine
gotrule: called CC=6 SCAR=18.0
Pod
documented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method gotrule (expected 1, got ' . @_ . ')') |
0 |
10492 |
10492 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method gotrule (expected 2, got ' . @_ . ')') |
0 |
10492 |
10492 |
|
| 58 |
10492 |
▶ | return unless defined $param; |
Branch: 1 branch
| Branch | True | False | Total |
| unless defined $param |
6093 |
4399 |
10492 |
|
| 59 |
4399 |
▶ | if ($KINDHASH21{$self->{parser}{rule}}) { |
Branch: 2 branches
| Branch | True | False | Total |
| if ($KINDHASH21{$self->{'parser'}{'rule'}}) { } |
878 |
3521 |
4399 |
| elsif ($KINDFIELDS21{$self->{'parser'}{'rule'}}) { } |
107 |
3414 |
3521 |
|
| 60 |
878 |
| return {kind => $self->{parser}{rule}, %{$self->_locate_hash(_merge_hash($param))}}; |
| 61 |
|
| } elsif ($KINDFIELDS21{$self->{parser}{rule}}) { |
| 62 |
107 |
| return {kind => $self->{parser}{rule}, %{$self->_locate_hash(_merge_hash($param, 'fields'))}}; |
| 63 |
|
| } |
| 64 |
3414 |
| return {$self->{parser}{rule} => $param}; |
| 65 |
21 |
| } |
| 66 |
|
| |
| 67 |
1321 |
▶ | method _locate_hash(HashRef $hash) { |
|
Subroutine
_locate_hash: called CC=4 SCAR=14.2
Branch: 3 branches
| Branch | True | False | Total |
| @_ < 2 and Function::Parameters::_croak('Too few arguments for method _locate_hash (expected 2, got ' . @_ . ')') |
0 |
1321 |
1321 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method _locate_hash (expected 2, got ' . @_ . ')') |
0 |
1321 |
1321 |
| Ref::Util::XS::is_plain_hashref($hash) or Function::Parameters::_croak('In method _locate_hash: parameter 1 ($hash): ' . ${my $v = bless( {"_is_core" => 1,"_overload_coderef" => sub { package Sub::Defer; use warnings; use strict; $undeferred ||= undefer_sub($deferred_info->[4]); goto \&$undeferred;},"_overload_coderef_no_rebuild" => 1,"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_HashRef","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"coercion_generator" => sub { package Types::Standard::HashRef; no warnings; use strict; my($parent, $child, $param) = @_; return unless $param->has_coercion; my $coercable_item = $param->coercion->_source_type_union; my $C = 'Type::Coercion'->new('type_constraint', $child); if ($param->coercion->can_be_inlined and $coercable_item->can_be_inlined) { $C->add_type_coercions($parent, &Types::Standard::Stringable(sub { my @code; push @code, 'do { my ($orig, $return_orig, %new) = ($_, 0);'; push @code, 'for (keys %$orig) {'; push @code, sprintf('$return_orig++ && last unless (%s);', $coercable_item->inline_check('$orig->{$_}')); push @code, sprintf('$new{$_} = (%s);', $param->coercion->inline_coercion('$orig->{$_}')); push @code, '}'; push @code, '$return_orig ? $orig : \\%new'; push @code, '}'; join $", @code; } )); } else { $C->add_type_coercions($parent, sub { my $value = @_ ? $_[0] : $_; my %new; foreach my $k (keys %$value) { return $value unless $coercable_item->check($value->{$k}); $new{$k} = $param->coerce($value->{$k}); } return \%new; } ); } return $C;},"compiled_type_constraint" => do{my $o},"constraint" => sub { package Types::Standard; no warnings; use strict; ref $_ eq 'HASH';},"constraint_generator" => sub { package Types::Standard::HashRef; no warnings; use strict; return &Types::Standard::HashRef() unless @_; require Error::TypeTiny::WrongNumberOfParameters; Type::Tiny::check_parameter_count_for_parameterized_type('Types::Standard', 'HashRef', \@_, 1); my $param = shift(); Types::TypeTiny::is_TypeTiny($param) or _croak "Parameter to HashRef[`a] expected to be a type constraint; got $param"; my $param_compiled_check = $param->compiled_check; my $xsub; do { my $paramname = Type::Tiny::XS::is_known($param_compiled_check); $xsub = Type::Tiny::XS::get_coderef_for("HashRef[$paramname]") if $paramname }; return sub { my $hash = shift(); ($param->check($_) or return) foreach (values %$hash); return !0; } , $xsub;},"deep_explanation" => sub { package Types::Standard::HashRef; no warnings; use strict; require B; my($type, $value, $varname) = @_; my $param = $type->parameters->[0]; foreach my $k (sort keys %$value) { my $item = $value->{$k}; next if $param->check($item); return [sprintf('"%s" constrains each value in the hash with "%s"', $type, $param), @{$param->validate_explain($item, sprintf('%s->{%s}', $varname, B::perlstring($k)));}]; } return;},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 544,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "HashRef","exception_class" => "Error::TypeTiny::Assertion","inline_generator" => sub { package Types::Standard::HashRef; no warnings; use strict; my $param = shift(); my $compiled = $param->compiled_check; my $xsubname; unless ($Type::Tiny::AvoidCallbacks) { my $paramname = Type::Tiny::XS::is_known($compiled); $xsubname = Type::Tiny::XS::get_subname_for("HashRef[$paramname]"); } return unless $param->can_be_inlined; return sub { my $v = $_[1]; return "$xsubname($v)" if $xsubname and not $Type::Tiny::AvoidCallbacks; my $p = &Types::Standard::HashRef()->inline_check($v); my $param_check = $param->inline_check('$i'); "$p and do { " . 'my $ok = 1; ' . "for my \$i (values %{$v}) { " . "(\$ok = 0, last) unless $param_check " . '}; ' . '$ok ' . '}'; } ;},"inlined" => sub { package Types::Standard; no warnings; use strict; !$Type::Tiny::AvoidCallbacks ? "Ref::Util::XS::is_plain_hashref($_[1])" : "ref($_[1]) eq 'HASH'";},"library" => "Types::Standard","my_methods" => {"hashref_allows_key" => sub { package Types::Standard::HashRef; no warnings; use strict; my $self = shift(); Types::Standard::is_Str($_[0]);},"hashref_allows_value" => sub { package Types::Standard::HashRef; no warnings; use strict; my $self = shift(); my($key, $value) = @_; return !1 unless $self->my_hashref_allows_key($key); return !0 if $self == &Types::Standard::HashRef(); my $href = $self->find_parent(sub { $_->has_parent and $_->parent == &Types::Standard::HashRef(); } ); my $param = $href->type_parameter; Types::Standard::is_Str($key) and $param->check($value);}},"name" => "HashRef","name_generator" => sub { package Type::Tiny; use warnings; use strict; defined $_ and s/[\x00-\x1F]//gms foreach (my($s, @a) = @_); sprintf '%s[%s]', $s, join(',', map((!defined($_) ? 'undef' : (!ref($_) && /\W/ ? B::perlstring($_) : $_)), @a));},"parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00"} use strict; not ref $_[0] and _failed_check(16, 'Ref', $_[0], 'exception_class', 'Error::TypeTiny::Assertion'); $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Ref","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"constraint" => sub { package Types::Standard; no warnings; use strict; ref $_;},"constraint_generator" => sub { package Types::Standard; no warnings; use strict; return $meta->get_type('Ref') unless @_; Type::Tiny::check_parameter_count_for_parameterized_type('Types::Standard', 'Ref', \@_, 1); my $reftype = shift(); $reftype =~ /^(SCALAR|ARRAY|HASH|CODE|REF|GLOB|LVALUE|FORMAT|IO|VSTRING|REGEXP|Regexp)$/i or _croak "Parameter to Ref[`a] expected to be a Perl ref type; got $reftype"; $reftype = "$reftype"; return sub { ref $_[0] and builtin::reftype($_[0]) eq $reftype; } ;},"deep_explanation" => sub { package Types::Standard; no warnings; use strict; require B; my($type, $value, $varname) = @_; my $param = $type->parameters->[0]; return if $type->check($value); my $reftype = builtin::reftype($value); return [sprintf('"%s" constrains reftype(%s) to be equal to %s', $type, $varname, B::perlstring($param)), sprintf('reftype(%s) is %s', $varname, defined $reftype ? B::perlstring($reftype) : 'undef')];},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 438,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Ref","exception_class" => "Error::TypeTiny::Assertion","inline_generator" => sub { package Types::Standard; no warnings; use strict; my $reftype = shift(); return sub { my $v = $_[1]; &$maybe_load_modules('Scalar::Util', "ref($v) and Scalar::Util::reftype($v) eq q($reftype)"); } ;},"inlined" => sub { package Types::Standard; no warnings; use strict; "!!ref($_[1])";},"library" => "Types::Standard","name" => "Ref","parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00"} use strict; defined $_[0] or _failed_check(7, 'Defined', $_[0], 'exception_class', 'Error::TypeTiny::Assertion'); $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Defined","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"complementary_type" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00"} use strict; defined $_[0] and _failed_check(6, 'Undef', $_[0], 'exception_class', 'Error::TypeTiny::Assertion'); $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Undef","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"complementary_type" => {},"constraint" => sub { package Types::Standard; no warnings; use strict; not defined $_;},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 254,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Undef","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; "!defined($_[1])";},"library" => "Types::Standard","name" => "Undef","parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00"} use strict; '???'; $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Item","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"constraint" => sub { package Type::Tiny; use warnings; use strict; !0;},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 226,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Item","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; '!!1';},"library" => "Types::Standard","name" => "Item","parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Sub::Defer; use warnings; use strict; $undeferred ||= undefer_sub($deferred_info->[4]); goto \&$undeferred;},"_overload_coderef_no_rebuild" => 1,"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => do{my $o},"display_name" => "to_Any","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"complement_name" => "None","constraint" => do{my $o},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 220,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Any","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; '!!1';},"library" => "Types::Standard","name" => "Any","type_default" => sub { package Types::Standard; no warnings; use strict; return undef;},"uniq" => 1}, 'Type::Tiny' ),"uniq" => 2}, 'Type::Tiny' ),"type_default" => sub { package Types::Standard; no warnings; use strict; return undef;},"uniq" => 6}, 'Type::Tiny' ),"constraint" => sub { package Types::Standard; no warnings; use strict; defined $_;},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 262,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Defined","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; "defined($_[1])";},"library" => "Types::Standard","name" => "Defined","parent" => {},"uniq" => 7}, 'Type::Tiny' ),"uniq" => 16}, 'Type::Tiny' ),"type_default" => sub { package Types::Standard; no warnings; use strict; return {};},"type_default_generator" => sub { package Types::Standard; no warnings; use strict; return $Type::Tiny::parameterize_type->type_default if @_ < 2; return undef;},"uniq" => 22}, 'Type::Tiny' );$v->{"coercion"}{"type_constraint"} = $v;$v->{"compiled_type_constraint"} = $v->{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"coercion"}{"type_constraint"} = $v->{"parent"};$v->{"parent"}{"compiled_type_constraint"} = $v->{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"coercion"}{"type_constraint"} = $v->{"parent"}{"parent"};$v->{"parent"}{"parent"}{"compiled_type_constraint"} = $v->{"parent"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"complementary_type"}{"coercion"}{"type_constraint"} = $v->{"parent"}{"parent"}{"complementary_type"};$v->{"parent"}{"parent"}{"complementary_type"}{"compiled_type_constraint"} = $v->{"parent"}{"parent"}{"complementary_type"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"complementary_type"}{"complementary_type"} = $v->{"parent"}{"parent"};$v->{"parent"}{"parent"}{"complementary_type"}{"parent"}{"coercion"}{"type_constraint"} = $v->{"parent"}{"parent"}{"complementary_type"}{"parent"};$v->{"parent"}{"parent"}{"complementary_type"}{"parent"}{"compiled_type_constraint"} = $v->{"parent"}{"parent"}{"complementary_type"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"complementary_type"}{"parent"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"} = $v->{"parent"}{"parent"}{"complementary_type"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"complementary_type"}{"parent"}{"parent"}{"coercion"}{"type_constraint"} = $v->{"parent"}{"parent"}{"complementary_type"}{"parent"}{"parent"};$v->{"parent"}{"parent"}{"complementary_type"}{"parent"}{"parent"}{"compiled_type_constraint"} = $v->{"parent"}{"parent"}{"complementary_type"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"complementary_type"}{"parent"}{"parent"}{"constraint"} = $v->{"parent"}{"parent"}{"complementary_type"}{"parent"}{"constraint"};$v->{"parent"}{"parent"}{"parent"} = $v->{"parent"}{"parent"}{"complementary_type"}{"parent"}; \$v}->get_message($hash)) |
1321 |
0 |
1321 |
|
| 68 |
1321 |
| my ($line, $column) = @{$self->{parser}->line_column($self->{parser}{farthest})}; |
| 69 |
1321 |
| +{ %$hash, location => { line => $line, column => $column } }; |
| 70 |
21 |
| } |
| 71 |
|
| |
| 72 |
1625 |
▶ | fun _merge_hash (Any $param = undef, Any $arraykey = undef) { |
|
Subroutine
_merge_hash: called CC=5 SCAR=16.2
Branch: 1 branch
| Branch | True | False | Total |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for fun _merge_hash (expected 2, got ' . @_ . ')') |
0 |
1625 |
1625 |
|
| 73 |
1625 |
| my %def = map %$_, grep ref eq 'HASH', @$param; |
| 74 |
1625 |
▶ | if ($arraykey) { |
Branch: 1 branch
| Branch | True | False | Total |
| if ($arraykey) |
107 |
1518 |
1625 |
|
| 75 |
107 |
| my @arrays = grep ref eq 'ARRAY', @$param; |
| 76 |
107 |
▶ | Carp::confess "More than one array found\n" if @arrays > 1; |
Branch: 1 branch
| Branch | True | False | Total |
| if @arrays > 1 |
0 |
107 |
107 |
|
| 77 |
107 |
▶ | Carp::confess "No arrays found but \$arraykey given\n" if !@arrays; |
Branch: 1 branch
| Branch | True | False | Total |
| unless @arrays |
0 |
107 |
107 |
|
| 78 |
107 |
| my %fields = map %$_, @{$arrays[0]}; |
| 79 |
107 |
| $def{$arraykey} = \%fields; |
| 80 |
|
| } |
| 81 |
1625 |
| \%def; |
| 82 |
21 |
| } |
| 83 |
|
| |
| 84 |
65 |
▶ | fun _unescape (Str $str) { |
|
Subroutine
_unescape: called CC=4 SCAR=14.2
Branch: 3 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for fun _unescape (expected 1, got ' . @_ . ')') |
0 |
65 |
65 |
| @_ > 1 and Function::Parameters::_croak('Too many arguments for fun _unescape (expected 1, got ' . @_ . ')') |
0 |
65 |
65 |
| Type::Tiny::XS::Str($str) or Function::Parameters::_croak('In fun _unescape: parameter 1 ($str): ' . ${my $v = bless( {"_is_core" => 1,"_overload_coderef" => sub { package Sub::Defer; use warnings; use strict; $undeferred ||= undefer_sub($deferred_info->[4]); goto \&$undeferred;},"_overload_coderef_no_rebuild" => 1,"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Str","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"constraint" => sub { package Types::Standard; no warnings; use strict; ref \$_ eq 'SCALAR' or ref \(my $val = $_) eq 'SCALAR';},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 291,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Str","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; use warnings; use strict; $Type::Tiny::AvoidCallbacks ? goto $orig_inlined : "$xsubname($_[1])";},"library" => "Types::Standard","name" => "Str","parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00"} use strict; defined $_[0] and not ref $_[0] or _failed_check(8, 'Value', $_[0], 'exception_class', 'Error::TypeTiny::Assertion'); $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Value","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"constraint" => sub { package Types::Standard; no warnings; use strict; not ref $_;},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 276,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Value","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; "defined($_[1]) and not ref($_[1])";},"library" => "Types::Standard","name" => "Value","parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00"} use strict; defined $_[0] or _failed_check(7, 'Defined', $_[0], 'exception_class', 'Error::TypeTiny::Assertion'); $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Defined","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"complementary_type" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00"} use strict; defined $_[0] and _failed_check(6, 'Undef', $_[0], 'exception_class', 'Error::TypeTiny::Assertion'); $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Undef","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"complementary_type" => {},"constraint" => sub { package Types::Standard; no warnings; use strict; not defined $_;},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 254,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Undef","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; "!defined($_[1])";},"library" => "Types::Standard","name" => "Undef","parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00"} use strict; '???'; $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Item","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"constraint" => sub { package Type::Tiny; use warnings; use strict; !0;},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 226,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Item","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; '!!1';},"library" => "Types::Standard","name" => "Item","parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Sub::Defer; use warnings; use strict; $undeferred ||= undefer_sub($deferred_info->[4]); goto \&$undeferred;},"_overload_coderef_no_rebuild" => 1,"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => do{my $o},"display_name" => "to_Any","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"complement_name" => "None","constraint" => do{my $o},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 220,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Any","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; '!!1';},"library" => "Types::Standard","name" => "Any","type_default" => sub { package Types::Standard; no warnings; use strict; return undef;},"uniq" => 1}, 'Type::Tiny' ),"uniq" => 2}, 'Type::Tiny' ),"type_default" => sub { package Types::Standard; no warnings; use strict; return undef;},"uniq" => 6}, 'Type::Tiny' ),"constraint" => sub { package Types::Standard; no warnings; use strict; defined $_;},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 262,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Defined","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; "defined($_[1])";},"library" => "Types::Standard","name" => "Defined","parent" => {},"uniq" => 7}, 'Type::Tiny' ),"uniq" => 8}, 'Type::Tiny' ),"sorter" => sub { package Types::Standard; no warnings; use strict; $_[0] cmp $_[1];},"type_default" => sub { package Types::Standard; no warnings; use strict; return '';},"uniq" => 9}, 'Type::Tiny' );$v->{"coercion"}{"type_constraint"} = $v;$v->{"compiled_type_constraint"} = $v->{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"coercion"}{"type_constraint"} = $v->{"parent"};$v->{"parent"}{"compiled_type_constraint"} = $v->{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"coercion"}{"type_constraint"} = $v->{"parent"}{"parent"};$v->{"parent"}{"parent"}{"compiled_type_constraint"} = $v->{"parent"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"complementary_type"}{"coercion"}{"type_constraint"} = $v->{"parent"}{"parent"}{"complementary_type"};$v->{"parent"}{"parent"}{"complementary_type"}{"compiled_type_constraint"} = $v->{"parent"}{"parent"}{"complementary_type"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"complementary_type"}{"complementary_type"} = $v->{"parent"}{"parent"};$v->{"parent"}{"parent"}{"complementary_type"}{"parent"}{"coercion"}{"type_constraint"} = $v->{"parent"}{"parent"}{"complementary_type"}{"parent"};$v->{"parent"}{"parent"}{"complementary_type"}{"parent"}{"compiled_type_constraint"} = $v->{"parent"}{"parent"}{"complementary_type"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"complementary_type"}{"parent"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"} = $v->{"parent"}{"parent"}{"complementary_type"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"complementary_type"}{"parent"}{"parent"}{"coercion"}{"type_constraint"} = $v->{"parent"}{"parent"}{"complementary_type"}{"parent"}{"parent"};$v->{"parent"}{"parent"}{"complementary_type"}{"parent"}{"parent"}{"compiled_type_constraint"} = $v->{"parent"}{"parent"}{"complementary_type"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"complementary_type"}{"parent"}{"parent"}{"constraint"} = $v->{"parent"}{"parent"}{"complementary_type"}{"parent"}{"constraint"};$v->{"parent"}{"parent"}{"parent"} = $v->{"parent"}{"parent"}{"complementary_type"}{"parent"}; \$v}->get_message($str)) |
65 |
0 |
65 |
|
| 85 |
|
| # https://facebook.github.io/graphql/June2018/#EscapedCharacter |
| 86 |
65 |
| $str =~ s|\\(["\\/bfnrt])|"qq!\\$1!"|gee; |
| 87 |
65 |
| return $str; |
| 88 |
21 |
| } |
| 89 |
|
| |
| 90 |
14 |
▶ | fun _blockstring_value (Str $str) { |
|
Subroutine
_blockstring_value: called CC=16 SCAR=28.0
Branch: 3 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for fun _blockstring_value (expected 1, got ' . @_ . ')') |
0 |
14 |
14 |
| @_ > 1 and Function::Parameters::_croak('Too many arguments for fun _blockstring_value (expected 1, got ' . @_ . ')') |
0 |
14 |
14 |
| Type::Tiny::XS::Str($str) or Function::Parameters::_croak('In fun _blockstring_value: parameter 1 ($str): ' . ${my $v = bless( {"_is_core" => 1,"_overload_coderef" => sub { package Sub::Defer; use warnings; use strict; $undeferred ||= undefer_sub($deferred_info->[4]); goto \&$undeferred;},"_overload_coderef_no_rebuild" => 1,"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Str","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"constraint" => sub { package Types::Standard; no warnings; use strict; ref \$_ eq 'SCALAR' or ref \(my $val = $_) eq 'SCALAR';},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 291,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Str","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; use warnings; use strict; $Type::Tiny::AvoidCallbacks ? goto $orig_inlined : "$xsubname($_[1])";},"library" => "Types::Standard","name" => "Str","parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00"} use strict; defined $_[0] and not ref $_[0] or _failed_check(8, 'Value', $_[0], 'exception_class', 'Error::TypeTiny::Assertion'); $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Value","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"constraint" => sub { package Types::Standard; no warnings; use strict; not ref $_;},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 276,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Value","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; "defined($_[1]) and not ref($_[1])";},"library" => "Types::Standard","name" => "Value","parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00"} use strict; defined $_[0] or _failed_check(7, 'Defined', $_[0], 'exception_class', 'Error::TypeTiny::Assertion'); $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Defined","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"complementary_type" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00"} use strict; defined $_[0] and _failed_check(6, 'Undef', $_[0], 'exception_class', 'Error::TypeTiny::Assertion'); $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Undef","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"complementary_type" => {},"constraint" => sub { package Types::Standard; no warnings; use strict; not defined $_;},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 254,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Undef","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; "!defined($_[1])";},"library" => "Types::Standard","name" => "Undef","parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00"} use strict; '???'; $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Item","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"constraint" => sub { package Type::Tiny; use warnings; use strict; !0;},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 226,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Item","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; '!!1';},"library" => "Types::Standard","name" => "Item","parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Sub::Defer; use warnings; use strict; $undeferred ||= undefer_sub($deferred_info->[4]); goto \&$undeferred;},"_overload_coderef_no_rebuild" => 1,"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => do{my $o},"display_name" => "to_Any","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"complement_name" => "None","constraint" => do{my $o},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 220,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Any","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; '!!1';},"library" => "Types::Standard","name" => "Any","type_default" => sub { package Types::Standard; no warnings; use strict; return undef;},"uniq" => 1}, 'Type::Tiny' ),"uniq" => 2}, 'Type::Tiny' ),"type_default" => sub { package Types::Standard; no warnings; use strict; return undef;},"uniq" => 6}, 'Type::Tiny' ),"constraint" => sub { package Types::Standard; no warnings; use strict; defined $_;},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 262,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Defined","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; "defined($_[1])";},"library" => "Types::Standard","name" => "Defined","parent" => {},"uniq" => 7}, 'Type::Tiny' ),"uniq" => 8}, 'Type::Tiny' ),"sorter" => sub { package Types::Standard; no warnings; use strict; $_[0] cmp $_[1];},"type_default" => sub { package Types::Standard; no warnings; use strict; return '';},"uniq" => 9}, 'Type::Tiny' );$v->{"coercion"}{"type_constraint"} = $v;$v->{"compiled_type_constraint"} = $v->{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"coercion"}{"type_constraint"} = $v->{"parent"};$v->{"parent"}{"compiled_type_constraint"} = $v->{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"coercion"}{"type_constraint"} = $v->{"parent"}{"parent"};$v->{"parent"}{"parent"}{"compiled_type_constraint"} = $v->{"parent"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"complementary_type"}{"coercion"}{"type_constraint"} = $v->{"parent"}{"parent"}{"complementary_type"};$v->{"parent"}{"parent"}{"complementary_type"}{"compiled_type_constraint"} = $v->{"parent"}{"parent"}{"complementary_type"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"complementary_type"}{"complementary_type"} = $v->{"parent"}{"parent"};$v->{"parent"}{"parent"}{"complementary_type"}{"parent"}{"coercion"}{"type_constraint"} = $v->{"parent"}{"parent"}{"complementary_type"}{"parent"};$v->{"parent"}{"parent"}{"complementary_type"}{"parent"}{"compiled_type_constraint"} = $v->{"parent"}{"parent"}{"complementary_type"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"complementary_type"}{"parent"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"} = $v->{"parent"}{"parent"}{"complementary_type"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"complementary_type"}{"parent"}{"parent"}{"coercion"}{"type_constraint"} = $v->{"parent"}{"parent"}{"complementary_type"}{"parent"}{"parent"};$v->{"parent"}{"parent"}{"complementary_type"}{"parent"}{"parent"}{"compiled_type_constraint"} = $v->{"parent"}{"parent"}{"complementary_type"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"complementary_type"}{"parent"}{"parent"}{"constraint"} = $v->{"parent"}{"parent"}{"complementary_type"}{"parent"}{"constraint"};$v->{"parent"}{"parent"}{"parent"} = $v->{"parent"}{"parent"}{"complementary_type"}{"parent"}; \$v}->get_message($str)) |
14 |
0 |
14 |
|
| 91 |
|
| # https://facebook.github.io/graphql/June2018/#BlockStringValue() |
| 92 |
14 |
| my @lines = split(/(?:\n|\r(?!\r)|\r\n)/s, $str); |
| 93 |
14 |
▶ | if (1 < @lines) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (1 < @lines) |
12 |
2 |
14 |
|
| 94 |
12 |
| my $common_indent; |
| 95 |
12 |
| for my $line (@lines[1..$#lines]) { |
| 96 |
46 |
| my $length = length($line); |
| 97 |
46 |
▶ | my $indent = length(($line =~ /^([\t ]*)/)[0] || ''); |
Condition100%2/2
($line =~ /^([\t ]*)/u)[0] || ''
MC/DC100%1/1
($line =~ /^([\t ]*)/u)[0] || ''
($line =~ /^([\t ]*)/u)[0]
Truth table100%2/2
A
A= ($line =~ /^([\t ]*)/u)[0]
|
| 98 |
46 |
▶ | if ($indent < $length && (!defined($common_indent) || $indent < $common_indent)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if ($indent < $length and !defined($common_indent) || $indent < $common_indent) |
13 |
33 |
46 |
Condition100%6/6
$indent < $length and !defined($common_indent) || $indent < $common_indent
not defined $common_indent or $indent < $common_indent
MC/DC100%3/3
$indent < $length and !defined($common_indent) || $indent < $common_indent
$indent < $length
not defined $common_indent
$indent < $common_indent
Truth table100%4/4
A and not(B) or C
A= $indent < $lengthB= not defined $common_indentC= $indent < $common_indent
| A | B | C | result |
| 0 | X | X | 0 |
| 1 | 0 | 0 | 0 |
| 1 | 1 | X | 1 |
| 1 | 0 | 1 | 1 |
|
| 99 |
13 |
| $common_indent = $indent; |
| 100 |
|
| } |
| 101 |
|
| } |
| 102 |
12 |
▶ | if (defined $common_indent) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (defined $common_indent) |
12 |
0 |
12 |
|
| 103 |
12 |
| for my $line (@lines[1..$#lines]) { |
| 104 |
46 |
| $line =~ s/^[\t ]{$common_indent}//; |
| 105 |
|
| } |
| 106 |
|
| } |
| 107 |
|
| } |
| 108 |
14 |
| my ($start, $end); |
| 109 |
14 |
▶ | for ($start = 0; $start < @lines && $lines[$start] =~ /^[\t ]*$/; ++$start) {} |
Branch: 1 branch
| Branch | True | False | Total |
| if ($start < @lines and $lines[$start] =~ /^[\t ]*$/u) |
14 |
14 |
28 |
Condition66%2/3
$start < @lines and $lines[$start] =~ /^[\t ]*$/u
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
|
| 110 |
14 |
▶ | for ($end = $#lines; $end >= 0 && $lines[$end] =~ /^[\t ]*$/; --$end) {} |
Branch: 1 branch
| Branch | True | False | Total |
| if ($end >= 0 and $lines[$end] =~ /^[\t ]*$/u) |
9 |
14 |
23 |
Condition66%2/3
$end >= 0 and $lines[$end] =~ /^[\t ]*$/u
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
|
| 111 |
14 |
| @lines = @lines[$start..$end]; |
| 112 |
14 |
| my $formatted = join("\n", @lines); |
| 113 |
14 |
| $formatted =~ s/\\"""/"""/g; |
| 114 |
14 |
| return $formatted; |
| 115 |
21 |
| } |
| 116 |
|
| |
| 117 |
185 |
▶ | method got_arguments (Any $param = undef) { |
|
Subroutine
got_arguments: called CC=4 SCAR=14.1
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method got_arguments (expected 1, got ' . @_ . ')') |
0 |
185 |
185 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method got_arguments (expected 2, got ' . @_ . ')') |
0 |
185 |
185 |
|
| 118 |
185 |
▶ | return unless defined $param; |
Branch: 1 branch
| Branch | True | False | Total |
| unless defined $param |
0 |
185 |
185 |
|
| 119 |
185 |
| my %args = map { ($_->[0]{name} => $_->[1]) } @$param; |
| 120 |
185 |
| return {$self->{parser}{rule} => \%args}; |
| 121 |
21 |
| } |
| 122 |
|
| |
| 123 |
201 |
▶ | method got_argument (Any $param = undef) { |
|
Subroutine
got_argument: called CC=4 SCAR=14.2
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method got_argument (expected 1, got ' . @_ . ')') |
0 |
201 |
201 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method got_argument (expected 2, got ' . @_ . ')') |
0 |
201 |
201 |
|
| 124 |
201 |
▶ | return unless defined $param; |
Branch: 1 branch
| Branch | True | False | Total |
| unless defined $param |
0 |
201 |
201 |
|
| 125 |
201 |
| $param; |
| 126 |
21 |
| } |
| 127 |
|
| |
| 128 |
27 |
▶ | method got_objectField (Any $param = undef) { |
|
Subroutine
got_objectField: called CC=4 SCAR=14.2
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method got_objectField (expected 1, got ' . @_ . ')') |
0 |
27 |
27 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method got_objectField (expected 2, got ' . @_ . ')') |
0 |
27 |
27 |
|
| 129 |
27 |
▶ | return unless defined $param; |
Branch: 1 branch
| Branch | True | False | Total |
| unless defined $param |
0 |
27 |
27 |
|
| 130 |
27 |
| return {$param->[0]{name} => $param->[1]}; |
| 131 |
21 |
| } |
| 132 |
|
| |
| 133 |
14 |
▶ | method got_objectValue (Any $param = undef) { |
|
Subroutine
got_objectValue: called CC=4 SCAR=14.2
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method got_objectValue (expected 1, got ' . @_ . ')') |
0 |
14 |
14 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method got_objectValue (expected 2, got ' . @_ . ')') |
0 |
14 |
14 |
|
| 134 |
14 |
▶ | return unless defined $param; |
Branch: 1 branch
| Branch | True | False | Total |
| unless defined $param |
0 |
14 |
14 |
|
| 135 |
14 |
| _merge_hash($param); |
| 136 |
21 |
| } |
| 137 |
|
| |
| 138 |
4 |
▶ | method got_objectField_const (Any $param = undef) { |
|
Subroutine
got_objectField_const: called CC=3 SCAR=11.1
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method got_objectField_const (expected 1, got ' . @_ . ')') |
0 |
4 |
4 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method got_objectField_const (expected 2, got ' . @_ . ')') |
0 |
4 |
4 |
|
| 139 |
4 |
| unshift @_, $self; goto &got_objectField; |
| 140 |
21 |
| } |
| 141 |
|
| |
| 142 |
2 |
▶ | method got_objectValue_const (Any $param = undef) { |
|
Subroutine
got_objectValue_const: called CC=3 SCAR=11.1
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method got_objectValue_const (expected 1, got ' . @_ . ')') |
0 |
2 |
2 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method got_objectValue_const (expected 2, got ' . @_ . ')') |
0 |
2 |
2 |
|
| 143 |
2 |
| unshift @_, $self; goto &got_objectValue; |
| 144 |
21 |
| } |
| 145 |
|
| |
| 146 |
9 |
▶ | method got_listValue (Any $param = undef) { |
|
Subroutine
got_listValue: called CC=4 SCAR=14.2
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method got_listValue (expected 1, got ' . @_ . ')') |
0 |
9 |
9 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method got_listValue (expected 2, got ' . @_ . ')') |
0 |
9 |
9 |
|
| 147 |
9 |
▶ | return unless defined $param; |
Branch: 1 branch
| Branch | True | False | Total |
| unless defined $param |
0 |
9 |
9 |
|
| 148 |
9 |
| return $param; |
| 149 |
21 |
| } |
| 150 |
|
| |
| 151 |
2 |
▶ | method got_listValue_const (Any $param = undef) { |
|
Subroutine
got_listValue_const: called CC=3 SCAR=11.1
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method got_listValue_const (expected 1, got ' . @_ . ')') |
0 |
2 |
2 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method got_listValue_const (expected 2, got ' . @_ . ')') |
0 |
2 |
2 |
|
| 152 |
2 |
| unshift @_, $self; goto &got_listValue; |
| 153 |
21 |
| } |
| 154 |
|
| |
| 155 |
74 |
▶ | method got_directiveactual (Any $param = undef) { |
|
Subroutine
got_directiveactual: called CC=4 SCAR=14.2
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method got_directiveactual (expected 1, got ' . @_ . ')') |
0 |
74 |
74 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method got_directiveactual (expected 2, got ' . @_ . ')') |
0 |
74 |
74 |
|
| 156 |
74 |
▶ | return unless defined $param; |
Branch: 1 branch
| Branch | True | False | Total |
| unless defined $param |
0 |
74 |
74 |
|
| 157 |
74 |
| _merge_hash($param); |
| 158 |
21 |
| } |
| 159 |
|
| |
| 160 |
66 |
▶ | method got_inputValueDefinition (Any $param = undef) { |
|
Subroutine
got_inputValueDefinition: called CC=4 SCAR=14.1
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method got_inputValueDefinition (expected 1, got ' . @_ . ')') |
0 |
66 |
66 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method got_inputValueDefinition (expected 2, got ' . @_ . ')') |
0 |
66 |
66 |
|
| 161 |
66 |
▶ | return unless defined $param; |
Branch: 1 branch
| Branch | True | False | Total |
| unless defined $param |
0 |
66 |
66 |
|
| 162 |
66 |
| my $def = _merge_hash($param); |
| 163 |
66 |
| my $name = delete $def->{name}; |
| 164 |
66 |
| return { $name => $def }; |
| 165 |
21 |
| } |
| 166 |
|
| |
| 167 |
12 |
▶ | method got_directiveLocations (Any $param = undef) { |
|
Subroutine
got_directiveLocations: called CC=4 SCAR=14.2
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method got_directiveLocations (expected 1, got ' . @_ . ')') |
0 |
12 |
12 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method got_directiveLocations (expected 2, got ' . @_ . ')') |
0 |
12 |
12 |
|
| 168 |
12 |
▶ | return unless defined $param; |
Branch: 1 branch
| Branch | True | False | Total |
| unless defined $param |
0 |
12 |
12 |
|
| 169 |
12 |
| return {locations => [ map $_->{name}, @$param ]}; |
| 170 |
21 |
| } |
| 171 |
|
| |
| 172 |
597 |
▶ | method got_namedType (Any $param = undef) { |
|
Subroutine
got_namedType: called CC=4 SCAR=14.2
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method got_namedType (expected 1, got ' . @_ . ')') |
0 |
597 |
597 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method got_namedType (expected 2, got ' . @_ . ')') |
0 |
597 |
597 |
|
| 173 |
597 |
▶ | return unless defined $param; |
Branch: 1 branch
| Branch | True | False | Total |
| unless defined $param |
0 |
597 |
597 |
|
| 174 |
597 |
| return $param->{name}; |
| 175 |
21 |
| } |
| 176 |
|
| |
| 177 |
28 |
▶ | method got_enumValueDefinition (Any $param = undef) { |
|
Subroutine
got_enumValueDefinition: called CC=6 SCAR=18.0
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method got_enumValueDefinition (expected 1, got ' . @_ . ')') |
0 |
28 |
28 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method got_enumValueDefinition (expected 2, got ' . @_ . ')') |
0 |
28 |
28 |
|
| 178 |
28 |
▶ | return unless defined $param; |
Branch: 1 branch
| Branch | True | False | Total |
| unless defined $param |
0 |
28 |
28 |
|
| 179 |
28 |
| my @copy = @$param; |
| 180 |
28 |
| my $rest = pop @copy; |
| 181 |
28 |
| my $value = pop @copy; |
| 182 |
28 |
▶ | my $description = $copy[0] // {}; |
|
|
| 183 |
28 |
▶ | $rest = ref $rest eq 'HASH' ? [ $rest ] : $rest; |
Branch: 1 branch
| Branch | True | False | Total |
| ref $rest eq 'HASH' ? : |
3 |
25 |
28 |
|
| 184 |
28 |
| my %def = (%$description, value => $value, map %$_, @$rest); |
| 185 |
28 |
| return \%def; |
| 186 |
21 |
| } |
| 187 |
|
| |
| 188 |
16 |
▶ | method got_defaultValue (Any $param = undef) { |
|
Subroutine
got_defaultValue: called CC=3 SCAR=11.2
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method got_defaultValue (expected 1, got ' . @_ . ')') |
0 |
16 |
16 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method got_defaultValue (expected 2, got ' . @_ . ')') |
0 |
16 |
16 |
|
| 189 |
|
| # the value can be undef |
| 190 |
16 |
| return { default_value => $param }; |
| 191 |
21 |
| } |
| 192 |
|
| |
| 193 |
8 |
▶ | method got_implementsInterfaces (Any $param = undef) { |
|
Subroutine
got_implementsInterfaces: called CC=4 SCAR=14.2
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method got_implementsInterfaces (expected 1, got ' . @_ . ')') |
0 |
8 |
8 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method got_implementsInterfaces (expected 2, got ' . @_ . ')') |
0 |
8 |
8 |
|
| 194 |
8 |
▶ | return unless defined $param; |
Branch: 1 branch
| Branch | True | False | Total |
| unless defined $param |
0 |
8 |
8 |
|
| 195 |
8 |
| return { interfaces => $param }; |
| 196 |
21 |
| } |
| 197 |
|
| |
| 198 |
46 |
▶ | method got_argumentsDefinition (Any $param = undef) { |
|
Subroutine
got_argumentsDefinition: called CC=4 SCAR=14.2
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method got_argumentsDefinition (expected 1, got ' . @_ . ')') |
0 |
46 |
46 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method got_argumentsDefinition (expected 2, got ' . @_ . ')') |
0 |
46 |
46 |
|
| 199 |
46 |
▶ | return unless defined $param; |
Branch: 1 branch
| Branch | True | False | Total |
| unless defined $param |
0 |
46 |
46 |
|
| 200 |
46 |
| return { args => _merge_hash($param) }; |
| 201 |
21 |
| } |
| 202 |
|
| |
| 203 |
118 |
▶ | method got_fieldDefinition (Any $param = undef) { |
|
Subroutine
got_fieldDefinition: called CC=4 SCAR=14.1
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method got_fieldDefinition (expected 1, got ' . @_ . ')') |
0 |
118 |
118 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method got_fieldDefinition (expected 2, got ' . @_ . ')') |
0 |
118 |
118 |
|
| 204 |
118 |
▶ | return unless defined $param; |
Branch: 1 branch
| Branch | True | False | Total |
| unless defined $param |
0 |
118 |
118 |
|
| 205 |
118 |
| my $def = _merge_hash($param); |
| 206 |
118 |
| my $name = delete $def->{name}; |
| 207 |
118 |
| return { $name => $def }; |
| 208 |
21 |
| } |
| 209 |
|
| |
| 210 |
14 |
▶ | method got_typeExtensionDefinition (Any $param = undef) { |
|
Subroutine
got_typeExtensionDefinition: called CC=4 SCAR=14.2
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method got_typeExtensionDefinition (expected 1, got ' . @_ . ')') |
0 |
14 |
14 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method got_typeExtensionDefinition (expected 2, got ' . @_ . ')') |
0 |
14 |
14 |
|
| 211 |
14 |
▶ | return unless defined $param; |
Branch: 1 branch
| Branch | True | False | Total |
| unless defined $param |
0 |
14 |
14 |
|
| 212 |
14 |
| return {kind => 'extend', %{$self->_locate_hash($param)}}; |
| 213 |
21 |
| } |
| 214 |
|
| |
| 215 |
17 |
▶ | method got_enumTypeDefinition (Any $param = undef) { |
|
Subroutine
got_enumTypeDefinition: called CC=4 SCAR=13.9
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method got_enumTypeDefinition (expected 1, got ' . @_ . ')') |
0 |
17 |
17 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method got_enumTypeDefinition (expected 2, got ' . @_ . ')') |
0 |
17 |
17 |
|
| 216 |
17 |
▶ | return unless defined $param; |
Branch: 1 branch
| Branch | True | False | Total |
| unless defined $param |
0 |
17 |
17 |
|
| 217 |
17 |
| my $def = _merge_hash($param); |
| 218 |
17 |
| my %values; |
| 219 |
|
| map { |
| 220 |
28 |
| my $name = ${${delete $_->{value}}}; |
| 221 |
28 |
| $values{$name} = $_; |
| 222 |
17 |
| } @{(grep ref eq 'ARRAY', @$param)[0]}; |
| 223 |
17 |
| $def->{values} = \%values; |
| 224 |
17 |
| return {kind => 'enum', %{$self->_locate_hash($def)}}; |
| 225 |
21 |
| } |
| 226 |
|
| |
| 227 |
11 |
▶ | method got_unionMembers (Any $param = undef) { |
|
Subroutine
got_unionMembers: called CC=4 SCAR=14.2
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method got_unionMembers (expected 1, got ' . @_ . ')') |
0 |
11 |
11 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method got_unionMembers (expected 2, got ' . @_ . ')') |
0 |
11 |
11 |
|
| 228 |
11 |
▶ | return unless defined $param; |
Branch: 1 branch
| Branch | True | False | Total |
| unless defined $param |
0 |
11 |
11 |
|
| 229 |
11 |
| return { types => $param }; |
| 230 |
21 |
| } |
| 231 |
|
| |
| 232 |
42 |
▶ | method got_boolean (Any $param = undef) { |
|
Subroutine
got_boolean: called CC=5 SCAR=16.4
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method got_boolean (expected 1, got ' . @_ . ')') |
0 |
42 |
42 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method got_boolean (expected 2, got ' . @_ . ')') |
0 |
42 |
42 |
|
| 233 |
42 |
▶ | return unless defined $param; |
Branch: 1 branch
| Branch | True | False | Total |
| unless defined $param |
0 |
42 |
42 |
|
| 234 |
42 |
▶ | return $param eq 'true' ? JSON->true : JSON->false; |
Branch: 1 branch
| Branch | True | False | Total |
| $param eq 'true' ? : |
26 |
16 |
42 |
|
| 235 |
21 |
| } |
| 236 |
|
| |
| 237 |
6 |
▶ | method got_null (Any $param = undef) { |
|
Subroutine
got_null: called CC=4 SCAR=14.2
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method got_null (expected 1, got ' . @_ . ')') |
0 |
6 |
6 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method got_null (expected 2, got ' . @_ . ')') |
0 |
6 |
6 |
|
| 238 |
6 |
▶ | return unless defined $param; |
Branch: 1 branch
| Branch | True | False | Total |
| unless defined $param |
0 |
6 |
6 |
|
| 239 |
6 |
| return undef; |
| 240 |
21 |
| } |
| 241 |
|
| |
| 242 |
79 |
▶ | method got_string (Any $param = undef) { |
|
Subroutine
got_string: called CC=4 SCAR=14.2
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method got_string (expected 1, got ' . @_ . ')') |
0 |
79 |
79 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method got_string (expected 2, got ' . @_ . ')') |
0 |
79 |
79 |
|
| 243 |
79 |
▶ | return unless defined $param; |
Branch: 1 branch
| Branch | True | False | Total |
| unless defined $param |
0 |
79 |
79 |
|
| 244 |
79 |
| return $param; |
| 245 |
21 |
| } |
| 246 |
|
| |
| 247 |
65 |
▶ | method got_stringValue (Any $param = undef) { |
|
Subroutine
got_stringValue: called CC=4 SCAR=14.2
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method got_stringValue (expected 1, got ' . @_ . ')') |
0 |
65 |
65 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method got_stringValue (expected 2, got ' . @_ . ')') |
0 |
65 |
65 |
|
| 248 |
65 |
▶ | return unless defined $param; |
Branch: 1 branch
| Branch | True | False | Total |
| unless defined $param |
0 |
65 |
65 |
|
| 249 |
65 |
| return _unescape($param); |
| 250 |
21 |
| } |
| 251 |
|
| |
| 252 |
14 |
▶ | method got_blockStringValue (Any $param = undef) { |
|
Subroutine
got_blockStringValue: called CC=4 SCAR=14.2
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method got_blockStringValue (expected 1, got ' . @_ . ')') |
0 |
14 |
14 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method got_blockStringValue (expected 2, got ' . @_ . ')') |
0 |
14 |
14 |
|
| 253 |
14 |
▶ | return unless defined $param; |
Branch: 1 branch
| Branch | True | False | Total |
| unless defined $param |
0 |
14 |
14 |
|
| 254 |
14 |
| return _blockstring_value($param); |
| 255 |
21 |
| } |
| 256 |
|
| |
| 257 |
27 |
▶ | method got_int (Any $param = undef) { |
|
Subroutine
got_int: called CC=3 SCAR=11.2
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method got_int (expected 1, got ' . @_ . ')') |
0 |
27 |
27 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method got_int (expected 2, got ' . @_ . ')') |
0 |
27 |
27 |
|
| 258 |
27 |
| $param+0; |
| 259 |
21 |
| } |
| 260 |
|
| |
| 261 |
15 |
▶ | method got_float (Any $param = undef) { |
|
Subroutine
got_float: called CC=3 SCAR=11.2
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method got_float (expected 1, got ' . @_ . ')') |
0 |
15 |
15 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method got_float (expected 2, got ' . @_ . ')') |
0 |
15 |
15 |
|
| 262 |
15 |
| $param+0; |
| 263 |
21 |
| } |
| 264 |
|
| |
| 265 |
45 |
▶ | method got_enumValue (Any $param = undef) { |
|
Subroutine
got_enumValue: called CC=4 SCAR=14.2
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method got_enumValue (expected 1, got ' . @_ . ')') |
0 |
45 |
45 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method got_enumValue (expected 2, got ' . @_ . ')') |
0 |
45 |
45 |
|
| 266 |
45 |
▶ | return unless defined $param; |
Branch: 1 branch
| Branch | True | False | Total |
| unless defined $param |
0 |
45 |
45 |
|
| 267 |
45 |
| my $varname = $param->{name}; |
| 268 |
45 |
| return \\$varname; |
| 269 |
21 |
| } |
| 270 |
|
| |
| 271 |
|
| # not returning empty list if undef |
| 272 |
1080 |
▶ | method got_value_const (Any $param = undef) { |
|
Subroutine
got_value_const: called CC=3 SCAR=11.2
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method got_value_const (expected 1, got ' . @_ . ')') |
0 |
1080 |
1080 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method got_value_const (expected 2, got ' . @_ . ')') |
0 |
1080 |
1080 |
|
| 273 |
1080 |
| return $param; |
| 274 |
21 |
| } |
| 275 |
|
| |
| 276 |
237 |
▶ | method got_value (Any $param = undef) { |
|
Subroutine
got_value: called CC=3 SCAR=11.1
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method got_value (expected 1, got ' . @_ . ')') |
0 |
237 |
237 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method got_value (expected 2, got ' . @_ . ')') |
0 |
237 |
237 |
|
| 277 |
237 |
| unshift @_, $self; goto &got_value_const; |
| 278 |
21 |
| } |
| 279 |
|
| |
| 280 |
54 |
▶ | method got_variableDefinitions (Any $param = undef) { |
|
Subroutine
got_variableDefinitions: called CC=4 SCAR=14.0
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method got_variableDefinitions (expected 1, got ' . @_ . ')') |
0 |
54 |
54 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method got_variableDefinitions (expected 2, got ' . @_ . ')') |
0 |
54 |
54 |
|
| 281 |
54 |
▶ | return unless defined $param; |
Branch: 1 branch
| Branch | True | False | Total |
| unless defined $param |
0 |
54 |
54 |
|
| 282 |
54 |
| my %def; |
| 283 |
|
| map { |
| 284 |
54 |
| my $name = ${ shift @$_ }; |
| 285 |
55 |
| $def{$name} = { map %$_, @$_ }; # merge |
| 286 |
|
| } @$param; |
| 287 |
54 |
| return {variables => \%def}; |
| 288 |
21 |
| } |
| 289 |
|
| |
| 290 |
55 |
▶ | method got_variableDefinition (Any $param = undef) { |
|
Subroutine
got_variableDefinition: called CC=4 SCAR=14.2
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method got_variableDefinition (expected 1, got ' . @_ . ')') |
0 |
55 |
55 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method got_variableDefinition (expected 2, got ' . @_ . ')') |
0 |
55 |
55 |
|
| 291 |
55 |
▶ | return unless defined $param; |
Branch: 1 branch
| Branch | True | False | Total |
| unless defined $param |
0 |
55 |
55 |
|
| 292 |
55 |
| return $param; |
| 293 |
21 |
| } |
| 294 |
|
| |
| 295 |
820 |
▶ | method got_selection (Any $param = undef) { |
|
Subroutine
got_selection: called CC=3 SCAR=11.1
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method got_selection (expected 1, got ' . @_ . ')') |
0 |
820 |
820 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method got_selection (expected 2, got ' . @_ . ')') |
0 |
820 |
820 |
|
| 296 |
820 |
| unshift @_, $self; goto &got_value_const; |
| 297 |
21 |
| } |
| 298 |
|
| |
| 299 |
278 |
▶ | method got_typedef (Any $param = undef) { |
|
Subroutine
got_typedef: called CC=5 SCAR=16.7
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method got_typedef (expected 1, got ' . @_ . ')') |
0 |
278 |
278 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method got_typedef (expected 2, got ' . @_ . ')') |
0 |
278 |
278 |
|
| 300 |
278 |
▶ | return unless defined $param; |
Branch: 1 branch
| Branch | True | False | Total |
| unless defined $param |
0 |
278 |
278 |
|
| 301 |
278 |
▶ | $param = $param->{name} if ref($param) eq 'HASH'; |
Branch: 1 branch
| Branch | True | False | Total |
| if ref $param eq "HASH" |
0 |
278 |
278 |
|
| 302 |
278 |
| return {type => $param}; |
| 303 |
21 |
| } |
| 304 |
|
| |
| 305 |
30 |
▶ | method got_alias (Any $param = undef) { |
|
Subroutine
got_alias: called CC=4 SCAR=14.2
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method got_alias (expected 1, got ' . @_ . ')') |
0 |
30 |
30 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method got_alias (expected 2, got ' . @_ . ')') |
0 |
30 |
30 |
|
| 306 |
30 |
▶ | return unless defined $param; |
Branch: 1 branch
| Branch | True | False | Total |
| unless defined $param |
0 |
30 |
30 |
|
| 307 |
30 |
| return {$self->{parser}{rule} => $param->{name}}; |
| 308 |
21 |
| } |
| 309 |
|
| |
| 310 |
50 |
▶ | method got_typeCondition (Any $param = undef) { |
|
Subroutine
got_typeCondition: called CC=4 SCAR=14.2
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method got_typeCondition (expected 1, got ' . @_ . ')') |
0 |
50 |
50 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method got_typeCondition (expected 2, got ' . @_ . ')') |
0 |
50 |
50 |
|
| 311 |
50 |
▶ | return unless defined $param; |
Branch: 1 branch
| Branch | True | False | Total |
| unless defined $param |
0 |
50 |
50 |
|
| 312 |
50 |
| return {on => $param}; |
| 313 |
21 |
| } |
| 314 |
|
| |
| 315 |
66 |
▶ | method got_fragmentName (Any $param = undef) { |
|
Subroutine
got_fragmentName: called CC=4 SCAR=14.2
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method got_fragmentName (expected 1, got ' . @_ . ')') |
0 |
66 |
66 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method got_fragmentName (expected 2, got ' . @_ . ')') |
0 |
66 |
66 |
|
| 316 |
66 |
▶ | return unless defined $param; |
Branch: 1 branch
| Branch | True | False | Total |
| unless defined $param |
0 |
66 |
66 |
|
| 317 |
66 |
| return $param; |
| 318 |
21 |
| } |
| 319 |
|
| |
| 320 |
563 |
▶ | method got_selectionSet (Any $param = undef) { |
|
Subroutine
got_selectionSet: called CC=4 SCAR=14.2
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method got_selectionSet (expected 1, got ' . @_ . ')') |
0 |
563 |
563 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method got_selectionSet (expected 2, got ' . @_ . ')') |
0 |
563 |
563 |
|
| 321 |
563 |
▶ | return unless defined $param; |
Branch: 1 branch
| Branch | True | False | Total |
| unless defined $param |
0 |
563 |
563 |
|
| 322 |
563 |
| return {selections => $param}; |
| 323 |
21 |
| } |
| 324 |
|
| |
| 325 |
264 |
▶ | method got_operationDefinition (Any $param = undef) { |
|
Subroutine
got_operationDefinition: called CC=5 SCAR=16.3
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method got_operationDefinition (expected 1, got ' . @_ . ')') |
0 |
264 |
264 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method got_operationDefinition (expected 2, got ' . @_ . ')') |
0 |
264 |
264 |
|
| 326 |
264 |
▶ | return unless defined $param; |
Branch: 1 branch
| Branch | True | False | Total |
| unless defined $param |
0 |
264 |
264 |
|
| 327 |
264 |
▶ | $param = [ $param ] unless ref $param eq 'ARRAY'; # bare selectionSet |
Branch: 1 branch
| Branch | True | False | Total |
| unless ref $param eq "ARRAY" |
115 |
149 |
264 |
|
| 328 |
264 |
| return {kind => 'operation', %{$self->_locate_hash(_merge_hash($param))}}; |
| 329 |
21 |
| } |
| 330 |
|
| |
| 331 |
71 |
▶ | method got_directives (Any $param = undef) { |
|
Subroutine
got_directives: called CC=4 SCAR=14.2
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method got_directives (expected 1, got ' . @_ . ')') |
0 |
71 |
71 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method got_directives (expected 2, got ' . @_ . ')') |
0 |
71 |
71 |
|
| 332 |
71 |
▶ | return unless defined $param; |
Branch: 1 branch
| Branch | True | False | Total |
| unless defined $param |
0 |
71 |
71 |
|
| 333 |
71 |
| return {$self->{parser}{rule} => $param}; |
| 334 |
21 |
| } |
| 335 |
|
| |
| 336 |
323 |
▶ | method got_graphql (Any $param = undef) { |
|
Subroutine
got_graphql: called CC=4 SCAR=14.2
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method got_graphql (expected 1, got ' . @_ . ')') |
0 |
323 |
323 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method got_graphql (expected 2, got ' . @_ . ')') |
0 |
323 |
323 |
|
| 337 |
323 |
▶ | return unless defined $param; |
Branch: 1 branch
| Branch | True | False | Total |
| unless defined $param |
0 |
323 |
323 |
|
| 338 |
323 |
| return $param; |
| 339 |
21 |
| } |
| 340 |
|
| |
| 341 |
590 |
▶ | method got_definition (Any $param = undef) { |
|
Subroutine
got_definition: called CC=4 SCAR=14.0
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method got_definition (expected 1, got ' . @_ . ')') |
0 |
590 |
590 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method got_definition (expected 2, got ' . @_ . ')') |
0 |
590 |
590 |
|
| 342 |
590 |
▶ | return unless defined $param; |
Branch: 1 branch
| Branch | True | False | Total |
| unless defined $param |
103 |
487 |
590 |
|
| 343 |
487 |
| return $param; |
| 344 |
21 |
| } |
| 345 |
|
| |
| 346 |
54 |
▶ | method got_operationTypeDefinition (Any $param = undef) { |
|
Subroutine
got_operationTypeDefinition: called CC=5 SCAR=16.4
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method got_operationTypeDefinition (expected 1, got ' . @_ . ')') |
0 |
54 |
54 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method got_operationTypeDefinition (expected 2, got ' . @_ . ')') |
0 |
54 |
54 |
|
| 347 |
54 |
▶ | return unless defined $param; |
Branch: 1 branch
| Branch | True | False | Total |
| unless defined $param |
0 |
54 |
54 |
|
| 348 |
54 |
▶ | return { map { ref($_) ? values %$_ : $_ } @$param }; |
Branch: 1 branch
| Branch | True | False | Total |
| ref $_ ? : |
54 |
54 |
108 |
|
| 349 |
21 |
| } |
| 350 |
|
| |
| 351 |
0 |
▶ | method got_comment (Any $param = undef) { |
|
Subroutine
got_comment: not called CC=4 SCAR=30.0
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method got_comment (expected 1, got ' . @_ . ')') |
0 |
0 |
0 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method got_comment (expected 2, got ' . @_ . ')') |
0 |
0 |
0 |
|
| 352 |
0 |
▶ | return unless defined $param; |
Branch: 1 branch
| Branch | True | False | Total |
| unless defined $param |
0 |
0 |
0 |
|
| 353 |
0 |
| return $param; |
| 354 |
21 |
| } |
| 355 |
|
| |
| 356 |
1026 |
▶ | method got_description (Any $param = undef) { |
|
Subroutine
got_description: called CC=6 SCAR=18.5
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method got_description (expected 1, got ' . @_ . ')') |
0 |
1026 |
1026 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method got_description (expected 2, got ' . @_ . ')') |
0 |
1026 |
1026 |
|
| 357 |
1026 |
▶ | return unless defined $param; |
Branch: 1 branch
| Branch | True | False | Total |
| unless defined $param |
1010 |
16 |
1026 |
|
| 358 |
16 |
▶ | my $string = ref($param) eq 'ARRAY' ? join("\n", @$param) : $param; |
Branch: 1 branch
| Branch | True | False | Total |
| ref $param eq 'ARRAY' ? : |
0 |
16 |
16 |
|
| 359 |
16 |
▶ | return $string ? {$self->{parser}{rule} => $string} : {}; |
Branch: 1 branch
| Branch | True | False | Total |
| $string ? : |
16 |
0 |
16 |
|
| 360 |
21 |
| } |
| 361 |
|
| |
| 362 |
44 |
▶ | method got_schema (Any $param = undef) { |
|
Subroutine
got_schema: called CC=8 SCAR=20.9
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method got_schema (expected 1, got ' . @_ . ')') |
0 |
44 |
44 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method got_schema (expected 2, got ' . @_ . ')') |
0 |
44 |
44 |
|
| 363 |
44 |
▶ | return unless defined $param; |
Branch: 1 branch
| Branch | True | False | Total |
| unless defined $param |
0 |
44 |
44 |
|
| 364 |
44 |
| my $directives = {}; |
| 365 |
44 |
▶ | if (ref $param->[1] eq 'ARRAY') { |
Branch: 1 branch
| Branch | True | False | Total |
| if (ref $param->[1] eq "ARRAY") |
3 |
41 |
44 |
|
| 366 |
|
| # got directives |
| 367 |
3 |
| $directives = shift @$param; |
| 368 |
|
| } |
| 369 |
44 |
| my %type2count; |
| 370 |
44 |
| $type2count{(keys %$_)[0]}++ for @{$param->[0]}; |
| 371 |
|
| $type2count{$_} > 1 and die "Must provide only one $_ type in schema.\n" |
| 372 |
44 |
▶ | for keys %type2count; |
Branch: 1 branch
| Branch | True | False | Total |
| $type2count{$_} > 1 and die "Must provide only one $_ type in schema.\n" |
3 |
46 |
49 |
|
| 373 |
41 |
| return {kind => $self->{parser}{rule}, %{$self->_locate_hash(_merge_hash($param->[0]))}, %$directives}; |
| 374 |
21 |
| } |
| 375 |
|
| |
| 376 |
196 |
▶ | method got_typeSystemDefinition (Any $param = undef) { |
|
Subroutine
got_typeSystemDefinition: called CC=5 SCAR=16.3
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method got_typeSystemDefinition (expected 1, got ' . @_ . ')') |
0 |
196 |
196 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method got_typeSystemDefinition (expected 2, got ' . @_ . ')') |
0 |
196 |
196 |
|
| 377 |
196 |
▶ | return unless defined $param; |
Branch: 1 branch
| Branch | True | False | Total |
| unless defined $param |
0 |
196 |
196 |
|
| 378 |
196 |
| my @copy = @$param; |
| 379 |
196 |
| my $node = pop @copy; |
| 380 |
196 |
▶ | my $description = $copy[0] // {}; |
|
|
| 381 |
196 |
| +{ %$node, %$description }; |
| 382 |
21 |
| } |
| 383 |
|
| |
| 384 |
143 |
▶ | method got_typeDefinition (Any $param = undef) { |
|
Subroutine
got_typeDefinition: called CC=4 SCAR=14.2
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method got_typeDefinition (expected 1, got ' . @_ . ')') |
0 |
143 |
143 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method got_typeDefinition (expected 2, got ' . @_ . ')') |
0 |
143 |
143 |
|
| 385 |
143 |
▶ | return unless defined $param; |
Branch: 1 branch
| Branch | True | False | Total |
| unless defined $param |
0 |
143 |
143 |
|
| 386 |
143 |
| return $param; |
| 387 |
21 |
| } |
| 388 |
|
| |
| 389 |
123 |
▶ | method got_variable (Any $param = undef) { |
|
Subroutine
got_variable: called CC=4 SCAR=14.2
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method got_variable (expected 1, got ' . @_ . ')') |
0 |
123 |
123 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method got_variable (expected 2, got ' . @_ . ')') |
0 |
123 |
123 |
|
| 390 |
123 |
▶ | return unless defined $param; |
Branch: 1 branch
| Branch | True | False | Total |
| unless defined $param |
0 |
123 |
123 |
|
| 391 |
123 |
| my $varname = $param->{name}; |
| 392 |
123 |
| return \$varname; |
| 393 |
21 |
| } |
| 394 |
|
| |
| 395 |
54 |
▶ | method got_nonNullType (Any $param = undef) { |
|
Subroutine
got_nonNullType: called CC=5 SCAR=16.6
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method got_nonNullType (expected 1, got ' . @_ . ')') |
0 |
54 |
54 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method got_nonNullType (expected 2, got ' . @_ . ')') |
0 |
54 |
54 |
|
| 396 |
54 |
▶ | return unless defined $param; |
Branch: 1 branch
| Branch | True | False | Total |
| unless defined $param |
0 |
54 |
54 |
|
| 397 |
54 |
| $param = $param->[0]; # zap first useless layer |
| 398 |
54 |
▶ | $param = { type => $param } if ref $param ne 'HASH'; |
Branch: 1 branch
| Branch | True | False | Total |
| if ref $param ne "HASH" |
54 |
0 |
54 |
|
| 399 |
54 |
| return [ 'non_null', $param ]; |
| 400 |
21 |
| } |
| 401 |
|
| |
| 402 |
38 |
▶ | method got_listType (Any $param = undef) { |
|
Subroutine
got_listType: called CC=5 SCAR=16.6
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method got_listType (expected 1, got ' . @_ . ')') |
0 |
38 |
38 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method got_listType (expected 2, got ' . @_ . ')') |
0 |
38 |
38 |
|
| 403 |
38 |
▶ | return unless defined $param; |
Branch: 1 branch
| Branch | True | False | Total |
| unless defined $param |
0 |
38 |
38 |
|
| 404 |
38 |
| $param = $param->[0]; # zap first useless layer |
| 405 |
38 |
▶ | $param = { type => $param } if ref $param ne 'HASH'; |
Branch: 1 branch
| Branch | True | False | Total |
| if ref $param ne "HASH" |
0 |
38 |
38 |
|
| 406 |
38 |
| return [ 'list', $param ]; |
| 407 |
21 |
| } |
| 408 |
|
| |
| 409 |
21 |
| 1; |