line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package B::Tools; |
2
|
2
|
|
|
2
|
|
22583
|
use 5.008005; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
76
|
|
3
|
2
|
|
|
2
|
|
11
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
76
|
|
4
|
2
|
|
|
2
|
|
17
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
112
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = "0.01"; |
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
1923
|
use parent qw(Exporter); |
|
2
|
|
|
|
|
618
|
|
|
2
|
|
|
|
|
13
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our @EXPORT = qw(op_grep op_walk op_descendants); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub op_walk(&$) { |
13
|
3
|
|
|
3
|
1
|
6
|
my ($code, $op) = @_; |
14
|
|
|
|
|
|
|
local *B::OP::walkoptree_simple = sub { |
15
|
12
|
|
|
12
|
|
141
|
local $_ = $_[0]; |
16
|
12
|
|
|
|
|
21
|
$code->(); |
17
|
3
|
|
|
|
|
13
|
}; |
18
|
3
|
|
|
|
|
23
|
B::walkoptree($op, 'walkoptree_simple'); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub op_grep(&$) { |
22
|
1
|
|
|
1
|
1
|
26
|
my ($code, $op) = @_; |
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
|
|
2
|
my @ret; |
25
|
|
|
|
|
|
|
op_walk { |
26
|
4
|
100
|
|
4
|
|
7
|
if ($code->()) { |
27
|
1
|
|
|
|
|
14
|
push @ret, $_; |
28
|
|
|
|
|
|
|
} |
29
|
1
|
|
|
|
|
7
|
} $op; |
30
|
1
|
|
|
|
|
3
|
return @ret; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub op_descendants($) { |
34
|
1
|
|
|
1
|
1
|
485
|
my $op = shift; |
35
|
1
|
|
|
|
|
4
|
my @result; |
36
|
|
|
|
|
|
|
op_walk { |
37
|
4
|
|
|
4
|
|
25
|
push @result, $_; |
38
|
1
|
|
|
|
|
9
|
} $op; |
39
|
1
|
|
|
|
|
8
|
return @result; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1; |
43
|
|
|
|
|
|
|
__END__ |