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