| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Perl::ToPerl6::Transformer::Subroutines::RemovePrototypes; |
|
2
|
|
|
|
|
|
|
|
|
3
|
17
|
|
|
17
|
|
11772
|
use 5.006001; |
|
|
17
|
|
|
|
|
51
|
|
|
4
|
17
|
|
|
17
|
|
76
|
use strict; |
|
|
17
|
|
|
|
|
26
|
|
|
|
17
|
|
|
|
|
359
|
|
|
5
|
17
|
|
|
17
|
|
65
|
use warnings; |
|
|
17
|
|
|
|
|
35
|
|
|
|
17
|
|
|
|
|
401
|
|
|
6
|
17
|
|
|
17
|
|
68
|
use Readonly; |
|
|
17
|
|
|
|
|
36
|
|
|
|
17
|
|
|
|
|
819
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
17
|
|
|
17
|
|
89
|
use Perl::ToPerl6::Utils qw{ :characters :severities }; |
|
|
17
|
|
|
|
|
24
|
|
|
|
17
|
|
|
|
|
876
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
17
|
|
|
17
|
|
4196
|
use base 'Perl::ToPerl6::Transformer'; |
|
|
17
|
|
|
|
|
822
|
|
|
|
17
|
|
|
|
|
5309
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
Readonly::Scalar my $DESC => q{Remove prototypes from subroutines}; |
|
17
|
|
|
|
|
|
|
Readonly::Scalar my $EXPL => q{Remove prototypes from subroutines}; |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my %map = ( |
|
22
|
|
|
|
|
|
|
sub => 1 |
|
23
|
|
|
|
|
|
|
); |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
|
26
|
|
|
|
|
|
|
|
|
27
|
40
|
|
|
40
|
0
|
1117
|
sub supported_parameters { return () } |
|
28
|
29
|
|
|
29
|
1
|
106
|
sub default_severity { return $SEVERITY_HIGHEST } |
|
29
|
25
|
|
|
25
|
1
|
80
|
sub default_themes { return qw(core bugs) } |
|
30
|
|
|
|
|
|
|
sub applies_to { |
|
31
|
|
|
|
|
|
|
return sub { |
|
32
|
|
|
|
|
|
|
$_[1]->isa('PPI::Token::Prototype') and |
|
33
|
|
|
|
|
|
|
$_[1]->sprevious_sibling and |
|
34
|
|
|
|
|
|
|
( exists $map{$_[1]->sprevious_sibling->content} or |
|
35
|
61
|
50
|
0
|
61
|
|
767
|
exists $map{$_[1]->sprevious_sibling->sprevious_sibling->content} ) |
|
|
|
|
33
|
|
|
|
|
|
36
|
|
|
|
|
|
|
} |
|
37
|
4
|
|
|
4
|
1
|
22
|
} |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub transform { |
|
42
|
0
|
|
|
0
|
0
|
|
my ($self, $elem, $doc) = @_; |
|
43
|
|
|
|
|
|
|
|
|
44
|
0
|
0
|
|
|
|
|
$elem->remove unless $elem->content =~ /[a-zA-Z0-9]/; |
|
45
|
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
return $self->transformation( $DESC, $EXPL, $elem ); |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
__END__ |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=pod |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 NAME |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Perl::ToPerl6::Transformer::Subroutines::RemovePrototypes - Remove ($)-style prototypes on subroutines. |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 AFFILIATION |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
This Transformer is part of the core L<Perl::ToPerl6|Perl::ToPerl6> |
|
65
|
|
|
|
|
|
|
distribution. |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Perl6 now has proper function signatures, subroutine prototype are deprecated: |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub foo($) { } --> sub foo { } |
|
73
|
|
|
|
|
|
|
sub foo($a) { } --> sub foo($a) { } |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Transforms subroutines outside of comments, heredocs, strings and POD. |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 CONFIGURATION |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
This Transformer is not configurable except for the standard options. |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 AUTHOR |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Jeffrey Goff <drforr@pobox.com> |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 COPYRIGHT |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Copyright (c) 2015 Jeffrey Goff |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify |
|
90
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=cut |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
############################################################################## |
|
95
|
|
|
|
|
|
|
# Local Variables: |
|
96
|
|
|
|
|
|
|
# mode: cperl |
|
97
|
|
|
|
|
|
|
# cperl-indent-level: 4 |
|
98
|
|
|
|
|
|
|
# fill-column: 78 |
|
99
|
|
|
|
|
|
|
# indent-tabs-mode: nil |
|
100
|
|
|
|
|
|
|
# c-indentation-style: bsd |
|
101
|
|
|
|
|
|
|
# End: |
|
102
|
|
|
|
|
|
|
# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround : |