| 1 | package Zuzu::AST::Visitor::LexicalEnvHints; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 78 | ▶ | use utf8; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | 78 | our $VERSION = '0.007002'; | |||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | 78 | ▶ | use Scalar::Util qw( blessed refaddr ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | 78 | ▶ | use Moo; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | 753 | ▶ | has '_scope_stack' => ( is => 'rw', default => sub { [ {} ] } ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | 753 | ▶ | sub apply { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
apply: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | 753 | my ( $self, $ast ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | 753 | $self->_visit_node($ast); | |||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | 753 | return $ast; | |||||||||||||||||||||||||||||||||||||||||
| 19 | } | ||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | 17288 | ▶ | sub _current_scope { $_[0]->_scope_stack->[-1] } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_current_scope: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||
| 23 | 11224 | ▶ | sub _push_scope { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_push_scope: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 24 | 11224 | my ( $self, $initial ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | 11224 | ▶ | push @{ $self->_scope_stack }, { %{ $initial // {} } }; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$initial // {}
MC/DC100%1/1
$initial // {}
$initial
Truth table100%2/2
A
A= $initial
| |||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||
| 28 | 11224 | return; | |||||||||||||||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | 11224 | ▶ | sub _pop_scope { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_pop_scope: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 32 | 11224 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||
| 34 | 11224 | pop @{ $self->_scope_stack }; | |||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | 11224 | return; | |||||||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | 17288 | ▶ | sub _declare_name { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_declare_name: called CC=3 SCAR=12.0
| |||||||||||||||||||||||||||||||||||||||||||
| 40 | 17288 | my ( $self, $name ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||
| 42 | 17288 | ▶ | return if !defined $name or $name eq ''; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not defined $name or $name eq ""
MC/DC0%0/2
not defined $name or $name eq ""
not defined $name
$name eq ""
Truth table33%1/3
not(A) or B
A= not defined $nameB= $name eq ""
| |||||||||||||||||||||||||||||||||||||||||||
| 43 | 17288 | $self->_current_scope->{$name} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | 17288 | return; | |||||||||||||||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||
| 48 | 44177 | ▶ | sub _lookup_depth { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_lookup_depth: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||
| 49 | 44177 | my ( $self, $name ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||
| 51 | 44177 | ▶ | return undef if !defined $name; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 52 | 44177 | my $scopes = $self->_scope_stack; | |||||||||||||||||||||||||||||||||||||||||
| 53 | 44177 | ▶ | for ( my $i = $#$scopes; $i >= 0; $i-- ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 54 | 113650 | ▶ | return $#$scopes - $i if exists $scopes->[$i]{$name}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||
| 57 | 3272 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||
| 60 | 44177 | ▶ | sub _annotate_var { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_annotate_var: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 61 | 44177 | my ( $self, $node ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||
| 63 | 44177 | delete $node->{_env_depth}; | |||||||||||||||||||||||||||||||||||||||||
| 64 | 44177 | delete $node->{_binding_name}; | |||||||||||||||||||||||||||||||||||||||||
| 65 | 44177 | my $depth = $self->_lookup_depth( $node->name ); | |||||||||||||||||||||||||||||||||||||||||
| 66 | 44177 | ▶ | return if !defined $depth; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||
| 68 | 40905 | $node->{_env_depth} = $depth; | |||||||||||||||||||||||||||||||||||||||||
| 69 | 40905 | $node->{_binding_name} = $node->name; | |||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||
| 71 | 40905 | return; | |||||||||||||||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||
| 74 | 133478 | ▶ | sub _block_can_reuse_current_env { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_block_can_reuse_current_env: called CC=34 SCAR=35.8
| |||||||||||||||||||||||||||||||||||||||||||
| 75 | 133478 | my ( $self, $node, $seen ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||
| 77 | 133478 | ▶ | return 1 if !defined $node; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 78 | 132273 | ▶ | $seen //= {}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$seen //= {}
MC/DC100%1/1
$seen //= {}
$seen
Truth table100%2/2
A
A= $seen
| |||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||
| 80 | 132273 | ▶ | if ( blessed($node) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 81 | 41537 | my $addr = refaddr($node); | |||||||||||||||||||||||||||||||||||||||||
| 82 | 41537 | ▶ | return 1 if defined $addr and $seen->{$addr}++; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $addr and $seen->{$addr}++
MC/DC0%0/2
defined $addr and $seen->{$addr}++
defined $addr
$seen->{$addr}++
Truth table33%1/3
A and B
A= defined $addrB= $seen->{$addr}++
| |||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||
| 84 | 41537 | ▶ | return 0 if $node->isa('Zuzu::AST::Stmt::Let'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 85 | 39275 | ▶ | return 0 if $node->isa('Zuzu::AST::Stmt::LetUnpack'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 86 | 39274 | ▶ | return 0 if $node->isa('Zuzu::AST::Stmt::Function'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 87 | 39271 | ▶ | return 0 if $node->isa('Zuzu::AST::Stmt::Class'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 88 | 39271 | ▶ | return 0 if $node->isa('Zuzu::AST::Stmt::Trait'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 89 | 39271 | ▶ | return 0 if $node->isa('Zuzu::AST::Stmt::Import'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 90 | 39154 | ▶ | return 0 if $node->isa('Zuzu::AST::Stmt::Catch'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 91 | 39132 | ▶ | return 0 | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$node->isa("Zuzu::AST::Stmt::For") and $node->declare_loop_var
MC/DC50%1/2
$node->isa("Zuzu::AST::Stmt::For") and $node->declare_loop_var
$node->isa("Zuzu::AST::Stmt::For")
$node->declare_loop_var
Truth table66%2/3
A and B
A= $node->isa("Zuzu::AST::Stmt::For")B= $node->declare_loop_var
| |||||||||||||||||||||||||||||||||||||||||||
| 92 | if $node->isa('Zuzu::AST::Stmt::For') | ||||||||||||||||||||||||||||||||||||||||||
| 93 | and $node->declare_loop_var; | ||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||
| 95 | 38918 | ▶ | return 0 if $node->isa('Zuzu::AST::Expr::Call'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 96 | 37478 | ▶ | return 0 if $node->isa('Zuzu::AST::Expr::MemberCall'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 97 | 35236 | ▶ | return 0 if $node->isa('Zuzu::AST::Expr::DynamicMemberCall'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 98 | 35231 | ▶ | return 0 if $node->isa('Zuzu::AST::Expr::New'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 99 | 35076 | ▶ | return 0 if $node->isa('Zuzu::AST::Expr::Function'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 100 | 35069 | ▶ | return 0 if $node->isa('Zuzu::AST::Expr::Spawn'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 101 | 35068 | ▶ | return 0 if $node->isa('Zuzu::AST::Expr::Await'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | 35023 | for my $value ( values %{ $node } ) { | |||||||||||||||||||||||||||||||||||||||||
| 104 | 110253 | ▶ | return 0 if !$self->_block_can_reuse_current_env( $value, $seen ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||
| 107 | 22699 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||
| 110 | 90736 | ▶ | if ( ref($node) eq 'ARRAY' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 111 | 11213 | my $addr = refaddr($node); | |||||||||||||||||||||||||||||||||||||||||
| 112 | 11213 | ▶ | return 1 if defined $addr and $seen->{$addr}++; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $addr and $seen->{$addr}++
MC/DC0%0/2
defined $addr and $seen->{$addr}++
defined $addr
$seen->{$addr}++
Truth table33%1/3
A and B
A= defined $addrB= $seen->{$addr}++
| |||||||||||||||||||||||||||||||||||||||||||
| 113 | 11213 | for my $value ( @{ $node } ) { | |||||||||||||||||||||||||||||||||||||||||
| 114 | 13044 | ▶ | return 0 if !$self->_block_can_reuse_current_env( $value, $seen ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||||||||
| 116 | 4146 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||
| 119 | 79523 | ▶ | if ( ref($node) eq 'HASH' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 120 | 287 | my $addr = refaddr($node); | |||||||||||||||||||||||||||||||||||||||||
| 121 | 287 | ▶ | return 1 if defined $addr and $seen->{$addr}++; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $addr and $seen->{$addr}++
MC/DC0%0/2
defined $addr and $seen->{$addr}++
defined $addr
$seen->{$addr}++
Truth table33%1/3
A and B
A= defined $addrB= $seen->{$addr}++
| |||||||||||||||||||||||||||||||||||||||||||
| 122 | 287 | for my $value ( values %{ $node } ) { | |||||||||||||||||||||||||||||||||||||||||
| 123 | 850 | ▶ | return 0 if !$self->_block_can_reuse_current_env( $value, $seen ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||||||||||||||||
| 125 | 281 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||
| 128 | 79236 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||
| 131 | 9331 | ▶ | sub _visit_block { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_visit_block: called CC=8 SCAR=20.9
| |||||||||||||||||||||||||||||||||||||||||||
| 132 | 9331 | my ( $self, $node ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||
| 134 | 9331 | ▶ | return if !defined $node; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 135 | 9331 | ▶ | $node->reuse_current_env( $self->_block_can_reuse_current_env($node) ? 1 : 0 ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 136 | 9331 | ▶ | if ( $node->reuse_current_env ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 137 | 2817 | ▶ | for my $stmt ( @{ $node->statements // [] } ) { | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$node->statements // []
MC/DC0%0/1
$node->statements // []
$node->statements
Truth table50%1/2
A
A= $node->statements
| |||||||||||||||||||||||||||||||||||||||||||
| 138 | 3379 | $self->_visit_node($stmt); | |||||||||||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||||||||||
| 140 | 2817 | return; | |||||||||||||||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||
| 143 | 6514 | $self->_push_scope; | |||||||||||||||||||||||||||||||||||||||||
| 144 | 6514 | ▶ | for my $stmt ( @{ $node->statements // [] } ) { | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$node->statements // []
MC/DC0%0/1
$node->statements // []
$node->statements
Truth table50%1/2
A
A= $node->statements
| |||||||||||||||||||||||||||||||||||||||||||
| 145 | 18700 | $self->_visit_node($stmt); | |||||||||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||||||||
| 147 | 6514 | $self->_pop_scope; | |||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||
| 149 | 6514 | return; | |||||||||||||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||
| 152 | 3516 | ▶ | sub _declare_function_params { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_declare_function_params: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||
| 153 | 3516 | my ( $self, $node ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||
| 155 | 3516 | $self->_declare_name('__argc__'); | |||||||||||||||||||||||||||||||||||||||||
| 156 | 3516 | ▶ | for my $name ( @{ $node->params // [] } ) { | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$node->params // []
MC/DC0%0/1
$node->params // []
$node->params
Truth table50%1/2
A
A= $node->params
| |||||||||||||||||||||||||||||||||||||||||||
| 157 | 4997 | $self->_declare_name($name); | |||||||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||||||
| 159 | 3516 | ▶ | $self->_declare_name( $node->vararg ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 160 | if defined $node->vararg; | ||||||||||||||||||||||||||||||||||||||||||
| 161 | 3516 | ▶ | $self->_declare_name( $node->named_vararg ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 162 | if defined $node->named_vararg; | ||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||
| 164 | 3516 | return; | |||||||||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||
| 167 | 3557 | ▶ | sub _visit_function_like { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_visit_function_like: called CC=6 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 168 | 3557 | my ( $self, $node ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||
| 170 | 3557 | ▶ | return if $node->can('is_predeclared') and $node->is_predeclared; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$node->can("is_predeclared") and $node->is_predeclared
MC/DC100%2/2
$node->can("is_predeclared") and $node->is_predeclared
$node->can("is_predeclared")
$node->is_predeclared
Truth table100%3/3
A and B
A= $node->can("is_predeclared")B= $node->is_predeclared
| |||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||
| 172 | 3516 | my %initial; | |||||||||||||||||||||||||||||||||||||||||
| 173 | 3516 | ▶ | if ( $node->isa('Zuzu::AST::Stmt::Method') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 174 | 1588 | $initial{self} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 175 | 1588 | ▶ | $initial{super} = 1 | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not defined $node->uses_super or $node->uses_super
MC/DC100%2/2
not defined $node->uses_super or $node->uses_super
not defined $node->uses_super
$node->uses_super
Truth table100%3/3
not(A) or B
A= not defined $node->uses_superB= $node->uses_super
| |||||||||||||||||||||||||||||||||||||||||||
| 176 | if !defined $node->uses_super or $node->uses_super; | ||||||||||||||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||
| 179 | 3516 | $self->_push_scope( \%initial ); | |||||||||||||||||||||||||||||||||||||||||
| 180 | 3516 | $self->_declare_function_params($node); | |||||||||||||||||||||||||||||||||||||||||
| 181 | 3516 | $self->_visit_block( $node->body ); | |||||||||||||||||||||||||||||||||||||||||
| 182 | 3516 | $self->_pop_scope; | |||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||
| 184 | 3516 | return; | |||||||||||||||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||
| 187 | 134979 | ▶ | sub _visit_node { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_visit_node: called CC=102 SCAR=46.6
| |||||||||||||||||||||||||||||||||||||||||||
| 188 | 134979 | my ( $self, $node ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||
| 190 | 134979 | ▶ | return if !defined $node; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 191 | 134867 | ▶ | return if !blessed($node); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||
| 193 | 134867 | ▶ | if ( $node->isa('Zuzu::AST::Program') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 194 | 753 | ▶ | for my $stmt ( @{ $node->statements // [] } ) { | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$node->statements // []
MC/DC0%0/1
$node->statements // []
$node->statements
Truth table50%1/2
A
A= $node->statements
| |||||||||||||||||||||||||||||||||||||||||||
| 195 | 3910 | $self->_visit_node($stmt); | |||||||||||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||||||||||
| 197 | 753 | return; | |||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||
| 200 | 134114 | ▶ | if ( $node->isa('Zuzu::AST::Block') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 201 | 274 | $self->_visit_block($node); | |||||||||||||||||||||||||||||||||||||||||
| 202 | 274 | return; | |||||||||||||||||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||
| 205 | 133840 | ▶ | if ( $node->isa('Zuzu::AST::Expr::Var') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 206 | 44177 | $self->_annotate_var($node); | |||||||||||||||||||||||||||||||||||||||||
| 207 | 44177 | return; | |||||||||||||||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||
| 210 | 89663 | ▶ | if ( $node->isa('Zuzu::AST::Stmt::Let') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 211 | 5728 | ▶ | $self->_visit_node( $node->init ) if defined $node->init; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 212 | 5728 | $self->_declare_name( $node->name ); | |||||||||||||||||||||||||||||||||||||||||
| 213 | 5728 | return; | |||||||||||||||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||
| 216 | 83935 | ▶ | if ( $node->isa('Zuzu::AST::Stmt::LetUnpack') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 217 | 18 | ▶ | for my $binding ( @{ $node->bindings // [] } ) { | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$node->bindings // []
MC/DC0%0/1
$node->bindings // []
$node->bindings
Truth table50%1/2
A
A= $node->bindings
| |||||||||||||||||||||||||||||||||||||||||||
| 218 | 27 | $self->_visit_node( $binding->{key_expr} ); | |||||||||||||||||||||||||||||||||||||||||
| 219 | $self->_visit_node( $binding->{default_expr} ) | ||||||||||||||||||||||||||||||||||||||||||
| 220 | 27 | ▶ | if $binding->{has_default}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||||||||||||||||
| 222 | 18 | ▶ | $self->_visit_node( $node->init ) if defined $node->init; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 223 | 18 | ▶ | for my $binding ( @{ $node->bindings // [] } ) { | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$node->bindings // []
MC/DC0%0/1
$node->bindings // []
$node->bindings
Truth table50%1/2
A
A= $node->bindings
| |||||||||||||||||||||||||||||||||||||||||||
| 224 | 27 | $self->_declare_name( $binding->{name} ); | |||||||||||||||||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||||||||||||||||
| 226 | 18 | return; | |||||||||||||||||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||
| 229 | 83917 | ▶ | if ( $node->isa('Zuzu::AST::Stmt::Assign') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 230 | 2196 | $self->_visit_node( $node->target ); | |||||||||||||||||||||||||||||||||||||||||
| 231 | 2196 | ▶ | $self->_visit_node( $node->expr ) if defined $node->expr; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 232 | 2196 | ▶ | $self->_visit_node( $node->match_expr ) if defined $node->match_expr; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 233 | 2196 | ▶ | $self->_visit_node( $node->replace_expr ) if defined $node->replace_expr; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 234 | 2196 | return; | |||||||||||||||||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||
| 237 | 81721 | ▶ | if ( $node->isa('Zuzu::AST::Stmt::Expr') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 238 | 4072 | $self->_visit_node( $node->expr ); | |||||||||||||||||||||||||||||||||||||||||
| 239 | 4072 | return; | |||||||||||||||||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||
| 242 | 77649 | ▶ | if ( $node->isa('Zuzu::AST::Stmt::Return') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 243 | 5320 | ▶ | $self->_visit_node( $node->expr ) if $node->can('expr'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 244 | 5320 | return; | |||||||||||||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||
| 247 | 72329 | ▶ | if ( $node->isa('Zuzu::AST::Stmt::If') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 248 | 3860 | $self->_visit_node( $node->cond ); | |||||||||||||||||||||||||||||||||||||||||
| 249 | 3860 | $self->_visit_block( $node->then_block ); | |||||||||||||||||||||||||||||||||||||||||
| 250 | 3860 | ▶ | $self->_visit_node( $node->else_branch ) if defined $node->else_branch; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 251 | 3860 | return; | |||||||||||||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||
| 254 | 68469 | ▶ | if ( $node->isa('Zuzu::AST::Stmt::PostfixIf') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 255 | 1205 | $self->_visit_node( $node->cond ); | |||||||||||||||||||||||||||||||||||||||||
| 256 | 1205 | $self->_visit_node( $node->statement ); | |||||||||||||||||||||||||||||||||||||||||
| 257 | 1205 | return; | |||||||||||||||||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||
| 260 | 67264 | ▶ | if ( $node->isa('Zuzu::AST::Stmt::While') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 261 | 496 | $self->_visit_node( $node->cond ); | |||||||||||||||||||||||||||||||||||||||||
| 262 | 496 | $self->_visit_block( $node->body ); | |||||||||||||||||||||||||||||||||||||||||
| 263 | 496 | return; | |||||||||||||||||||||||||||||||||||||||||
| 264 | } | ||||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||
| 266 | 66768 | ▶ | if ( $node->isa('Zuzu::AST::Stmt::For') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 267 | 740 | $self->_visit_node( $node->collection ); | |||||||||||||||||||||||||||||||||||||||||
| 268 | 740 | ▶ | if ( $node->declare_loop_var ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 269 | 738 | $self->_push_scope( { $node->var => 1 } ); | |||||||||||||||||||||||||||||||||||||||||
| 270 | 738 | $self->_visit_block( $node->body ); | |||||||||||||||||||||||||||||||||||||||||
| 271 | 738 | $self->_pop_scope; | |||||||||||||||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||||||||||||||||
| 273 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 274 | 2 | $self->_visit_block( $node->body ); | |||||||||||||||||||||||||||||||||||||||||
| 275 | } | ||||||||||||||||||||||||||||||||||||||||||
| 276 | 740 | ▶ | $self->_visit_block( $node->else_block ) if defined $node->else_block; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 277 | 740 | return; | |||||||||||||||||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||
| 280 | 66028 | ▶ | if ( $node->isa('Zuzu::AST::Stmt::Function') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 281 | 1502 | $self->_declare_name( $node->name ); | |||||||||||||||||||||||||||||||||||||||||
| 282 | 1502 | $self->_visit_function_like($node); | |||||||||||||||||||||||||||||||||||||||||
| 283 | 1502 | return; | |||||||||||||||||||||||||||||||||||||||||
| 284 | } | ||||||||||||||||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||||||||||||||||
| 286 | 64526 | ▶ | if ( $node->isa('Zuzu::AST::Expr::Function') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 287 | 458 | $self->_visit_function_like($node); | |||||||||||||||||||||||||||||||||||||||||
| 288 | 458 | return; | |||||||||||||||||||||||||||||||||||||||||
| 289 | } | ||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||
| 291 | 64068 | ▶ | if ( $node->isa('Zuzu::AST::Stmt::Method') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 292 | 1597 | $self->_visit_function_like($node); | |||||||||||||||||||||||||||||||||||||||||
| 293 | 1597 | return; | |||||||||||||||||||||||||||||||||||||||||
| 294 | } | ||||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||
| 296 | 62471 | ▶ | if ( $node->isa('Zuzu::AST::Stmt::Class') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 297 | 302 | ▶ | $self->_visit_node( $node->parent ) if defined $node->parent; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 298 | 302 | ▶ | for my $trait_ref ( @{ $node->traits // [] } ) { | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$node->traits // []
MC/DC0%0/1
$node->traits // []
$node->traits
Truth table50%1/2
A
A= $node->traits
| |||||||||||||||||||||||||||||||||||||||||||
| 299 | 20 | $self->_visit_node($trait_ref); | |||||||||||||||||||||||||||||||||||||||||
| 300 | } | ||||||||||||||||||||||||||||||||||||||||||
| 301 | 302 | ▶ | for my $field ( @{ $node->fields // [] } ) { | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$node->fields // []
MC/DC0%0/1
$node->fields // []
$node->fields
Truth table50%1/2
A
A= $node->fields
| |||||||||||||||||||||||||||||||||||||||||||
| 302 | 468 | ▶ | $self->_visit_node( $field->{init} ) if defined $field->{init}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 303 | } | ||||||||||||||||||||||||||||||||||||||||||
| 304 | 302 | $self->_declare_name( $node->name ); | |||||||||||||||||||||||||||||||||||||||||
| 305 | 302 | $self->_push_scope( { self => 1 } ); | |||||||||||||||||||||||||||||||||||||||||
| 306 | 302 | ▶ | for my $klass ( @{ $node->classes // [] } ) { | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$node->classes // []
MC/DC0%0/1
$node->classes // []
$node->classes
Truth table50%1/2
A
A= $node->classes
| |||||||||||||||||||||||||||||||||||||||||||
| 307 | 0 | $self->_visit_node($klass); | |||||||||||||||||||||||||||||||||||||||||
| 308 | } | ||||||||||||||||||||||||||||||||||||||||||
| 309 | 302 | ▶ | for my $method ( @{ $node->methods // [] } ) { | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$node->methods // []
MC/DC0%0/1
$node->methods // []
$node->methods
Truth table50%1/2
A
A= $node->methods
| |||||||||||||||||||||||||||||||||||||||||||
| 310 | 1492 | $self->_visit_node($method); | |||||||||||||||||||||||||||||||||||||||||
| 311 | } | ||||||||||||||||||||||||||||||||||||||||||
| 312 | 302 | ▶ | for my $method ( @{ $node->static_methods // [] } ) { | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$node->static_methods // []
MC/DC0%0/1
$node->static_methods // []
$node->static_methods
Truth table50%1/2
A
A= $node->static_methods
| |||||||||||||||||||||||||||||||||||||||||||
| 313 | 73 | $self->_visit_node($method); | |||||||||||||||||||||||||||||||||||||||||
| 314 | } | ||||||||||||||||||||||||||||||||||||||||||
| 315 | 302 | $self->_pop_scope; | |||||||||||||||||||||||||||||||||||||||||
| 316 | 302 | return; | |||||||||||||||||||||||||||||||||||||||||
| 317 | } | ||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||
| 319 | 62169 | ▶ | if ( $node->isa('Zuzu::AST::Stmt::Trait') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 320 | 14 | $self->_declare_name( $node->name ); | |||||||||||||||||||||||||||||||||||||||||
| 321 | 14 | ▶ | for my $method ( @{ $node->methods // [] } ) { | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$node->methods // []
MC/DC0%0/1
$node->methods // []
$node->methods
Truth table50%1/2
A
A= $node->methods
| |||||||||||||||||||||||||||||||||||||||||||
| 322 | 32 | $self->_visit_node($method); | |||||||||||||||||||||||||||||||||||||||||
| 323 | } | ||||||||||||||||||||||||||||||||||||||||||
| 324 | 14 | return; | |||||||||||||||||||||||||||||||||||||||||
| 325 | } | ||||||||||||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||||||||||||
| 327 | 62155 | ▶ | if ( $node->isa('Zuzu::AST::Stmt::Try') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 328 | 152 | $self->_visit_block( $node->block ); | |||||||||||||||||||||||||||||||||||||||||
| 329 | 152 | ▶ | for my $catch ( @{ $node->catches // [] } ) { | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$node->catches // []
MC/DC0%0/1
$node->catches // []
$node->catches
Truth table50%1/2
A
A= $node->catches
| |||||||||||||||||||||||||||||||||||||||||||
| 330 | 154 | $self->_visit_node($catch); | |||||||||||||||||||||||||||||||||||||||||
| 331 | } | ||||||||||||||||||||||||||||||||||||||||||
| 332 | 152 | return; | |||||||||||||||||||||||||||||||||||||||||
| 333 | } | ||||||||||||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||||||||||||
| 335 | 62003 | ▶ | if ( $node->isa('Zuzu::AST::Stmt::Catch') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 336 | 154 | $self->_visit_node( $node->type_expr ); | |||||||||||||||||||||||||||||||||||||||||
| 337 | 154 | $self->_push_scope( { $node->name => 1 } ); | |||||||||||||||||||||||||||||||||||||||||
| 338 | 154 | $self->_visit_block( $node->block ); | |||||||||||||||||||||||||||||||||||||||||
| 339 | 154 | $self->_pop_scope; | |||||||||||||||||||||||||||||||||||||||||
| 340 | 154 | return; | |||||||||||||||||||||||||||||||||||||||||
| 341 | } | ||||||||||||||||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||||||||||||||||
| 343 | 61849 | ▶ | if ( $node->isa('Zuzu::AST::Stmt::Import') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 344 | 693 | ▶ | $self->_visit_node( $node->condition_expr ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 345 | if defined $node->condition_expr; | ||||||||||||||||||||||||||||||||||||||||||
| 346 | 693 | ▶ | for my $item ( @{ $node->items // [] } ) { | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$node->items // []
MC/DC0%0/1
$node->items // []
$node->items
Truth table50%1/2
A
A= $node->items
| |||||||||||||||||||||||||||||||||||||||||||
| 347 | 1217 | ▶ | next if $item->{star}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 348 | 1025 | $self->_declare_name( $item->{alias} ); | |||||||||||||||||||||||||||||||||||||||||
| 349 | } | ||||||||||||||||||||||||||||||||||||||||||
| 350 | 693 | return; | |||||||||||||||||||||||||||||||||||||||||
| 351 | } | ||||||||||||||||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||||||||||||||||
| 353 | 61156 | ▶ | if ( $node->isa('Zuzu::AST::Expr::Call') or $node->isa('Zuzu::AST::Expr::MemberCall') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$node->isa("Zuzu::AST::Expr::Call") or $node->isa("Zuzu::AST::Expr::MemberCall")
MC/DC100%2/2
$node->isa("Zuzu::AST::Expr::Call") or $node->isa("Zuzu::AST::Expr::MemberCall")
$node->isa("Zuzu::AST::Expr::Call")
$node->isa("Zuzu::AST::Expr::MemberCall")
Truth table100%3/3
A or B
A= $node->isa("Zuzu::AST::Expr::Call")B= $node->isa("Zuzu::AST::Expr::MemberCall")
| |||||||||||||||||||||||||||||||||||||||||||
| 354 | 14762 | ▶ | $self->_visit_node( $node->callee ) if $node->can('callee'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 355 | 14762 | ▶ | $self->_visit_node( $node->object ) if $node->can('object'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 356 | 14762 | ▶ | for my $arg ( @{ $node->args // [] } ) { | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$node->args // []
MC/DC0%0/1
$node->args // []
$node->args
Truth table50%1/2
A
A= $node->args
| |||||||||||||||||||||||||||||||||||||||||||
| 357 | 21113 | ▶ | $self->_visit_node( $arg->[0] ) if ref($arg) eq 'ARRAY' and $arg->[2]; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
ref $arg eq "ARRAY" and $arg->[2]
MC/DC100%2/2
ref $arg eq "ARRAY" and $arg->[2]
ref $arg eq "ARRAY"
$arg->[2]
Truth table100%3/3
A and B
A= ref $arg eq "ARRAY"B= $arg->[2]
| |||||||||||||||||||||||||||||||||||||||||||
| 358 | 21113 | ▶ | $self->_visit_node( ref($arg) eq 'ARRAY' ? $arg->[1] : $arg ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 359 | } | ||||||||||||||||||||||||||||||||||||||||||
| 360 | 14762 | return; | |||||||||||||||||||||||||||||||||||||||||
| 361 | } | ||||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||
| 363 | 46394 | ▶ | if ( $node->isa('Zuzu::AST::Expr::DynamicMemberCall') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 364 | 11 | $self->_visit_node( $node->object ); | |||||||||||||||||||||||||||||||||||||||||
| 365 | 11 | $self->_visit_node( $node->method_expr ); | |||||||||||||||||||||||||||||||||||||||||
| 366 | 11 | ▶ | for my $arg ( @{ $node->args // [] } ) { | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$node->args // []
MC/DC0%0/1
$node->args // []
$node->args
Truth table50%1/2
A
A= $node->args
| |||||||||||||||||||||||||||||||||||||||||||
| 367 | 7 | ▶ | $self->_visit_node( $arg->[0] ) if ref($arg) eq 'ARRAY' and $arg->[2]; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $arg eq "ARRAY" and $arg->[2]
MC/DC0%0/2
ref $arg eq "ARRAY" and $arg->[2]
ref $arg eq "ARRAY"
$arg->[2]
Truth table33%1/3
A and B
A= ref $arg eq "ARRAY"B= $arg->[2]
| |||||||||||||||||||||||||||||||||||||||||||
| 368 | 7 | ▶ | $self->_visit_node( ref($arg) eq 'ARRAY' ? $arg->[1] : $arg ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 369 | } | ||||||||||||||||||||||||||||||||||||||||||
| 370 | 11 | return; | |||||||||||||||||||||||||||||||||||||||||
| 371 | } | ||||||||||||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||||||||||||
| 373 | 46383 | ▶ | if ( $node->isa('Zuzu::AST::Expr::Spread') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 374 | 19 | $self->_visit_node( $node->expr ); | |||||||||||||||||||||||||||||||||||||||||
| 375 | 19 | return; | |||||||||||||||||||||||||||||||||||||||||
| 376 | } | ||||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||
| 378 | 46364 | ▶ | if ( $node->isa('Zuzu::AST::Expr::Binary') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 379 | 11111 | $self->_visit_node( $node->left ); | |||||||||||||||||||||||||||||||||||||||||
| 380 | 11111 | $self->_visit_node( $node->right ); | |||||||||||||||||||||||||||||||||||||||||
| 381 | 11111 | return; | |||||||||||||||||||||||||||||||||||||||||
| 382 | } | ||||||||||||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||||||||||||
| 384 | 35253 | ▶ | if ( $node->isa('Zuzu::AST::Expr::Unary') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 385 | 1798 | $self->_visit_node( $node->expr ); | |||||||||||||||||||||||||||||||||||||||||
| 386 | 1798 | return; | |||||||||||||||||||||||||||||||||||||||||
| 387 | } | ||||||||||||||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||||||||||||||
| 389 | 33455 | ▶ | if ( $node->isa('Zuzu::AST::Expr::Await') or $node->isa('Zuzu::AST::Expr::Spawn') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$node->isa("Zuzu::AST::Expr::Await") or $node->isa("Zuzu::AST::Expr::Spawn")
MC/DC100%2/2
$node->isa("Zuzu::AST::Expr::Await") or $node->isa("Zuzu::AST::Expr::Spawn")
$node->isa("Zuzu::AST::Expr::Await")
$node->isa("Zuzu::AST::Expr::Spawn")
Truth table100%3/3
A or B
A= $node->isa("Zuzu::AST::Expr::Await")B= $node->isa("Zuzu::AST::Expr::Spawn")
| |||||||||||||||||||||||||||||||||||||||||||
| 390 | 124 | $self->_visit_block( $node->block ); | |||||||||||||||||||||||||||||||||||||||||
| 391 | 124 | return; | |||||||||||||||||||||||||||||||||||||||||
| 392 | } | ||||||||||||||||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||||||||||||||||
| 394 | 33331 | ▶ | if ( $node->isa('Zuzu::AST::Expr::Ternary') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 395 | 596 | $self->_visit_node( $node->cond ); | |||||||||||||||||||||||||||||||||||||||||
| 396 | 596 | ▶ | $self->_visit_node( $node->if_true ) if defined $node->if_true; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 397 | 596 | $self->_visit_node( $node->if_false ); | |||||||||||||||||||||||||||||||||||||||||
| 398 | 596 | return; | |||||||||||||||||||||||||||||||||||||||||
| 399 | } | ||||||||||||||||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||||||||||||||||
| 401 | 32735 | ▶ | if ( $node->isa('Zuzu::AST::Expr::Index') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 402 | 1105 | $self->_visit_node( $node->array ); | |||||||||||||||||||||||||||||||||||||||||
| 403 | 1105 | $self->_visit_node( $node->index ); | |||||||||||||||||||||||||||||||||||||||||
| 404 | 1105 | return; | |||||||||||||||||||||||||||||||||||||||||
| 405 | } | ||||||||||||||||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||||||||||||||||
| 407 | 31630 | ▶ | if ( $node->isa('Zuzu::AST::Expr::DictGet') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 408 | 2433 | $self->_visit_node( $node->dict ); | |||||||||||||||||||||||||||||||||||||||||
| 409 | 2433 | $self->_visit_node( $node->key ); | |||||||||||||||||||||||||||||||||||||||||
| 410 | 2433 | return; | |||||||||||||||||||||||||||||||||||||||||
| 411 | } | ||||||||||||||||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||||||||||||||||
| 413 | 29197 | ▶ | if ( $node->isa('Zuzu::AST::Expr::Slice') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 414 | 23 | $self->_visit_node( $node->collection ); | |||||||||||||||||||||||||||||||||||||||||
| 415 | 23 | ▶ | $self->_visit_node( $node->start ) if defined $node->start; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 416 | 23 | ▶ | $self->_visit_node( $node->length ) if defined $node->length; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 417 | 23 | return; | |||||||||||||||||||||||||||||||||||||||||
| 418 | } | ||||||||||||||||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||||||||||||||||
| 420 | 29174 | ▶ | if ( $node->isa('Zuzu::AST::Expr::IncDec') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 421 | 690 | $self->_visit_node( $node->target ); | |||||||||||||||||||||||||||||||||||||||||
| 422 | 690 | return; | |||||||||||||||||||||||||||||||||||||||||
| 423 | } | ||||||||||||||||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||||||||||||||||
| 425 | 28484 | ▶ | if ( $node->isa('Zuzu::AST::Expr::Array') or $node->isa('Zuzu::AST::Expr::Set') or $node->isa('Zuzu::AST::Expr::Bag') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$node->isa("Zuzu::AST::Expr::Array") or $node->isa("Zuzu::AST::Expr::Set") or $node->isa("Zuzu::AST::Expr::Bag")
$node->isa("Zuzu::AST::Expr::Array") or $node->isa("Zuzu::AST::Expr::Set")
MC/DC100%3/3
$node->isa("Zuzu::AST::Expr::Array") or $node->isa("Zuzu::AST::Expr::Set") or $node->isa("Zuzu::AST::Expr::Bag")
$node->isa("Zuzu::AST::Expr::Array")
$node->isa("Zuzu::AST::Expr::Set")
$node->isa("Zuzu::AST::Expr::Bag")
Truth table100%4/4
A or B or C
A= $node->isa("Zuzu::AST::Expr::Array")B= $node->isa("Zuzu::AST::Expr::Set")C= $node->isa("Zuzu::AST::Expr::Bag")
| |||||||||||||||||||||||||||||||||||||||||||
| 426 | 1228 | ▶ | for my $item ( @{ $node->items // [] } ) { | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$node->items // []
MC/DC0%0/1
$node->items // []
$node->items
Truth table50%1/2
A
A= $node->items
| |||||||||||||||||||||||||||||||||||||||||||
| 427 | 1723 | $self->_visit_node($item); | |||||||||||||||||||||||||||||||||||||||||
| 428 | } | ||||||||||||||||||||||||||||||||||||||||||
| 429 | 1228 | return; | |||||||||||||||||||||||||||||||||||||||||
| 430 | } | ||||||||||||||||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||||||||||||||||
| 432 | 27256 | ▶ | if ( $node->isa('Zuzu::AST::Expr::Range') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 433 | 10 | $self->_visit_node( $node->start ); | |||||||||||||||||||||||||||||||||||||||||
| 434 | 10 | $self->_visit_node( $node->end ); | |||||||||||||||||||||||||||||||||||||||||
| 435 | 10 | return; | |||||||||||||||||||||||||||||||||||||||||
| 436 | } | ||||||||||||||||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||||||||||||||||
| 438 | 27246 | ▶ | if ( $node->isa('Zuzu::AST::Expr::Dict') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 439 | 801 | ▶ | for my $pair ( @{ $node->pairs // [] } ) { | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$node->pairs // []
MC/DC0%0/1
$node->pairs // []
$node->pairs
Truth table50%1/2
A
A= $node->pairs
| |||||||||||||||||||||||||||||||||||||||||||
| 440 | 2231 | ▶ | next if ref($pair) ne 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 441 | 2231 | $self->_visit_node( $pair->[0] ); | |||||||||||||||||||||||||||||||||||||||||
| 442 | 2231 | $self->_visit_node( $pair->[1] ); | |||||||||||||||||||||||||||||||||||||||||
| 443 | } | ||||||||||||||||||||||||||||||||||||||||||
| 444 | 801 | return; | |||||||||||||||||||||||||||||||||||||||||
| 445 | } | ||||||||||||||||||||||||||||||||||||||||||
| 446 | |||||||||||||||||||||||||||||||||||||||||||
| 447 | 26445 | ▶ | if ( $node->isa('Zuzu::AST::Expr::New') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 448 | 755 | $self->_visit_node( $node->class_expr ); | |||||||||||||||||||||||||||||||||||||||||
| 449 | 755 | ▶ | for my $trait_ref ( @{ $node->traits // [] } ) { | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$node->traits // []
MC/DC0%0/1
$node->traits // []
$node->traits
Truth table50%1/2
A
A= $node->traits
| |||||||||||||||||||||||||||||||||||||||||||
| 450 | 3 | $self->_visit_node( $trait_ref ); | |||||||||||||||||||||||||||||||||||||||||
| 451 | } | ||||||||||||||||||||||||||||||||||||||||||
| 452 | 755 | ▶ | for my $pair ( @{ $node->args // [] } ) { | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$node->args // []
MC/DC0%0/1
$node->args // []
$node->args
Truth table50%1/2
A
A= $node->args
| |||||||||||||||||||||||||||||||||||||||||||
| 453 | 1676 | $self->_visit_node( $pair->[1] ); | |||||||||||||||||||||||||||||||||||||||||
| 454 | } | ||||||||||||||||||||||||||||||||||||||||||
| 455 | 755 | return; | |||||||||||||||||||||||||||||||||||||||||
| 456 | } | ||||||||||||||||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||||||||||||||||
| 458 | 25690 | return; | |||||||||||||||||||||||||||||||||||||||||
| 459 | } | ||||||||||||||||||||||||||||||||||||||||||
| 460 | |||||||||||||||||||||||||||||||||||||||||||
| 461 | 78 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||||||||||||||||
| 463 | =pod | ||||||||||||||||||||||||||||||||||||||||||
| 464 | |||||||||||||||||||||||||||||||||||||||||||
| 465 | =head1 COPYRIGHT AND LICENCE | ||||||||||||||||||||||||||||||||||||||||||
| 466 | |||||||||||||||||||||||||||||||||||||||||||
| 467 | B<< Zuzu::AST::Visitor::LexicalEnvHints >> is copyright Toby Inkster. | ||||||||||||||||||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||||||||||||||||
| 469 | It is free software; you may redistribute it and/or modify it under | ||||||||||||||||||||||||||||||||||||||||||
| 470 | the terms of either the Artistic License 1.0 or the GNU General Public | ||||||||||||||||||||||||||||||||||||||||||
| 471 | License version 2. | ||||||||||||||||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||||||||||||||||
| 473 | =cut | ||||||||||||||||||||||||||||||||||||||||||