| 1 | # ABSTRACT: Infer arguments, return values and termination of subs from their compiled op trees | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # PODNAME: Pod::Coverage::More::Analyzer | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | package Pod::Coverage::More::Analyzer 0.001; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 15 | ▶ | use 5.036; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 15 | ▶ | use warnings FATAL => q{all}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 15 | ▶ | use re q{/xsaa}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 15 | ▶ | use B (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 15 | ▶ | use List::Util qw{any}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 15 | ▶ | use Module::Runtime qw{require_module module_notional_filename}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 15 | ▶ | use Package::Stash; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 15 | ▶ | use Pod::Coverage::More::Declared; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 15 | ▶ | use Pod::Coverage::More::Types qw{type_of_value type_of_usage type_named}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 15 | ▶ | use Scalar::Util qw{blessed}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | # The pad and SV helpers return an explicit undef because their callers put them in hash constructors, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | # where a bare return would give an empty list and shift every pair after it. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | # Lowest perl version of each version set, highest first. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 15 | our @BACKENDS = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | [ 5.044 => 'Pod::Coverage::More::Analyzer::Perl5_44' ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | [ 5.038 => 'Pod::Coverage::More::Analyzer::Perl5_38' ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | [ 5.036 => 'Pod::Coverage::More::Analyzer::Perl5_36' ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | # The ops whose names say what kind of value they read or produce. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 15 | our %NUMERIC_OPS = map { $_ => 1 } qw{ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | add subtract multiply divide modulo pow negate abs int sqrt | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | lt gt le ge eq ne ncmp preinc predec postinc postdec | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | i_add i_subtract i_multiply i_divide i_modulo i_negate | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | i_lt i_gt i_le i_ge i_eq i_ne i_ncmp i_preinc i_predec i_postinc i_postdec | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 15 | our %STRING_OPS = map { $_ => 1 } qw{ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | concat multiconcat seq sne slt sgt sle sge scmp | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | lc uc lcfirst ucfirst length substr index rindex match subst split | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 15 | our %TERMINATORS = map { $_ => 1 } qw{ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | CORE::GLOBAL::die CORE::GLOBAL::exit | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | Carp::croak Carp::confess | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | POSIX::_exit | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 15 | our %BOOLEAN_OPS = map { $_ => 1 } qw{ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | not defined exists | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | lt gt le ge eq ne i_lt i_gt i_le i_ge i_eq i_ne | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | slt sgt sle sge seq sne | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | # The ops whose result is always a whole number. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 15 | our %INTEGER_OPS = map { $_ => 1 } qw{ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | index rindex scmp time | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | i_add i_subtract i_multiply i_divide i_modulo i_negate i_ncmp | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | # The ops whose result is a whole number or undef: length of undef, and <=> of NaN. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 15 | our %MAYBE_INTEGER_OPS = map { $_ => 1 } qw{length ncmp}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | # The classes that the numbers of the scope of each bignum pragma are, by its key in %^H. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 15 | our %BIG_CLASSES = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | bigint => ['Math::BigInt'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | bignum => [ 'Math::BigInt', 'Math::BigFloat' ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | bigrat => ['Math::BigRat'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | bigfloat => ['Math::BigFloat'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 15 | our %NUMBER_OPS = map { $_ => 1 } qw{ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | add subtract multiply divide modulo pow negate abs int sqrt ncmp scmp | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | i_add i_subtract i_multiply i_divide i_modulo i_negate i_ncmp | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | length index rindex time | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 15 | our %STRING_RESULT_OPS = map { $_ => 1 } qw{ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | concat multiconcat stringify join sprintf lc uc lcfirst ucfirst substr ref | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 15 | our %LIST_OPS = map { $_ => 1 } qw{ sort grepwhile mapwhile keys values reverse split }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 15 | our $HELEM = B::opnumber(q{helem}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 15 | our @HASH_MDEREF_ACTIONS = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | B::MDEREF_HV_pop_rv2hv_helem(), B::MDEREF_HV_gvsv_vivify_rv2hv_helem(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | B::MDEREF_HV_padsv_vivify_rv2hv_helem(), B::MDEREF_HV_vivify_rv2hv_helem(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | B::MDEREF_HV_padhv_helem(), B::MDEREF_HV_gvhv_helem(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | # An analyzer of the subclass that handles the running perl. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | # @returns Object the analyzer, an instance of that subclass | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | # @throws when the running perl is older than the oldest supported version set | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | # @example my $analyzer = Pod::Coverage::More::Analyzer->new; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 21 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=3 SCAR=11.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 21 | my ($class) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 21 | ▶ | my $backend = $class eq __PACKAGE__ ? backend_for($]) : $class; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 21 | ▶ | require_module($backend) if $backend ne $class; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 21 | return bless( {}, $backend ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | # The subclass that handles the perl C<version>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | # @param version Num in the numeric form of C<$]> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | # @returns Str the name of the subclass | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | # @throws when no subclass handles the version | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | # @example my $backend = Pod::Coverage::More::Analyzer::backend_for($]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 30 | ▶ | sub backend_for { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
backend_for: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 30 | my ($version) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 30 | foreach my $backend (@BACKENDS) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 40 | ▶ | return $backend->[1] if $version >= $backend->[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 2 | die "Perl $version is not supported, the oldest supported perl is $BACKENDS[-1][0]\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | # The records of the subs that C<package> defines, as C<analyze_sub> returns them. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | # The package must be loaded already. Subs that it imported from another package are left out. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | # When a class builder or a signature module declares a sub, as L<Pod::Coverage::More::Declared> reads it, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | # its record also has C<declared>: that declaration, with C<wrapped> in place of its C<body>, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | # and each parameter that a declared one matches has C<declared>, the declared L<Type::Tiny> constraint. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | # The record of a sub that only wraps the code that does the work describes that code. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | # @param package Str the name of the package | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | # @returns HashRef from the name of each sub to its record | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | # @example my $records = $analyzer->analyze_package('Pod::Coverage::More'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 37 | ▶ | sub analyze_package { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
analyze_package: called CC=7 SCAR=19.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 37 | my ( $self, $package ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 37 | my $stash = Package::Stash->new($package); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 37 | my %code; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 37 | foreach my $name ( $stash->list_all_symbols(q{CODE}) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 355 | my $code = $stash->get_symbol("&$name"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 355 | ▶ | $code{$name} = $code if _defined_in( B::svref_2object($code) ) eq $package; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 37 | my $declared = Pod::Coverage::More::Declared->declarations_for( $package, [ sort keys %code ] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 37 | my %subs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 37 | foreach my $name ( sort keys %code ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 288 | my $declaration = $declared->{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 288 | ▶ | my $body = $declaration ? $declaration->{body} : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 288 | ▶ | $subs{$name} = $self->analyze_sub( $body // $code{$name}, $name, $package ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$body // $code{$name}
MC/DC0%0/2
$body // $code{$name}
$body
$code{$name}
Truth table66%2/3
A // B
A= $bodyB= $code{$name}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 288 | ▶ | _attach_declaration( $subs{$name}, $declaration ) if $declaration; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 37 | return \%subs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | # Records DECLARATION on the record REC, and the declared type of each parameter on the parameter that it matches: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | # by name, or else by position. The invocant is never matched, because a class builder and the code number it differently. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 23 | ▶ | sub _attach_declaration { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_attach_declaration: called CC=12 SCAR=24.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 23 | my ( $rec, $declaration ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 23 | my %declared = %$declaration; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 23 | ▶ | $declared{wrapped} = delete( $declared{body} ) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 23 | $rec->{declared} = \%declared; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 23 | foreach my $param ( @{ $rec->{params} } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 20 | foreach my $candidate ( @{ $declaration->{params} } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 37 | ▶ | next if $candidate->{invocant} || !$candidate->{type}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$candidate->{"invocant"} or not $candidate->{"type"}
MC/DC100%2/2
$candidate->{"invocant"} or not $candidate->{"type"}
$candidate->{"invocant"}
not $candidate->{"type"}
Truth table100%3/3
A or not(B)
A= $candidate->{"invocant"}B= not $candidate->{"type"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 21 | ▶ | my $by_name = defined $candidate->{name} && defined $param->{name} && $candidate->{name} eq $param->{name}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition83%5/6
defined $candidate->{'name'} && defined $param->{'name'} && $candidate->{'name'} eq $param->{'name'}
defined $candidate->{"name"} and defined $param->{"name"}
MC/DC66%2/3
defined $candidate->{'name'} && defined $param->{'name'} && $candidate->{'name'} eq $param->{'name'}
defined $candidate->{"name"}
defined $param->{"name"}
$candidate->{'name'} eq $param->{'name'}
Truth table75%3/4
A and B && C
A= defined $candidate->{"name"}B= defined $param->{"name"}C= $candidate->{'name'} eq $param->{'name'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 21 | ▶ | my $by_position = !defined $candidate->{name} && defined $candidate->{index} && $candidate->{index} == $param->{index}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%6/6
!defined($candidate->{'name'}) && defined $candidate->{'index'} && $candidate->{'index'} == $param->{'index'}
not defined $candidate->{"name"} and defined $candidate->{"index"}
MC/DC100%3/3
!defined($candidate->{'name'}) && defined $candidate->{'index'} && $candidate->{'index'} == $param->{'index'}
not defined $candidate->{"name"}
defined $candidate->{"index"}
$candidate->{'index'} == $param->{'index'}
Truth table100%4/4
not(A) and B && C
A= not defined $candidate->{"name"}B= defined $candidate->{"index"}C= $candidate->{'index'} == $param->{'index'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 21 | ▶ | next if !$by_name && !$by_position; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$by_name or $by_position
MC/DC100%2/2
$by_name or $by_position
$by_name
$by_position
Truth table100%3/3
A or B
A= $by_nameB= $by_position
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 8 | $param->{declared} = $candidate->{type}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 8 | $param->{declared_by} = $declaration->{via}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 8 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 23 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | # The record of what the op tree of C<code> shows, as RECORDS describes it. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | # @param code CodeRef the sub | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | # @param name Str the name of the sub | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | # @param package Str the package that the sub belongs to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | # @returns HashRef the record | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | # @example my $record = $analyzer->analyze_sub( \&Pod::Coverage::More::coverage, 'coverage', 'Pod::Coverage::More' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 288 | ▶ | sub analyze_sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
analyze_sub: called CC=17 SCAR=28.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 288 | my ( $self, $code, $name, $package ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 288 | my $cv = B::svref_2object($code); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 288 | my %rec = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | name => $name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | package => $package, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | file => $cv->FILE, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | generated => _is_generated( $cv, $name, $package ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | method => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | signature => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | reads_args => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | params => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | usage => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | returns => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | dies => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 288 | ▶ | if ( $cv->CvFLAGS & B::CVf_CONST ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 6 | $rec{kind} = 'constant'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 6 | $rec{value} = $code->(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 6 | my $returned = _sv_evidence( B::svref_2object( \$rec{value} ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 6 | push @{ $rec{returns} }, { %$returned, constraint => type_of_value($returned) }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 6 | return \%rec; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 282 | ▶ | if ( $cv->XSUB ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 7 | $rec{kind} = 'xs'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 7 | return \%rec; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 275 | $rec{kind} = 'perl'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | # The state of one walk lives on a copy of the analyzer, which shares its caches. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 275 | ▶ | $self->{handlers} //= $self->op_handlers; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$self->{"handlers"} //= $self->op_handlers
MC/DC0%0/2
$self->{"handlers"} //= $self->op_handlers
$self->{"handlers"}
$self->op_handlers
Truth table66%2/3
A //= B
A= $self->{"handlers"}B= $self->op_handlers
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 275 | ▶ | $self->{classifiers} //= $self->op_classifiers; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$self->{"classifiers"} //= $self->op_classifiers
MC/DC0%0/2
$self->{"classifiers"} //= $self->op_classifiers
$self->{"classifiers"}
$self->op_classifiers
Truth table66%2/3
A //= B
A= $self->{"classifiers"}B= $self->op_classifiers
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 275 | my $walker = bless { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | %$self, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | cv => $cv, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | rec => \%rec, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | shifted => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | consumed => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | line_of => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | line => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | signature => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | checkers => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | guards => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | big => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | big_of => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | ref $self; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 275 | $walker->_walk( $cv->ROOT, [] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 275 | push @{ $rec{returns} }, map { +{ %$_, implicit => 1 } } $walker->_implicit_returns( $cv->ROOT ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 275 | $walker->finish_sub( \%rec ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | # A class taken from the invocant is the package or a subclass, and an object of either is an instance of the package. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 275 | ▶ | my ($invocant) = grep { $_->{index} == 0 && defined $_->{name} } @{ $rec{params} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$_->{'index'} == 0 && defined $_->{'name'}
MC/DC100%2/2
$_->{'index'} == 0 && defined $_->{'name'}
$_->{'index'} == 0
defined $_->{'name'}
Truth table100%3/3
A && B
A= $_->{'index'} == 0B= defined $_->{'name'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 275 | foreach my $returned ( @{ $rec{returns} } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | $returned->{class} //= $package | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 301 | ▶ | if $invocant && $returned->{type} eq 'object' && ( $returned->{class_from} // q{} ) eq $invocant->{name}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition81%9/11
$invocant and $returned->{"type"} eq "object" and ($returned->{"class_from"} // "") eq $invocant->{"name"}
$invocant and $returned->{"type"} eq "object"
$returned->{"class_from"} // ""
$returned->{"class"} //= $package
MC/DC100%3/3
$invocant and $returned->{"type"} eq "object" and ($returned->{"class_from"} // "") eq $invocant->{"name"}
$invocant
$returned->{"type"} eq "object"
$returned->{"class_from"}
MC/DC0%0/2
$returned->{"class"} //= $package
$returned->{"class"}
$package
Truth table100%4/4
A and B and C
A= $invocantB= $returned->{"type"} eq "object"C= $returned->{"class_from"}
Truth table33%1/3
A //= B
A= $returned->{"class"}B= $package
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 301 | $returned->{constraint} = type_of_value($returned); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 275 | @{ $rec{params} } = sort { $a->{index} <=> $b->{index} } @{ $rec{params} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 275 | foreach my $param ( @{ $rec{params} } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 284 | ▶ | next unless defined $param->{name}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 269 | my $keys = $rec{usage}{ $param->{name} }{keys}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 269 | ▶ | $param->{keys} = [@$keys] if $keys; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 269 | ▶ | $param->{inferred} = type_of_usage( $rec{usage}{ $param->{name} } || {} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$rec{'usage'}{$param->{'name'}} || {}
MC/DC0%0/1
$rec{'usage'}{$param->{'name'}} || {}
$rec{'usage'}{$param->{'name'}}
Truth table50%1/2
A
A= $rec{'usage'}{$param->{'name'}}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 269 | ▶ | if ( my $guard = $walker->{guards}{ $param->{name} } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 20 | $param->{declared} = $guard->{type}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 20 | $param->{declared_by} = $guard->{by}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 275 | return \%rec; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | # Called once the op tree of a sub was walked, before the parameters are sorted. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | # Subclasses override it to add what only the whole tree shows. The default does nothing. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | # @param record HashRef the record of the sub, as RECORDS describes it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | # @returns nothing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | # @example $walker->finish_sub( \%record ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | ▶ | sub finish_sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
finish_sub: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | # The methods that the walk calls for each op, with the op and the ARRAYREF of its ancestors, nearest last. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | # Subclasses add the ops of their version set to what this returns. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | # @returns HashRef from the name of each op to the name of its method | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | # @example my $handlers = $analyzer->op_handlers; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 20 | ▶ | sub op_handlers { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
op_handlers: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | return { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 20 | nextstate => \&_on_cop, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | dbstate => \&_on_cop, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | sassign => \&_on_sassign, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | aassign => \&_on_aassign, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | shift => \&_on_shift, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | aelemfast => \&_on_aelemfast, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | padsv => \&_on_pad, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | padav => \&_on_pad, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | padhv => \&_on_pad, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | rv2av => \&_on_rv2av, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | multideref => \&_on_multideref, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | helem => \&_on_helem, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | exists => \&_on_exists, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | delete => \&_on_exists, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | entersub => \&_on_entersub, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | return => \&_on_return, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | die => \&_on_die, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | exit => \&_on_die, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | # The methods that C<classify> calls for some ops, ahead of its own rules. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | # Subclasses add the value-producing ops of their version set here, as they add walk handlers in C<op_handlers>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | # The default has none. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | # @returns HashRef from the name of each op to the name of its method | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | # @example my $classifiers = $analyzer->op_classifiers; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 20 | ▶ | sub op_classifiers { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
op_classifiers: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 20 | return {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | # The kids of C<op>, in order, for the handlers of subclasses. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | # @param op B::OP the op | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | # @returns the kids, as a list of B::OP objects | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | # @example my @kids = $self->op_kids($op); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 5473 | ▶ | sub op_kids { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
op_kids: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 5473 | my ( undef, $op ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 5473 | return _kids($op); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | # Whether something other than the source of PACKAGE wrote the sub: a closure installed under another name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | # a string eval, or a sub compiled in another file, as a class builder compiles accessors. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 288 | ▶ | sub _is_generated { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_is_generated: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 288 | my ( $cv, $name, $package ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 288 | ▶ | return 1 if $cv->GV->NAME ne $name || $cv->FILE =~ m/\A\(eval/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$cv->GV->NAME ne $name or $cv->FILE =~ /\A\(eval/aasx
MC/DC100%2/2
$cv->GV->NAME ne $name or $cv->FILE =~ /\A\(eval/aasx
$cv->GV->NAME ne $name
$cv->FILE =~ /\A\(eval/aasx
Truth table100%3/3
A or B
A= $cv->GV->NAME ne $nameB= $cv->FILE =~ /\A\(eval/aasx
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 280 | my $own = $INC{ module_notional_filename($package) }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 280 | ▶ | return ( defined $own && $cv->FILE ne $own ) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $own and $cv->FILE ne $own
MC/DC50%1/2
defined $own and $cv->FILE ne $own
defined $own
$cv->FILE ne $own
Truth table66%2/3
A and B
A= defined $ownB= $cv->FILE ne $own
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | # The package the sub was compiled in, as opposed to the one it was imported into. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 355 | ▶ | sub _defined_in { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_defined_in: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 355 | my ($cv) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 355 | my $gv = $cv->GV; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 355 | ▶ | return '' if B::class($gv) ne 'GV'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 355 | return $gv->STASH->NAME; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | # These subs walk an op tree, which is as deep as the nesting of the source, and so recursion is their natural form. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | ## no critic (Subroutines::ProhibitTailRecursion) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 5360 | ▶ | sub _walk { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_walk: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 5360 | my ( $self, $op, $ancestors ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 5360 | ▶ | return if !$$op; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 5360 | $self->{line_of}{$$op} = $self->{line}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 5360 | $self->{big_of}{$$op} = $self->{big}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 5360 | my $handler = $self->{handlers}{ $op->name }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 5360 | ▶ | $self->$handler( $op, $ancestors ) if $handler; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 5360 | my @kids = $self->op_kids($op); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 5360 | ▶ | return unless @kids; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 2569 | push @$ancestors, $op; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 2569 | foreach my $kid (@kids) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 5085 | $self->_walk( $kid, $ancestors ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 2569 | pop @$ancestors; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 2569 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | # The values a sub returns when control reaches its end without a return statement. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 575 | ▶ | sub _last_values { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_last_values: called CC=25 SCAR=36.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 575 | my ( $self, $op ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 575 | ▶ | return () if !$op || !$$op; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$op and $$op
MC/DC0%0/2
$op and $$op
$op
$$op
Truth table33%1/3
A and B
A= $opB= $$op
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 575 | my $name = $op->name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 575 | ▶ | if ( $name eq 'lineseq' || $name eq 'scope' || $name eq 'leave' || $name eq 'null' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition88%8/9
$name eq "lineseq" or $name eq "scope" or $name eq "leave" or $name eq "null"
$name eq "lineseq" or $name eq "scope" or $name eq "leave"
$name eq "lineseq" or $name eq "scope"
MC/DC75%3/4
$name eq "lineseq" or $name eq "scope" or $name eq "leave" or $name eq "null"
$name eq "lineseq"
$name eq "scope"
$name eq "leave"
$name eq "null"
Truth table80%4/5
A or B or C or D
A= $name eq "lineseq"B= $name eq "scope"C= $name eq "leave"D= $name eq "null"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 290 | my @kids; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 290 | foreach my $kid ( _significant_kids($op) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 1111 | ▶ | push @kids, $kid unless $kid->name eq 'nextstate' || $kid->name eq 'dbstate' || $kid->name eq 'enter'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$kid->name eq "nextstate" or $kid->name eq "dbstate" or $kid->name eq "enter"
$kid->name eq "nextstate" or $kid->name eq "dbstate"
MC/DC66%2/3
$kid->name eq "nextstate" or $kid->name eq "dbstate" or $kid->name eq "enter"
$kid->name eq "nextstate"
$kid->name eq "dbstate"
$kid->name eq "enter"
Truth table75%3/4
A or B or C
A= $kid->name eq "nextstate"B= $kid->name eq "dbstate"C= $kid->name eq "enter"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 290 | ▶ | return () if !@kids && $name ne 'null'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not @kids and $name ne "null"
MC/DC0%0/2
not @kids and $name ne "null"
not @kids
$name ne "null"
Truth table33%1/3
not(A) and B
A= not @kidsB= $name ne "null"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 290 | ▶ | return $self->classify($op) if !@kids; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | # A null op that wraps one expression is that expression. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 290 | ▶ | return $self->_last_values( $kids[-1] ) if $name ne 'null' || @kids == 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$name ne "null" or @kids == 1
MC/DC0%0/2
$name ne "null" or @kids == 1
$name ne "null"
@kids == 1
Truth table66%2/3
A or B
A= $name ne "null"B= @kids == 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | return $self->classify($op); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 285 | ▶ | if ( $name eq 'cond_expr' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 5 | my ( undef, $then, $else ) = _kids($op); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 5 | return ( $self->_last_values($then), $self->_last_values($else) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 280 | ▶ | if ( $name eq 'and' || $name eq 'or' || $name eq 'dor' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$name eq "and" or $name eq "or" or $name eq "dor"
$name eq "and" or $name eq "or"
MC/DC0%0/3
$name eq "and" or $name eq "or" or $name eq "dor"
$name eq "and"
$name eq "or"
$name eq "dor"
Truth table25%1/4
A or B or C
A= $name eq "and"B= $name eq "or"C= $name eq "dor"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | # if (COND) { BODY } without an else: COND's value when the body does not run. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 0 | my ( $cond, $body ) = _kids($op); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 0 | return ( $self->classify($cond), $self->_last_values($body) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 280 | ▶ | return () if $name eq 'return' || $name eq 'die' || $name eq 'exit' || $name eq 'stub'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition77%7/9
$name eq "return" or $name eq "die" or $name eq "exit" or $name eq "stub"
$name eq "return" or $name eq "die" or $name eq "exit"
$name eq "return" or $name eq "die"
MC/DC50%2/4
$name eq "return" or $name eq "die" or $name eq "exit" or $name eq "stub"
$name eq "return"
$name eq "die"
$name eq "exit"
$name eq "stub"
Truth table60%3/5
A or B or C or D
A= $name eq "return"B= $name eq "die"C= $name eq "exit"D= $name eq "stub"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 18 | my $line = $self->{line_of}{$$op}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 18 | ▶ | return ( { type => 'unknown', op => 'loop', line => $line } ) if $name eq 'leaveloop'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 18 | return map { +{ %$_, line => $line } } $self->classify($op); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | # The evidence that C<op>, an op that produces a value, gives about that value. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | # It is one HASHREF per alternative, because an expression such as C<COND ? A : B> has more than one. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | # The C<type> of each is one of C<undef>, C<empty>, C<number>, C<string>, C<boolean>, C<hashref>, C<arrayref>, C<coderef>, C<ref>, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | # C<object>, C<variable>, C<call>, C<method>, C<list>, C<context> or C<unknown>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | # @param op B::OP the op that produces the value | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | # @returns the evidence, as a list of HASHREFs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | # @example my @evidence = $self->classify($op); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 275 | ▶ | sub classify { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
classify: called CC=35 SCAR=37.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 275 | my ( $self, $op ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 275 | $op = _unwrap($op); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | 275 | my $name = $op->name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 275 | my $classifier = $self->{classifiers}{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 275 | ▶ | return $self->$classifier($op) if $classifier; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 262 | ▶ | return _sv_evidence( $self->_const_sv($op) ) if $name eq 'const'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 187 | ▶ | return { type => 'undef' } if $name eq 'undef'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 176 | ▶ | return { type => 'hashref' } if $name eq 'anonhash'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 173 | ▶ | return { type => 'arrayref' } if $name eq 'anonlist'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 159 | ▶ | return { type => 'coderef' } if $name eq 'anoncode'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 159 | ▶ | return { type => 'context' } if $name eq 'wantarray'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 159 | ▶ | return $self->_classify_refgen($op) if $name eq 'srefgen' || $name eq 'refgen'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$name eq "srefgen" or $name eq "refgen"
MC/DC0%0/2
$name eq "srefgen" or $name eq "refgen"
$name eq "srefgen"
$name eq "refgen"
Truth table33%1/3
A or B
A= $name eq "srefgen"B= $name eq "refgen"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 159 | ▶ | return $self->_classify_bless($op) if $name eq 'bless'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 138 | ▶ | if ( $name eq 'scalar' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 7 | my ($kid) = _significant_kids($op); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 7 | ▶ | return { type => 'unknown', op => $name } if !$kid; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 7 | my $kname = _unwrap($kid)->name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 7 | ▶ | return { type => 'number', integer => 1 } if $kname eq 'padav' || $kname eq 'rv2av'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$kname eq "padav" or $kname eq "rv2av"
MC/DC100%2/2
$kname eq "padav" or $kname eq "rv2av"
$kname eq "padav"
$kname eq "rv2av"
Truth table100%3/3
A or B
A= $kname eq "padav"B= $kname eq "rv2av"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | 1 | return $self->classify($kid); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 131 | ▶ | if ( $name eq 'padsv' || $name eq 'padav' || $name eq 'padhv' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$name eq "padsv" or $name eq "padav" or $name eq "padhv"
$name eq "padsv" or $name eq "padav"
MC/DC66%2/3
$name eq "padsv" or $name eq "padav" or $name eq "padhv"
$name eq "padsv"
$name eq "padav"
$name eq "padhv"
Truth table75%3/4
A or B or C
A= $name eq "padsv"B= $name eq "padav"C= $name eq "padhv"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 24 | return { type => 'variable', name => $self->_padname( $op->targ ) }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 107 | ▶ | if ( $name eq 'sassign' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 3 | my ($value) = _kids($op); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 3 | return $self->classify($value); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 104 | ▶ | if ( $name eq 'cond_expr' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 19 | my ( $cond, $then, $else ) = _kids($op); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | # wantarray ? LIST : SCALAR says which value goes with which context. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 19 | ▶ | if ( _unwrap($cond)->name eq 'wantarray' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | return ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 2 | ( map { +{ %$_, context => 'list' } } $self->classify($then) ), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 2 | ( map { +{ %$_, context => 'scalar' } } $self->classify($else) ), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 17 | return ( $self->classify($then), $self->classify($else) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 85 | ▶ | if ( $name eq 'or' || $name eq 'dor' || $name eq 'and' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$name eq "or" or $name eq "dor" or $name eq "and"
$name eq "or" or $name eq "dor"
MC/DC0%0/3
$name eq "or" or $name eq "dor" or $name eq "and"
$name eq "or"
$name eq "dor"
$name eq "and"
Truth table25%1/4
A or B or C
A= $name eq "or"B= $name eq "dor"C= $name eq "and"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | 0 | my @evidence; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 0 | foreach my $kid ( _kids($op) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 0 | push @evidence, $self->classify($kid); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | 0 | return @evidence; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 85 | ▶ | if ( $name eq 'entersub' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 18 | my ($target) = $self->_call_target($op); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 18 | ▶ | return $target // { type => 'call' }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$target // {"type", "call"}
MC/DC0%0/1
$target // {"type", "call"}
$target
Truth table50%1/2
A
A= $target
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 67 | ▶ | return _weak( { type => 'boolean' } ) if $BOOLEAN_OPS{$name}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 67 | ▶ | if ( $NUMBER_OPS{$name} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | # A return statement classifies its value before the walk reaches it, in the scope of the statement. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 31 | ▶ | my $big = exists $self->{big_of}{$$op} ? $self->{big_of}{$$op} : $self->{big}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | 31 | ▶ | return { type => 'object', classes => $big, weak => 1 } if $big; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 30 | ▶ | return _weak( { type => 'number', integer => 1 } ) if $INTEGER_OPS{$name}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 30 | ▶ | return _weak( { type => 'number', integer => 1, maybe_undef => 1 } ) if $MAYBE_INTEGER_OPS{$name}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 29 | return _weak( { type => 'number' } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 36 | ▶ | return _weak( { type => 'string' } ) if $STRING_RESULT_OPS{$name}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 26 | ▶ | return { type => 'list' } if $LIST_OPS{$name}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 26 | return { type => 'unknown', op => $name }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | ## use critic | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | 7332 | ▶ | sub _kids { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_kids: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 7332 | my ($op) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 7332 | ▶ | return () unless $op->flags & B::OPf_KIDS; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | 4477 | my @kids; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 4477 | ▶ | for ( my $kid = $op->first; $$kid; $kid = $kid->sibling ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | 9107 | push @kids, $kid; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 9107 | ▶ | last unless $kid->moresib; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 4477 | return @kids; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | # Kids that do something, as opposed to list markers and optimized-away ops. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | 1297 | ▶ | sub _significant_kids { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_significant_kids: called CC=6 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 1297 | my ($op) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 1297 | my @significant; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 1297 | foreach my $kid ( _kids($op) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | 3100 | my $name = $kid->name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 3100 | ▶ | next if $name eq 'pushmark' || $name eq 'padrange'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$name eq "pushmark" or $name eq "padrange"
MC/DC100%2/2
$name eq "pushmark" or $name eq "padrange"
$name eq "pushmark"
$name eq "padrange"
Truth table100%3/3
A or B
A= $name eq "pushmark"B= $name eq "padrange"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 2422 | ▶ | next if $name eq 'null' && !( $kid->flags & B::OPf_KIDS ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$name eq "null" and not $kid->flags & 4
MC/DC100%2/2
$name eq "null" and not $kid->flags & 4
$name eq "null"
not $kid->flags & 4
Truth table100%3/3
A and not(B)
A= $name eq "null"B= not $kid->flags & 4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 2380 | push @significant, $kid; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 1297 | return @significant; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | # Unwrap ex-list and similar null ops that have one kid. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 969 | ▶ | sub _unwrap { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_unwrap: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | 969 | my ($op) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 969 | ▶ | while ( $op->name eq 'null' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | 208 | my @kids = _significant_kids($op); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 208 | ▶ | last if @kids != 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 208 | $op = $kids[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 969 | return $op; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 907 | ▶ | sub _padname { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_padname: called CC=4 SCAR=14.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | 907 | my ( $self, $targ ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | 907 | ▶ | return undef if !$targ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | 905 | my $padname = $self->{cv}->PADLIST->ARRAYelt(0)->ARRAYelt($targ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 905 | ▶ | return undef if !$padname || B::class($padname) eq 'SPECIAL'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not $padname or B::class($padname) eq "SPECIAL"
MC/DC0%0/2
not $padname or B::class($padname) eq "SPECIAL"
not $padname
B::class($padname) eq "SPECIAL"
Truth table33%1/3
not(A) or B
A= not $padnameB= B::class($padname) eq "SPECIAL"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 905 | return $padname->PVX; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | 0 | ▶ | sub _padval { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_padval: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | 0 | my ( $self, $index ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 0 | return $self->{cv}->PADLIST->ARRAYelt(1)->ARRAYelt($index); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | # Under threaded perls, GVs and constants live in the pad instead of the op. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 427 | ▶ | sub _gv { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_gv: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | 427 | my ( $self, $op ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 427 | ▶ | return B::class($op) eq 'PADOP' ? $self->_padval( $op->padix ) : $op->gv; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | 98 | ▶ | sub _const_sv { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_const_sv: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 98 | my ( $self, $op ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 98 | my $sv = $op->sv; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | 98 | ▶ | $sv = $self->_padval( $op->targ ) unless $$sv; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | 98 | return $sv; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 201 | ▶ | sub _sv_value { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_sv_value: called CC=6 SCAR=19.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | 201 | my ($sv) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | 201 | my $class = B::class($sv); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | 201 | ▶ | return undef if $class eq 'SPECIAL' || $class eq 'NULL'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$class eq "SPECIAL" or $class eq "NULL"
MC/DC0%0/2
$class eq "SPECIAL" or $class eq "NULL"
$class eq "SPECIAL"
$class eq "NULL"
Truth table33%1/3
A or B
A= $class eq "SPECIAL"B= $class eq "NULL"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | 201 | my $flags = $sv->FLAGS; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | 201 | ▶ | return $sv->PV if $flags & B::SVf_POK; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 60 | ▶ | return $sv->NV if $flags & B::SVf_NOK; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | 60 | ▶ | return $sv->IV if $flags & B::SVf_IOK; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 81 | ▶ | sub _sv_evidence { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_sv_evidence: called CC=6 SCAR=19.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | 81 | my ($sv) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | 81 | my $class = B::class($sv); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | 81 | ▶ | return { type => 'undef' } if $class eq 'SPECIAL' || $class eq 'NULL'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$class eq "SPECIAL" or $class eq "NULL"
MC/DC0%0/2
$class eq "SPECIAL" or $class eq "NULL"
$class eq "SPECIAL"
$class eq "NULL"
Truth table33%1/3
A or B
A= $class eq "SPECIAL"B= $class eq "NULL"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 81 | my $flags = $sv->FLAGS; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 81 | ▶ | return _reference_evidence( $sv->RV ) if $flags & B::SVf_ROK; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | 78 | ▶ | return { type => 'string', value => $sv->PV } if $flags & B::SVf_POK; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | 60 | ▶ | return { type => 'number', value => _sv_value($sv) } if $flags & ( B::SVf_IOK | B::SVf_NOK ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | 0 | return { type => 'undef' }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | # The result of an operator is only probable: an operand of a class that overloads the operator, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | # such as Math::GMP, makes it an object of that class. So its EVIDENCE is weak. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | 40 | ▶ | sub _weak { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_weak: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | 40 | my ($evidence) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | 40 | return { %$evidence, weak => 1 }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | # A constant that holds a reference, as use bigint makes of every numeric literal, or use constant of a list. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | 3 | ▶ | sub _reference_evidence { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_reference_evidence: called CC=5 SCAR=21.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | 3 | my ($referent) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | 3 | ▶ | return { type => 'object', class => $referent->SvSTASH->NAME } if $referent->FLAGS & B::SVs_OBJECT; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | 1 | my $class = B::class($referent); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | 1 | ▶ | return { type => 'arrayref' } if $class eq 'AV'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | 0 | ▶ | return { type => 'hashref' } if $class eq 'HV'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | 0 | ▶ | return { type => 'coderef' } if $class eq 'CV'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | 0 | return { type => 'ref' }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 427 | ▶ | sub _fullname { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_fullname: called CC=2 SCAR=7.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 427 | my ($gv) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 427 | ▶ | return undef if B::class($gv) ne 'GV'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | 427 | return $gv->STASH->NAME . '::' . $gv->NAME; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | # The name of the sub a call goes to, where it was defined rather than where it was imported to, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | # so that an imported croak reads as Carp::croak. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | 79 | ▶ | sub _sub_fullname { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_sub_fullname: called CC=6 SCAR=21.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 79 | my ($gv) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | 79 | ▶ | return undef if B::class($gv) ne 'GV'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | 79 | my $cv = $gv->CV; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | 79 | ▶ | if ( $$cv && B::class($cv) eq 'CV' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$$cv and B::class($cv) eq "CV"
MC/DC0%0/2
$$cv and B::class($cv) eq "CV"
$$cv
B::class($cv) eq "CV"
Truth table33%1/3
A and B
A= $$cvB= B::class($cv) eq "CV"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | 79 | my $origin = $cv->GV; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | 79 | ▶ | return _fullname($origin) if B::class($origin) eq 'GV' && $origin->NAME ne '__ANON__'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
B::class($origin) eq "GV" and $origin->NAME ne "__ANON__"
MC/DC0%0/2
B::class($origin) eq "GV" and $origin->NAME ne "__ANON__"
B::class($origin) eq "GV"
$origin->NAME ne "__ANON__"
Truth table33%1/3
A and B
A= B::class($origin) eq "GV"B= $origin->NAME ne "__ANON__"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | 0 | return _fullname($gv); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | 318 | ▶ | sub _is_args_array { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_is_args_array: called CC=5 SCAR=16.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | 318 | my ( $self, $op ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 318 | $op = _unwrap($op); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | 318 | ▶ | return 0 unless $op->name eq 'rv2av'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | 314 | my ($gvop) = _kids($op); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 314 | ▶ | return 0 unless $gvop && $gvop->name eq 'gv'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$gvop and $gvop->name eq "gv"
MC/DC50%1/2
$gvop and $gvop->name eq "gv"
$gvop
$gvop->name eq "gv"
Truth table66%2/3
A and B
A= $gvopB= $gvop->name eq "gv"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | 307 | my $gv = $self->_gv($gvop); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | 307 | ▶ | return ( _fullname($gv) // '' ) eq 'main::_'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
_fullname($gv) // ""
MC/DC0%0/1
_fullname($gv) // ""
_fullname($gv)
Truth table50%1/2
A
A= _fullname($gv)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | # A shift or pop of @_. With no argument, the op has no kids at all. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | 74 | ▶ | sub _is_args_shift { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_is_args_shift: called CC=3 SCAR=11.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | 74 | my ( $self, $op ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | 74 | $op = _unwrap($op); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | 74 | ▶ | return 0 unless $op->name eq 'shift'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | 36 | my @kids = _kids($op); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | 36 | ▶ | return 1 if !@kids; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | 0 | return $self->_is_args_array( $kids[0] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | 364 | ▶ | sub _usage_of { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_usage_of: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | 364 | my ( $self, $var ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | 364 | ▶ | return $self->{rec}{usage}{$var} //= {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{"rec"}{"usage"}{$var} //= {}
MC/DC100%1/1
$self->{"rec"}{"usage"}{$var} //= {}
$self->{"rec"}{"usage"}{$var}
Truth table100%2/2
A
A= $self->{"rec"}{"usage"}{$var}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | 289 | ▶ | sub _add_param { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_add_param: called CC=8 SCAR=20.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | 289 | my ( $self, %param ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 289 | my $params = $self->{rec}{params}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | 289 | ▶ | return if defined $param{name} && any { ( $_->{name} // '' ) eq $param{name} } @$params; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.1
Branch: 1 branch
Condition80%4/5
defined $param{"name"} and &any(sub {
($_->{"name"} // "") eq $param{"name"};
}
, @$params)
$_->{"name"} // ""
MC/DC0%0/2
defined $param{"name"} and &any(sub {
($_->{"name"} // "") eq $param{"name"};
}
, @$params)
defined $param{"name"}
&any(sub {
($_->{"name"} // "") eq $param{"name"};
}
, @$params)
MC/DC100%1/1
$_->{"name"} // ""
$_->{"name"}
Truth table66%2/3
A and B
A= defined $param{"name"}B= &any(sub {
($_->{"name"} // "") eq $param{"name"};
}
, @$params)
Truth table100%2/2
A
A= $_->{"name"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | 289 | ▶ | return if !defined $param{name} && any { $_->{index} == $param{index} } @$params; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
Condition100%3/3
not defined $param{"name"} and &any(sub {
$_->{"index"} == $param{"index"};
}
, @$params)
MC/DC100%2/2
not defined $param{"name"} and &any(sub {
$_->{"index"} == $param{"index"};
}
, @$params)
not defined $param{"name"}
&any(sub {
$_->{"index"} == $param{"index"};
}
, @$params)
Truth table100%3/3
not(A) and B
A= not defined $param{"name"}B= &any(sub {
$_->{"index"} == $param{"index"};
}
, @$params)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | 283 | ▶ | $param{slurpy} //= ( defined $param{name} && $param{name} =~ m/\A[@%]/ ) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%5/5
$param{"slurpy"} //= defined $param{"name"} && $param{"name"} =~ /\A[\@%]/aasx ? 1 : 0
defined $param{"name"} and $param{"name"} =~ /\A[\@%]/aasx
MC/DC100%1/1
$param{"slurpy"} //= defined $param{"name"} && $param{"name"} =~ /\A[\@%]/aasx ? 1 : 0
$param{"slurpy"}
Truth table100%2/2
A
A= $param{"slurpy"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | 283 | push @$params, \%param; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | 283 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | 650 | ▶ | sub _on_cop { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_on_cop: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | 650 | my ( $self, $op ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | 650 | $self->{line} = $op->line; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | 650 | ▶ | $self->{rec}{line} //= $op->line; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$self->{"rec"}{"line"} //= $op->line
MC/DC0%0/2
$self->{"rec"}{"line"} //= $op->line
$self->{"rec"}{"line"}
$op->line
Truth table66%2/3
A //= B
A= $self->{"rec"}{"line"}B= $op->line
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | 650 | my $hints = $op->hints_hash->HASH; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | 650 | my ($pragma) = grep { $hints->{$_} } sort keys %BIG_CLASSES; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | 650 | ▶ | $self->{big} = $pragma ? $BIG_CLASSES{$pragma} : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | 650 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | 51 | ▶ | sub _assign_from_args { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_assign_from_args: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | 51 | my ( $self, $value, $target_name ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | 51 | $value = _unwrap($value); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | 51 | ▶ | if ( $self->_is_args_shift($value) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | 16 | $self->{consumed}{$$value} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | 16 | $self->_add_param( name => $target_name, index => $self->{shifted}++, source => 'shift' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | ▶ | elsif ( $value->name eq 'aelemfast' && $self->_is_args_elem($value) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$value->name eq "aelemfast" and $self->_is_args_elem($value)
MC/DC50%1/2
$value->name eq "aelemfast" and $self->_is_args_elem($value)
$value->name eq "aelemfast"
$self->_is_args_elem($value)
Truth table66%2/3
A and B
A= $value->name eq "aelemfast"B= $self->_is_args_elem($value)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | 5 | $self->{consumed}{$$value} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | 5 | $self->_add_param( name => $target_name, index => _elem_index($value), source => 'element' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | elsif ( my ( $elem, $default, $mode ) = $self->_defaulted_elem($value) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | 7 | $self->{consumed}{$$elem} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | 7 | $self->_add_param( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | name => $target_name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | index => _elem_index($elem), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | source => 'element', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | optional => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | default => { mode => $mode, value => [ $self->classify($default) ] }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | 51 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | # $_[N] with a default: @_ > N ? $_[N] : DEFAULT, as Method::Signatures and hand-written code say it, or $_[N] // DEFAULT. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | # Returns the element, the default, and how the default applies, or nothing. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | 30 | ▶ | sub _defaulted_elem { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_defaulted_elem: called CC=9 SCAR=22.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | 30 | my ( $self, $op ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | 30 | my $name = $op->name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | 30 | ▶ | if ( $name eq 'cond_expr' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | 8 | my ( undef, $then, $else ) = _kids($op); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | 8 | $then = _unwrap($then); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | 8 | ▶ | return ( $then, $else, q{=} ) if $then->name eq 'aelemfast' && $self->_is_args_elem($then); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$then->name eq "aelemfast" and $self->_is_args_elem($then)
MC/DC50%1/2
$then->name eq "aelemfast" and $self->_is_args_elem($then)
$then->name eq "aelemfast"
$self->_is_args_elem($then)
Truth table66%2/3
A and B
A= $then->name eq "aelemfast"B= $self->_is_args_elem($then)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | 25 | ▶ | if ( $name eq 'dor' || $name eq 'or' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$name eq "dor" or $name eq "or"
MC/DC100%2/2
$name eq "dor" or $name eq "or"
$name eq "dor"
$name eq "or"
Truth table100%3/3
A or B
A= $name eq "dor"B= $name eq "or"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | 3 | my ( $left, $right ) = _kids($op); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | 3 | $left = _unwrap($left); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | 3 | ▶ | return ( $left, $right, $name eq 'dor' ? q{//=} : q{||=} ) if $left->name eq 'aelemfast' && $self->_is_args_elem($left); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
$left->name eq "aelemfast" and $self->_is_args_elem($left)
MC/DC50%1/2
$left->name eq "aelemfast" and $self->_is_args_elem($left)
$left->name eq "aelemfast"
$self->_is_args_elem($left)
Truth table66%2/3
A and B
A= $left->name eq "aelemfast"B= $self->_is_args_elem($left)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | 23 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | # The assignment of one value to a lexical scalar: the value is the first kid, and the target the last. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | 21 | ▶ | sub _on_sassign { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_on_sassign: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | 21 | my ( $self, $op ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | 21 | my @kids = _kids($op); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | 21 | ▶ | return if @kids != 2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | 18 | my $target = _unwrap( $kids[1] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | 18 | ▶ | return unless $target->name eq 'padsv'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | 2 | $self->_assign_from_args( $kids[0], $self->_padname( $target->targ ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | 2 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | # A list assignment to lexicals, from @_ or from one shift of it. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | 138 | ▶ | sub _on_aassign { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_on_aassign: called CC=15 SCAR=27.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | 138 | my ( $self, $op ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | 138 | my ( $rhs, $lhs ) = _kids($op); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | 138 | ▶ | return unless $rhs && $lhs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$rhs and $lhs
MC/DC0%0/2
$rhs and $lhs
$rhs
$lhs
Truth table33%1/3
A and B
A= $rhsB= $lhs
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | 138 | my @values = _significant_kids($rhs); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | 138 | my @targets; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | 138 | foreach my $kid ( _significant_kids($lhs) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | 217 | ▶ | push @targets, $kid if $kid->name =~ m/\Apad[ash]v\z/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | 138 | ▶ | return if @values != 1 || !@targets; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@values != 1 or not @targets
MC/DC50%1/2
@values != 1 or not @targets
@values != 1
not @targets
Truth table66%2/3
A or not(B)
A= @values != 1B= not @targets
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | 137 | ▶ | if ( $self->_is_args_array( $values[0] ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | 133 | foreach my $target (@targets) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | 209 | my $name = $self->_padname( $target->targ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | 209 | ▶ | if ( $target->name eq 'padsv' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | 187 | $self->_add_param( name => $name, index => $self->{shifted}++, source => 'list' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | 22 | $self->_add_param( name => $name, index => $self->{shifted}, source => 'list' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | 22 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | elsif ( $self->_is_args_shift( $values[0] ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | 1 | $self->{consumed}{ ${ _unwrap( $values[0] ) } } = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | 1 | $self->_add_param( name => $self->_padname( $targets[0]->targ ), index => $self->{shifted}++, source => 'shift' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | elsif ( my $checked = $self->_checked_call( $values[0] ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | 3 | my @types = @{ $checked->{types} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | 3 | foreach my $target (@targets) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | 6 | my $name = $self->_padname( $target->targ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | 6 | ▶ | if ( $target->name ne 'padsv' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | 1 | $self->_add_param( name => $name, index => $self->{shifted}, source => 'checked' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | 1 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | 5 | my $type = shift @types; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | $self->_add_param( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | name => $name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | index => $self->{shifted}++, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | source => 'checked', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | 5 | ▶ | $type ? ( declared => $type, declared_by => $checked->{by} ) : (), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | 137 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | # A call that checks the arguments of the sub, such as $check->(@_), validate(\@_, ...) or validate_pos(@_, ...): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | # returns the types it checks them against, by position, as far as the op tree shows them, or nothing when OP is no such call. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | 3 | ▶ | sub _checked_call { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_checked_call: called CC=11 SCAR=24.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | 3 | my ( $self, $op ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | 3 | $op = _unwrap($op); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | 3 | ▶ | return if $op->name ne 'entersub'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | 3 | my ( $target, $args ) = $self->_call_target($op); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | 3 | my @rest = @$args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | 3 | my $receives_args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | 3 | ▶ | while ( my $arg = shift @rest ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | 3 | my $value = _unwrap($arg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | 3 | ▶ | $value = _unwrap( ( _kids($value) )[0] ) if $value->name eq 'srefgen' && _kids($value); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$value->name eq "srefgen" and _kids($value)
MC/DC50%1/2
$value->name eq "srefgen" and _kids($value)
$value->name eq "srefgen"
_kids($value)
Truth table66%2/3
A and B
A= $value->name eq "srefgen"B= _kids($value)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | 3 | ▶ | next if !$self->_is_args_array($value); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | 3 | $receives_args = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | 3 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | 3 | ▶ | return if !$receives_args; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | 3 | ▶ | if ( ( $target->{function} // q{} ) eq 'Type::Params::validate' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$target->{"function"} // ""
MC/DC100%1/1
$target->{"function"} // ""
$target->{"function"}
Truth table100%2/2
A
A= $target->{"function"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | 1 | return { types => $self->_try_static_values( \@rest ), by => 'Type::Params' }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | 2 | ▶ | my $checker = defined $target->{coderef} ? $self->{checkers}{ $target->{coderef} } : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | 2 | ▶ | return { types => [ @{ $checker // [] } ], by => 'Type::Params' }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$checker // []
MC/DC100%1/1
$checker // []
$checker
Truth table100%2/2
A
A= $checker
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | # The value that OP builds from constants and calls to the type functions of a Type::Library, as in Optional[Str]. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | # Dies when OP builds anything else. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | # It walks the op tree of one expression, and so recursion is its natural form. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | ## no critic (Subroutines::ProhibitTailRecursion) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | 17 | ▶ | sub _static_value { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_static_value: called CC=11 SCAR=24.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | 17 | my ( $self, $op ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | 17 | $op = _unwrap($op); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | 17 | my $name = $op->name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | 17 | ▶ | return _sv_value( $self->_const_sv($op) ) if $name eq 'const'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | 12 | ▶ | if ( $name eq 'anonlist' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | 2 | my @values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | 2 | foreach my $kid ( _significant_kids($op) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | 2 | push @values, $self->_static_value($kid); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | 2 | return \@values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | 10 | ▶ | if ( $name eq 'entersub' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | 7 | my ( $target, $args ) = $self->_call_target($op); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | 7 | ▶ | my ( $library, $type ) = ( $target->{function} // q{} ) =~ m/\A(.+)::(\w+)\z/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$target->{"function"} // ""
MC/DC0%0/1
$target->{"function"} // ""
$target->{"function"}
Truth table50%1/2
A
A= $target->{"function"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | 7 | ▶ | die "not a type\n" if !$type || !_is_type_library($library) || !$library->has_type($type); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$type and _is_type_library($library) and $library->has_type($type)
$type and _is_type_library($library)
MC/DC0%0/3
$type and _is_type_library($library) and $library->has_type($type)
$type
_is_type_library($library)
$library->has_type($type)
Truth table25%1/4
A and B and C
A= $typeB= _is_type_library($library)C= $library->has_type($type)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | 7 | ▶ | return $library->get_type($type) if !@$args; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | 2 | my @values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | 2 | foreach my $arg (@$args) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | 2 | push @values, $self->_static_value($arg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | 2 | return $library->can($type)->(@values); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | 3 | die "not a static value\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | ## use critic | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | # The value of _static_value, or undef when OP builds anything else. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | 13 | ▶ | sub _try_static_value { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_try_static_value: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | 13 | my ( $self, $op ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | 13 | my $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | 13 | ▶ | return eval { $value = $self->_static_value($op); 1 } ? $value : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | # The values of _try_static_value for each op of the ARRAYREF OPS. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | 2 | ▶ | sub _try_static_values { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_try_static_values: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | 2 | my ( $self, $ops ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | 2 | my @values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | 2 | foreach my $op (@$ops) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | 4 | push @values, $self->_try_static_value($op); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | 2 | return \@values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | 25 | ▶ | sub _is_type_library { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_is_type_library: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | 25 | my ($package) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | 25 | my $is; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | 25 | ▶ | return eval { $is = $package->isa('Type::Library'); 1 } ? $is : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | # Records the types that compile() of Type::Params returns a checker for, under the variable the checker is assigned to. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | 1 | ▶ | sub _note_checker { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_note_checker: called CC=6 SCAR=21.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | 1 | my ( $self, $args, $ancestors ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | 1 | ▶ | my $parent = $ancestors->[-1] // return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$ancestors->[-1] // (return)
MC/DC0%0/1
$ancestors->[-1] // (return)
$ancestors->[-1]
Truth table50%1/2
A
A= $ancestors->[-1]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | 1 | my $var; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | 1 | ▶ | $var = $self->_padname( $parent->targ ) if $parent->name eq 'padsv_store'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | 1 | ▶ | if ( $parent->name eq 'sassign' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | 0 | my ( undef, $target ) = _kids($parent); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | 0 | $target = _unwrap($target); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | 0 | ▶ | $var = $self->_padname( $target->targ ) if $target->name eq 'padsv'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | 1 | ▶ | return if !defined $var; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | 1 | $self->{checkers}{$var} = $self->_try_static_values($args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | 15 | our %GUARD_METHODS = map { $_ => 1 } qw{assert_valid assert_return check}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | # Records the type that a guard checks a variable against: is_X($var) and assert_X($var) of a Type::Library, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | # TYPE->assert_valid($var) and its kind, and the type_error() calls that Method::Signatures compiles. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | 108 | ▶ | sub _note_guard { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_note_guard: called CC=17 SCAR=29.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | 108 | my ( $self, $target, $args ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | 108 | my ( $type, $checked, $by ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | 108 | ▶ | if ( defined $target->{function} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | 64 | my ( $library, $guard ) = $target->{function} =~ m/\A(.+)::(?:assert|is)_(\w+)\z/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | 64 | ▶ | return if !$guard || !_is_type_library($library) || !$library->has_type($guard); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
$guard and _is_type_library($library) and $library->has_type($guard)
$guard and _is_type_library($library)
MC/DC33%1/3
$guard and _is_type_library($library) and $library->has_type($guard)
$guard
_is_type_library($library)
$library->has_type($guard)
Truth table50%2/4
A and B and C
A= $guardB= _is_type_library($library)C= $library->has_type($guard)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | 18 | ( $type, $checked, $by ) = ( $library->get_type($guard), $args->[0], 'Type::Tiny' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | ▶ | elsif ( $target->{type} eq 'method' && defined $target->{method} ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$target->{"type"} eq "method" and defined $target->{"method"}
MC/DC50%1/2
$target->{"type"} eq "method" and defined $target->{"method"}
$target->{"type"} eq "method"
defined $target->{"method"}
Truth table66%2/3
A and B
A= $target->{"type"} eq "method"B= defined $target->{"method"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | 32 | ▶ | my $invocant = $args->[0] // return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args->[0] // (return)
MC/DC0%0/1
$args->[0] // (return)
$args->[0]
Truth table50%1/2
A
A= $args->[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | 32 | ▶ | if ( $GUARD_METHODS{ $target->{method} } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | 5 | $type = $self->_try_static_value($invocant); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | 5 | ( $checked, $by ) = ( $args->[1], 'Type::Tiny' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | ▶ | elsif ( $target->{method} eq 'type_error' && ( $self->_try_static_value($invocant) // q{} ) eq 'Method::Signatures' ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition60%3/5
$target->{"method"} eq "type_error" and ($self->_try_static_value($invocant) // "") eq "Method::Signatures"
$self->_try_static_value($invocant) // ""
MC/DC50%1/2
$target->{"method"} eq "type_error" and ($self->_try_static_value($invocant) // "") eq "Method::Signatures"
$target->{"method"} eq "type_error"
$self->_try_static_value($invocant)
Truth table66%2/3
A and B
A= $target->{"method"} eq "type_error"B= $self->_try_static_value($invocant)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | 2 | my $name = $self->_try_static_value( $args->[1] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | 2 | $type = type_named($name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | 2 | ( $checked, $by ) = ( $args->[2], 'Method::Signatures' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | 62 | ▶ | return if !$type || !blessed($type) || !$checked; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
$type and builtin::blessed($type) and $checked
$type and builtin::blessed($type)
MC/DC33%1/3
$type and builtin::blessed($type) and $checked
$type
builtin::blessed($type)
$checked
Truth table50%2/4
A and B and C
A= $typeB= builtin::blessed($type)C= $checked
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | 22 | $checked = _unwrap($checked); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | 22 | ▶ | return if $checked->name ne 'padsv'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | 21 | ▶ | my $var = $self->_padname( $checked->targ ) // return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->_padname($checked->targ) // (return)
MC/DC0%0/1
$self->_padname($checked->targ) // (return)
$self->_padname($checked->targ)
Truth table50%1/2
A
A= $self->_padname($checked->targ)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | 21 | $self->{guards}{$var} = { type => $type, by => $by }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | 21 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | # Any use of @_, as a sub that only passes it on makes. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | 178 | ▶ | sub _on_rv2av { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_on_rv2av: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | 178 | my ( $self, $op ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | 178 | ▶ | $self->{rec}{reads_args} = 1 if $self->_is_args_array($op); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | 178 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | # A shift of @_ that is not assigned to a variable, as in shift->method. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | 19 | ▶ | sub _on_shift { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_on_shift: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | 19 | my ( $self, $op ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | 19 | ▶ | return unless $self->_is_args_shift($op); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | 19 | $self->{rec}{reads_args} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | 19 | ▶ | return if $self->{consumed}{$$op}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | 2 | $self->_add_param( name => undef, index => $self->{shifted}++, source => 'shift' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | 2 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | 41 | ▶ | sub _is_args_elem { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_is_args_elem: called CC=2 SCAR=7.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | 41 | my ( $self, $op ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | 41 | my $gv = $self->_gv($op); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | 41 | ▶ | return ( _fullname($gv) // '' ) eq 'main::_'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
_fullname($gv) // ""
MC/DC0%0/1
_fullname($gv) // ""
_fullname($gv)
Truth table50%1/2
A
A= _fullname($gv)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | 29 | ▶ | sub _elem_index { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_elem_index: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | 29 | my ($op) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | 29 | return unpack( 'c', pack( 'C', $op->private ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | # $_[N] used directly. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | 29 | ▶ | sub _on_aelemfast { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_on_aelemfast: called CC=4 SCAR=14.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | 29 | my ( $self, $op ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | 29 | ▶ | return unless $self->_is_args_elem($op); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | 29 | $self->{rec}{reads_args} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | 29 | ▶ | return if $self->{consumed}{$$op}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | 17 | my $index = _elem_index($op); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | 17 | ▶ | return if $index < 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | 17 | $self->_add_param( name => undef, index => $index, source => 'element' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | 17 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | 471 | ▶ | sub _on_pad { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_on_pad: called CC=9 SCAR=22.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | 471 | my ( $self, $op, $ancestors ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | 471 | ▶ | my $var = $self->_padname( $op->targ ) // return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->_padname($op->targ) // (return)
MC/DC0%0/1
$self->_padname($op->targ) // (return)
$self->_padname($op->targ)
Truth table50%1/2
A
A= $self->_padname($op->targ)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | 471 | ▶ | my $parent = $ancestors->[-1] // return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$ancestors->[-1] // (return)
MC/DC0%0/1
$ancestors->[-1] // (return)
$ancestors->[-1]
Truth table50%1/2
A
A= $ancestors->[-1]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | 471 | my $pname = $parent->name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | # A declaration of the variable is not a use of it. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | 471 | ▶ | return if $op->private & B::OPpLVAL_INTRO; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 897 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 898 | 248 | my $usage = $self->_usage_of($var); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 899 | 248 | ▶ | if ( $pname eq 'rv2hv' ) { $usage->{hashref} = 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 5 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 900 | 4 | elsif ( $pname eq 'rv2av' ) { $usage->{arrayref} = 1 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 901 | 0 | elsif ( $pname eq 'rv2cv' ) { $usage->{coderef} = 1 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 902 | 37 | elsif ( $NUMERIC_OPS{$pname} ) { $usage->{numeric} = 1 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 903 | 31 | elsif ( $STRING_OPS{$pname} ) { $usage->{string} = 1 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 904 | 248 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 905 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 906 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 907 | 87 | ▶ | sub _add_key { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_add_key: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 908 | 87 | my ( $self, $var, $key ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 909 | 87 | ▶ | return if !defined $var || !defined $key; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $var and defined $key
MC/DC50%1/2
defined $var and defined $key
defined $var
defined $key
Truth table66%2/3
A and B
A= defined $varB= defined $key
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 910 | 67 | my $usage = $self->_usage_of($var); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 911 | 67 | ▶ | $usage->{keys} //= []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$usage->{"keys"} //= []
MC/DC100%1/1
$usage->{"keys"} //= []
$usage->{"keys"}
Truth table100%2/2
A
A= $usage->{"keys"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 912 | 67 | ▶ | push @{ $usage->{keys} }, $key unless any { $_ eq $key } @{ $usage->{keys} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 913 | 67 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 914 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 915 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 916 | # $h->{a}[0], $o{size}, exists $o{verbose} and the like, compiled into one op. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 917 | 85 | ▶ | sub _on_multideref { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_on_multideref: called CC=18 SCAR=29.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 918 | 85 | my ( $self, $op ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 919 | 85 | my @items = $op->aux_list( $self->{cv} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 920 | 85 | my $actions = shift @items; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 921 | 85 | my $first = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 922 | 85 | my $var; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 923 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 924 | 85 | while (1) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 925 | 105 | my $action = $actions & B::MDEREF_ACTION_MASK; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 926 | 105 | ▶ | if ( $action == B::MDEREF_reload ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 927 | 0 | $actions = shift @items; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 928 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 929 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 930 | 105 | ▶ | my $is_hash = any { $action == $_ } @HASH_MDEREF_ACTIONS; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 931 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 932 | 105 | ▶ | if ( $action == B::MDEREF_AV_padav_aelem || $action == B::MDEREF_HV_padhv_helem ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
Condition66%2/3
$action == 5 or $action == 12
MC/DC50%1/2
$action == 5 or $action == 12
$action == 5
$action == 12
Truth table66%2/3
A or B
A= $action == 5B= $action == 12
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 933 | 24 | $var = $self->_padname( shift @items ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 934 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 935 | ▶ | elsif ( $action == B::MDEREF_AV_padsv_vivify_rv2av_aelem || $action == B::MDEREF_HV_padsv_vivify_rv2hv_helem ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$action == 3 or $action == 10
MC/DC100%2/2
$action == 3 or $action == 10
$action == 3
$action == 10
Truth table100%3/3
A or B
A= $action == 3B= $action == 10
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 936 | 36 | $var = $self->_padname( shift @items ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 937 | 36 | ▶ | $self->_usage_of($var)->{ $is_hash ? 'hashref' : 'arrayref' } = 1 if defined $var; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 938 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 939 | ▶ | elsif ($action == B::MDEREF_AV_gvav_aelem | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition77%7/9
$action == 6 or $action == 13 or $action == 2 or $action == 9
$action == 6 or $action == 13 or $action == 2
$action == 6 or $action == 13
MC/DC50%2/4
$action == 6 or $action == 13 or $action == 2 or $action == 9
$action == 6
$action == 13
$action == 2
$action == 9
Truth table60%3/5
A or B or C or D
A= $action == 6B= $action == 13C= $action == 2D= $action == 9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 940 | || $action == B::MDEREF_HV_gvhv_helem | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 941 | || $action == B::MDEREF_AV_gvsv_vivify_rv2av_aelem | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 942 | || $action == B::MDEREF_HV_gvsv_vivify_rv2hv_helem ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 943 | 25 | shift @items; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 944 | 25 | $var = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 945 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 946 | elsif ( !$first ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 947 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 948 | # A deeper level of a chain that started at $var: it says nothing more about $var itself. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 949 | 20 | $var = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 950 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 951 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 952 | 105 | my $index = $actions & B::MDEREF_INDEX_MASK; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 953 | 105 | ▶ | last if $index == B::MDEREF_INDEX_none; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 954 | 105 | my $key = shift @items; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 955 | 105 | ▶ | if ( $index == B::MDEREF_INDEX_const ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 956 | 105 | ▶ | $self->_add_key( $var, ref $key ? _sv_value($key) : $key ) if $is_hash; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 957 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 958 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 959 | 105 | ▶ | last if $actions & B::MDEREF_FLAG_last; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 960 | 20 | $actions >>= B::MDEREF_SHIFT; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 961 | 20 | $first = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 962 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 963 | 85 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 964 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 965 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 966 | # $o{name} or $h->{name} when perl did not fold it into a multideref. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 967 | 8 | ▶ | sub _on_helem { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_on_helem: called CC=8 SCAR=23.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 968 | 8 | my ( $self, $op ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 969 | 8 | my ( $hash, $key ) = _kids($op); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 970 | 8 | ▶ | return unless $hash && $key && $key->name eq 'const'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$hash and $key and $key->name eq "const"
$hash and $key
MC/DC0%0/3
$hash and $key and $key->name eq "const"
$hash
$key
$key->name eq "const"
Truth table25%1/4
A and B and C
A= $hashB= $keyC= $key->name eq "const"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 971 | 8 | my $var; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 972 | 8 | ▶ | if ( $hash->name eq 'padhv' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 973 | 7 | $var = $self->_padname( $hash->targ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 974 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 975 | elsif ( $hash->name eq 'rv2hv' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 976 | 1 | my ($ref) = _kids($hash); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 977 | 1 | ▶ | $var = $self->_padname( $ref->targ ) if $ref && $ref->name eq 'padsv'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$ref and $ref->name eq "padsv"
MC/DC0%0/2
$ref and $ref->name eq "padsv"
$ref
$ref->name eq "padsv"
Truth table33%1/3
A and B
A= $refB= $ref->name eq "padsv"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 978 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 979 | 8 | $self->_add_key( $var, _sv_value( $self->_const_sv($key) ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 980 | 8 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 981 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 982 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 983 | # exists $o{name} or delete $o{name} when perl did not fold it into a multideref: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 984 | # the hash element is then a null op that was a helem. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 985 | 2 | ▶ | sub _on_exists { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_on_exists: called CC=4 SCAR=15.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 986 | 2 | my ( $self, $op ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 987 | 2 | my ($elem) = _kids($op); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 988 | 2 | ▶ | return if !$elem; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 989 | 2 | ▶ | return if $elem->name ne q{null} || $elem->targ != $HELEM; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$elem->name ne "null" or $elem->targ != $Pod::Coverage::More::Analyzer::HELEM
MC/DC0%0/2
$elem->name ne "null" or $elem->targ != $Pod::Coverage::More::Analyzer::HELEM
$elem->name ne "null"
$elem->targ != $Pod::Coverage::More::Analyzer::HELEM
Truth table33%1/3
A or B
A= $elem->name ne "null"B= $elem->targ != $Pod::Coverage::More::Analyzer::HELEM
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 990 | 2 | $self->_on_helem($elem); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 991 | 2 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 992 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 993 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 994 | 136 | ▶ | sub _call_target { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_call_target: called CC=11 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 995 | 136 | my ( $self, $op ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 996 | 136 | my @args = _significant_kids($op); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 997 | 136 | ▶ | @args = _significant_kids( $args[0] ) if @args == 1 && $args[0]->name eq 'null'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@args == 1 and $args[0]->name eq "null"
MC/DC50%1/2
@args == 1 and $args[0]->name eq "null"
@args == 1
$args[0]->name eq "null"
Truth table66%2/3
A and B
A= @args == 1B= $args[0]->name eq "null"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 998 | 136 | my $target = pop @args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 999 | 136 | ▶ | return ( undef, \@args ) if !$target; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1000 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1001 | 136 | ▶ | if ( $target->name eq 'method_named' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1002 | 39 | my $sv = $target->meth_sv; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1003 | 39 | ▶ | $sv = $self->_padval( $target->targ ) unless $$sv; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1004 | 39 | return ( { type => 'method', method => _sv_value($sv) }, \@args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1005 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1006 | 97 | ▶ | if ( $target->name eq 'method' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1007 | 0 | return ( { type => 'method', method => undef }, \@args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1008 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1009 | 97 | my $cvop = _unwrap($target); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1010 | 97 | ▶ | $cvop = _unwrap( ( _kids($cvop) )[0] ) if $cvop->name eq 'rv2cv' && _kids($cvop); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$cvop->name eq "rv2cv" and _kids($cvop)
MC/DC0%0/2
$cvop->name eq "rv2cv" and _kids($cvop)
$cvop->name eq "rv2cv"
_kids($cvop)
Truth table33%1/3
A and B
A= $cvop->name eq "rv2cv"B= _kids($cvop)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1011 | 97 | ▶ | if ( $cvop->name eq 'gv' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1012 | 79 | return ( { type => 'call', function => _sub_fullname( $self->_gv($cvop) ) }, \@args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1013 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1014 | 18 | ▶ | if ( $cvop->name eq 'padsv' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1015 | 9 | return ( { type => 'call', coderef => $self->_padname( $cvop->targ ) }, \@args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1016 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1017 | 9 | return ( { type => 'call' }, \@args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1018 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1019 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1020 | 108 | ▶ | sub _on_entersub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_on_entersub: called CC=10 SCAR=23.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1021 | 108 | my ( $self, $op, $ancestors ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1022 | 108 | my ( $target, $args ) = $self->_call_target($op); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1023 | 108 | ▶ | return if !$target; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1024 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1025 | 108 | ▶ | $self->_note_checker( $args, $ancestors ) if ( $target->{function} // q{} ) eq 'Type::Params::compile'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$target->{"function"} // ""
MC/DC100%1/1
$target->{"function"} // ""
$target->{"function"}
Truth table100%2/2
A
A= $target->{"function"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1026 | 108 | $self->_note_guard( $target, $args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1027 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1028 | 108 | ▶ | if ( $target->{type} eq 'method' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1029 | 32 | $self->_add_method_use( $args->[0], $target->{method} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1030 | 32 | ▶ | $self->_add_death( 'throw', $ancestors ) if ( $target->{method} // '' ) eq 'throw'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$target->{"method"} // ""
MC/DC0%0/1
$target->{"method"} // ""
$target->{"method"}
Truth table50%1/2
A
A= $target->{"method"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1031 | 32 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1032 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1033 | 76 | ▶ | if ( defined $target->{coderef} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1034 | 6 | $self->_usage_of( $target->{coderef} )->{coderef} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1035 | 6 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1036 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1037 | 70 | ▶ | if ( defined $target->{function} && $TERMINATORS{ $target->{function} } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $target->{"function"} and $Pod::Coverage::More::Analyzer::TERMINATORS{$target->{"function"}}
MC/DC100%2/2
defined $target->{"function"} and $Pod::Coverage::More::Analyzer::TERMINATORS{$target->{"function"}}
defined $target->{"function"}
$Pod::Coverage::More::Analyzer::TERMINATORS{$target->{"function"}}
Truth table100%3/3
A and B
A= defined $target->{"function"}B= $Pod::Coverage::More::Analyzer::TERMINATORS{$target->{"function"}}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1038 | 7 | $self->_add_death( $target->{function}, $ancestors ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1039 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1040 | 70 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1041 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1042 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1043 | # Records METHOD as called on the variable that INVOCANT reads, when it reads one. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1044 | 32 | ▶ | sub _add_method_use { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_add_method_use: called CC=7 SCAR=20.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1045 | 32 | my ( $self, $invocant, $method ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1046 | 32 | ▶ | return if !$invocant || !defined $method; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$invocant and defined $method
MC/DC0%0/2
$invocant and defined $method
$invocant
defined $method
Truth table33%1/3
A and B
A= $invocantB= defined $method
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1047 | 32 | $invocant = _unwrap($invocant); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1048 | 32 | ▶ | return if $invocant->name ne 'padsv'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1049 | 7 | ▶ | my $var = $self->_padname( $invocant->targ ) // return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->_padname($invocant->targ) // (return)
MC/DC0%0/1
$self->_padname($invocant->targ) // (return)
$self->_padname($invocant->targ)
Truth table50%1/2
A
A= $self->_padname($invocant->targ)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1050 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1051 | 7 | my $usage = $self->_usage_of($var); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1052 | 7 | ▶ | $usage->{methods} //= []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$usage->{"methods"} //= []
MC/DC0%0/1
$usage->{"methods"} //= []
$usage->{"methods"}
Truth table50%1/2
A
A= $usage->{"methods"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1053 | 0 | ▶ | push @{ $usage->{methods} }, $method unless any { $_ eq $method } @{ $usage->{methods} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=0.4
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1054 | 7 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1055 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1056 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1057 | 34 | ▶ | sub _add_death { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_add_death: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1058 | 34 | my ( $self, $via, $ancestors ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1059 | 34 | ▶ | push @{ $self->{rec}{dies} }, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1060 | via => $via, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1061 | line => $self->{line}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1062 | 34 | caught => _is_caught($ancestors) ? 1 : 0, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1063 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1064 | 34 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1065 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1066 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1067 | # Inside eval {} or the try block of try/catch, but not inside its catch block. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1068 | 34 | ▶ | sub _is_caught { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_is_caught: called CC=6 SCAR=18.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1069 | 34 | my ($ancestors) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1070 | 34 | foreach my $ancestor ( reverse @$ancestors ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1071 | 154 | my $name = $ancestor->name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1072 | 154 | ▶ | return 1 if $name eq 'leavetry'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1073 | 152 | ▶ | return 0 if $name eq 'catch'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1074 | 152 | ▶ | return 1 if $name eq 'leavetrycatch' || $name eq 'entertrycatch'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$name eq "leavetrycatch" or $name eq "entertrycatch"
MC/DC0%0/2
$name eq "leavetrycatch" or $name eq "entertrycatch"
$name eq "leavetrycatch"
$name eq "entertrycatch"
Truth table33%1/3
A or B
A= $name eq "leavetrycatch"B= $name eq "entertrycatch"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1075 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1076 | 32 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1077 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1078 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1079 | 27 | ▶ | sub _on_die { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_on_die: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1080 | 27 | my ( $self, $op, $ancestors ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1081 | 27 | $self->_add_death( $op->name, $ancestors ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1082 | 27 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1083 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1084 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1085 | 264 | ▶ | sub _on_return { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_on_return: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1086 | 264 | my ( $self, $op ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1087 | 264 | my @values = _significant_kids($op); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1088 | 264 | my $line = $self->{line}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1089 | 264 | my @evidence; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1090 | 264 | ▶ | if ( !@values ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1091 | 70 | @evidence = ( { type => 'empty' } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1092 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1093 | elsif ( @values == 1 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1094 | 190 | @evidence = $self->classify( $values[0] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1095 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1096 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1097 | 4 | my @items; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1098 | 4 | foreach my $value (@values) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1099 | 13 | push @items, [ $self->classify($value) ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1100 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1101 | 4 | @evidence = ( { type => 'list', count => scalar(@values), items => \@items } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1102 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1103 | 264 | push @{ $self->{rec}{returns} }, map { +{ %$_, line => $line, implicit => 0 } } @evidence; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1104 | 264 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1105 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1106 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1107 | 275 | ▶ | sub _implicit_returns { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_implicit_returns: called CC=2 SCAR=7.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1108 | 275 | my ( $self, $op ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1109 | 275 | ▶ | $op = $op->first if $op->name eq 'leavesub'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1110 | 275 | return $self->_last_values($op); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1111 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1112 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1113 | 0 | ▶ | sub _classify_refgen { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_classify_refgen: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1114 | 0 | my ( $self, $op ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1115 | 0 | my ($kid) = _significant_kids($op); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1116 | 0 | ▶ | $kid = _unwrap($kid) if $kid; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1117 | 0 | ▶ | my $kname = $kid ? $kid->name : ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1118 | 0 | ▶ | return { type => 'coderef' } if $kname eq 'anoncode'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1119 | 0 | ▶ | return { type => 'arrayref' } if $kname eq 'padav' || $kname eq 'rv2av'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$kname eq "padav" or $kname eq "rv2av"
MC/DC0%0/2
$kname eq "padav" or $kname eq "rv2av"
$kname eq "padav"
$kname eq "rv2av"
Truth table0%0/3
A or B
A= $kname eq "padav"B= $kname eq "rv2av"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1120 | 0 | ▶ | return { type => 'hashref' } if $kname eq 'padhv' || $kname eq 'rv2hv'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$kname eq "padhv" or $kname eq "rv2hv"
MC/DC0%0/2
$kname eq "padhv" or $kname eq "rv2hv"
$kname eq "padhv"
$kname eq "rv2hv"
Truth table0%0/3
A or B
A= $kname eq "padhv"B= $kname eq "rv2hv"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1121 | 0 | return { type => 'ref' }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1122 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1123 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1124 | 21 | ▶ | sub _classify_bless { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_classify_bless: called CC=5 SCAR=16.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1125 | 21 | my ( $self, $op ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1126 | 21 | my ( undef, $class ) = _significant_kids($op); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1127 | 21 | ▶ | return { type => 'object', class => $self->{rec}{package} } if !$class; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1128 | 18 | $class = _unwrap($class); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1129 | 18 | ▶ | return { type => 'object', class => _sv_value( $self->_const_sv($class) ) } if $class->name eq 'const'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1130 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1131 | # bless REF, $class or bless REF, ref($proto) || $proto: the class comes from a variable. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1132 | 8 | ▶ | my $from = $class->name eq 'or' ? _unwrap( ( _kids($class) )[-1] ) : $class; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1133 | 8 | ▶ | return { type => 'object', class => undef, class_from => $self->_padname( $from->targ ) } if $from->name eq 'padsv'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1134 | 0 | return { type => 'object', class => undef }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1135 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1136 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1137 | 15 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1138 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1139 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||