| 1 | package Tangerine::hook::if; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 16 | $Tangerine::hook::if::VERSION = '0.23'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 16 | ▶ | use 5.010; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 16 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 16 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 16 | ▶ | use parent 'Tangerine::Hook'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 16 | ▶ | use Tangerine::HookData; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 16 | ▶ | use Tangerine::Utils qw(any stripquotelike $vre); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 142 | ▶ | sub run { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
run: called CC=18 SCAR=30.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 142 | my ($self, $s) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 142 | ▶ | if ((any { $s->[0] eq $_ } qw(use no)) && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
Condition100%6/6
&any(sub {
$s->[0] eq $_;
}
, "use", "no") and scalar @$s > 3 and $s->[1] eq "if"
&any(sub {
$s->[0] eq $_;
}
, "use", "no") and scalar @$s > 3
MC/DC100%3/3
&any(sub {
$s->[0] eq $_;
}
, "use", "no") and scalar @$s > 3 and $s->[1] eq "if"
&any(sub {
$s->[0] eq $_;
}
, "use", "no")
scalar @$s > 3
$s->[1] eq "if"
Truth table100%4/4
A and B and C
A= &any(sub {
$s->[0] eq $_;
}
, "use", "no")B= scalar @$s > 3C= $s->[1] eq "if"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | scalar(@$s) > 3 && $s->[1] eq 'if') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 5 | my ($version) = $s->[2] =~ $vre; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 5 | ▶ | $version //= ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$version //= ""
MC/DC100%1/1
$version //= ""
$version
Truth table100%2/2
A
A= $version
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 5 | ▶ | my $voffset = $version ? 3 : 2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 5 | my ($depth, $index) = (0, 0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 5 | ▶ | for ($index = $voffset; $index < $#$s; $index++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 11 | my $token = $s->[$index]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 11 | ▶ | $depth++ if ($token eq '[' || $token eq '{' || $token eq '('); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$token eq "[" or $token eq "{" or $token eq "("
$token eq "[" or $token eq "{"
MC/DC0%0/3
$token eq "[" or $token eq "{" or $token eq "("
$token eq "["
$token eq "{"
$token eq "("
Truth table25%1/4
A or B or C
A= $token eq "["B= $token eq "{"C= $token eq "("
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 11 | ▶ | $depth-- if ($token eq ']' || $token eq '}' || $token eq ')'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$token eq "]" or $token eq "}" or $token eq ")"
$token eq "]" or $token eq "}"
MC/DC0%0/3
$token eq "]" or $token eq "}" or $token eq ")"
$token eq "]"
$token eq "}"
$token eq ")"
Truth table25%1/4
A or B or C
A= $token eq "]"B= $token eq "}"C= $token eq ")"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 11 | ▶ | last if ($token eq ';' || !$depth && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%6/9
$token eq ";" or not $depth and $token eq "," || $token eq "=>"
not $depth and $token eq "," || $token eq "=>"
$token eq "," or $token eq "=>"
MC/DC25%1/4
$token eq ";" or not $depth and $token eq "," || $token eq "=>"
$token eq ";"
not $depth
$token eq ","
$token eq "=>"
Truth table40%2/5
A or not(B) and C or D
A= $token eq ";"B= not $depthC= $token eq ","D= $token eq "=>"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | ($token eq ',' || $token eq '=>')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 5 | $index++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 5 | ▶ | if ($s->[$index]) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 4 | $s->[$index] = stripquotelike($s->[$index]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 4 | return Tangerine::HookData->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | children => [ $s->[0], @$s[$index..$#$s] ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 138 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 16 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||