line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::MigrateToTest2V0::Rule::Translate2ndArgumentOfIsaOkWithArrayRef; |
2
|
4
|
|
|
4
|
|
1024
|
use strict; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
136
|
|
3
|
4
|
|
|
4
|
|
23
|
use warnings; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
128
|
|
4
|
4
|
|
|
4
|
|
23
|
use parent 'App::MigrateToTest2V0::Rule'; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
28
|
|
5
|
4
|
|
|
4
|
|
1573
|
use PPIx::Utils qw(parse_arg_list); |
|
4
|
|
|
|
|
12
|
|
|
4
|
|
|
|
|
1050
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub apply { |
8
|
14
|
|
|
14
|
0
|
41
|
my ($class, $doc) = @_; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
my $stmts = $doc->find(sub { |
11
|
339
|
|
|
339
|
|
4577
|
my (undef, $elem) = @_; |
12
|
339
|
|
100
|
|
|
1278
|
return $elem->isa('PPI::Statement') && $elem->first_token && $elem->first_token->content eq 'isa_ok'; |
13
|
14
|
|
|
|
|
89
|
}); |
14
|
14
|
100
|
|
|
|
234
|
return unless $stmts; |
15
|
|
|
|
|
|
|
|
16
|
2
|
|
|
|
|
7
|
for my $stmt (@$stmts) { |
17
|
2
|
|
|
|
|
6
|
my $second_arg = (parse_arg_list($stmt->first_token))[1]->[0]; |
18
|
2
|
50
|
|
|
|
419
|
next unless $second_arg; |
19
|
|
|
|
|
|
|
|
20
|
2
|
|
|
|
|
7
|
my $first_paren = PPI::Token::Structure->new('['); |
21
|
2
|
|
|
|
|
14
|
my $last_paren = PPI::Token::Structure->new(']'); |
22
|
2
|
|
|
|
|
17
|
$second_arg->insert_before($first_paren); |
23
|
2
|
|
|
|
|
115
|
$second_arg->insert_after($last_paren); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
1; |