| 1 | package B::Generate; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 7 | require 5.005_62; | |||||||||||||||||||||||||||||||||||||||||
| 4 | 7 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 7 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 7 | ▶ | use B (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 7 | require DynaLoader; | |||||||||||||||||||||||||||||||||||||||||
| 9 | 7 | ▶ | use vars qw( @ISA $VERSION ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 7 | @ISA = qw(DynaLoader); | |||||||||||||||||||||||||||||||||||||||||
| 11 | 7 | $VERSION = '1.55'; | |||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | { | ||||||||||||||||||||||||||||||||||||||||||
| 14 | # 'no warnings' does not work. | ||||||||||||||||||||||||||||||||||||||||||
| 15 | 7 | local $SIG{__WARN__} = sub { | |||||||||||||||||||||||||||||||||||||||||
| 16 | 132 | ▶ | return if $_[0] =~ /Subroutine B(?:::\w+)+ redefined/; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=9.2
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 17 | 0 | warn $_[0]; | |||||||||||||||||||||||||||||||||||||||||
| 18 | 7 | }; | |||||||||||||||||||||||||||||||||||||||||
| 19 | 7 | bootstrap B::Generate $VERSION; | |||||||||||||||||||||||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | package | ||||||||||||||||||||||||||||||||||||||||||
| 23 | B::OP; # do not index | ||||||||||||||||||||||||||||||||||||||||||
| 24 | 7 | ▶ | use constant OP_LIST => B::opnumber("list"); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | 7 | ▶ | use B qw(OPf_PARENS OPf_KIDS); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | # for convenience | ||||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | ▶ | sub B::NULL::type { 0 }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
type: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | # This is where we implement op.c in Perl. Sssh. | ||||||||||||||||||||||||||||||||||||||||||
| 31 | # XXX coverage: 0 | ||||||||||||||||||||||||||||||||||||||||||
| 32 | sub linklist { | ||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | ▶ | my $o = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
linklist: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | ▶ | if ( $o->can("first") and $o->first and ${ $o->first } ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$o->can("first") and $o->first and ${$o->first;}
$o->can("first") and $o->first
MC/DC0%0/3
$o->can("first") and $o->first and ${$o->first;}
$o->can("first")
$o->first
${$o->first;}
Truth table0%0/4
A and B and C
A= $o->can("first")B= $o->firstC= ${$o->first;}
| |||||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | $o->next( $o->first->linklist ); | |||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | ▶ | for ( my $kid = $o->first; $$kid; $kid = $kid->sibling ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | ▶ | if ( ${ $kid->sibling } ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | $kid->next( $kid->sibling->linklist ); | |||||||||||||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||||||||||||
| 40 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | $kid->next($o); | |||||||||||||||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||||||||||||||||
| 45 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | $o->next($o); | |||||||||||||||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | $o->clean; | |||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | return $o->next; | |||||||||||||||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||
| 52 | # coverage: scope.t | ||||||||||||||||||||||||||||||||||||||||||
| 53 | sub append_elem { | ||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | ▶ | my ( $class, $type, $first, $last ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
append_elem: not called CC=9 SCAR=45.0
| |||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | ▶ | return $last unless $first and $$first; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$first and $$first
MC/DC0%0/2
$first and $$first
$first
$$first
Truth table0%0/3
A and B
A= $firstB= $$first
| |||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | ▶ | return $first unless $last and $$last; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$last and $$last
MC/DC0%0/2
$last and $$last
$last
$$last
Truth table0%0/3
A and B
A= $lastB= $$last
| |||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | ▶ | if ( $first->type() != $type | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$first->type != $type or $type == 161 and $first->flags & 8
$type == 161 and $first->flags & 8
MC/DC0%0/3
$first->type != $type or $type == 161 and $first->flags & 8
$first->type != $type
$type == 161
$first->flags & 8
Truth table0%0/4
A or B and C
A= $first->type != $typeB= $type == 161C= $first->flags & 8
| |||||||||||||||||||||||||||||||||||||||||||
| 59 | or ( $type == OP_LIST and ( $first->flags & OPf_PARENS ) ) ) | ||||||||||||||||||||||||||||||||||||||||||
| 60 | { | ||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | return B::LISTOP->new( $type, 0, $first, $last ); | |||||||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | ▶ | if ( $first->flags() & OPf_KIDS ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | $first->last->sibling($last); | |||||||||||||||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||||||||||||||||
| 68 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | $first->flags( $first->flags | OPf_KIDS ); | |||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | $first->first($last); | |||||||||||||||||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | $first->last($last); | |||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | return $first; | |||||||||||||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||
| 76 | # coverage: scope.t | ||||||||||||||||||||||||||||||||||||||||||
| 77 | sub prepend_elem { | ||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | ▶ | my ( $class, $type, $first, $last ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prepend_elem: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | ▶ | if ( $last->type() != $type ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | return B::LISTOP->new( $type, 0, $first, $last ); | |||||||||||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | ▶ | if ( $type == OP_LIST ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | $first->sibling( $last->first->sibling ); | |||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | $last->first->sibling($first); | |||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | ▶ | $last->flags( $last->flags & ~OPf_PARENS ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 87 | unless ( $first->flags & OPf_PARENS ); | ||||||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||||||
| 89 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | ▶ | unless ( $last->flags & OPf_KIDS ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | $last->last($first); | |||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | $last->flags( $last->flags | OPf_KIDS ); | |||||||||||||||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | $first->sibling( $last->first ); | |||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | $last->first($first); | |||||||||||||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | $last->flags( $last->flags | OPf_KIDS ); | |||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | return $last; # I cannot believe this works. | |||||||||||||||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||
| 101 | # coverage: scope.t | ||||||||||||||||||||||||||||||||||||||||||
| 102 | sub scope { | ||||||||||||||||||||||||||||||||||||||||||
| 103 | 1 | ▶ | my $o = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
scope: called CC=7 SCAR=29.1
| |||||||||||||||||||||||||||||||||||||||||||
| 104 | 1 | ▶ | return unless $o and $$o; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$o and $$o
MC/DC0%0/2
$o and $$o
$o
$$o
Truth table33%1/3
A and B
A= $oB= $$o
| |||||||||||||||||||||||||||||||||||||||||||
| 105 | 1 | ▶ | if ( $o->flags & OPf_PARENS ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | $o = B::OP->prepend_elem( B::opnumber("lineseq"), | |||||||||||||||||||||||||||||||||||||||||
| 107 | B::OP->new( "enter", 0 ), $o ); | ||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | $o->type( B::opnumber("leave") ); | |||||||||||||||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||||||||||||||||
| 110 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 111 | 1 | ▶ | if ( $o->type == B::opnumber("lineseq") ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | my $kid; | |||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | $o->type( B::opnumber("scope") ); | |||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | $kid = $o->first; | |||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | ▶ | die "This probably shouldn't happen (\$kid->null)\n" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$kid->type == B::opnumber("nextstate") or $kid->type == B::opnumber("dbstate")
MC/DC0%0/2
$kid->type == B::opnumber("nextstate") or $kid->type == B::opnumber("dbstate")
$kid->type == B::opnumber("nextstate")
$kid->type == B::opnumber("dbstate")
Truth table0%0/3
A or B
A= $kid->type == B::opnumber("nextstate")B= $kid->type == B::opnumber("dbstate")
| |||||||||||||||||||||||||||||||||||||||||||
| 116 | if ( $kid->type == B::opnumber("nextstate") | ||||||||||||||||||||||||||||||||||||||||||
| 117 | or $kid->type == B::opnumber("dbstate") ); | ||||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||
| 119 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 120 | 1 | $o = B::LISTOP->new( "scope", 0, $o, undef ); | |||||||||||||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||||||||||||
| 123 | 1 | return ($o); | |||||||||||||||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||
| 126 | 7 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 127 | __END__ | ||||||||||||||||||||||||||||||||||||||||||