line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Devel::Declare::Parser::Fennec; |
2
|
1
|
|
|
1
|
|
24471
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
37
|
|
3
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
27
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
6
|
use Devel::Declare::Interface; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
67
|
|
6
|
1
|
|
|
1
|
|
6
|
use base 'Exporter::Declare::Magic::Parser'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
1016
|
|
7
|
1
|
|
|
1
|
|
56599
|
BEGIN { Devel::Declare::Interface::register_parser('fennec') } |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.005'; |
10
|
|
|
|
|
|
|
our %NAMELESS; |
11
|
0
|
|
|
0
|
0
|
0
|
sub nameless { $NAMELESS{$_[-1]}++ } |
12
|
15
|
|
|
15
|
0
|
75
|
sub is_nameless { $NAMELESS{shift->name} } |
13
|
|
|
|
|
|
|
|
14
|
0
|
|
|
0
|
0
|
0
|
sub args { (qw/name/) } |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub inject { |
17
|
7
|
|
|
7
|
1
|
243
|
my $self = shift; |
18
|
7
|
50
|
|
|
|
10
|
return if $self->is_nameless; |
19
|
7
|
100
|
|
|
|
52
|
return if $self->has_fat_comma; |
20
|
6
|
|
|
|
|
76
|
return ('my $self = shift'); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub rewrite { |
24
|
8
|
|
|
8
|
1
|
24279
|
my $self = shift; |
25
|
|
|
|
|
|
|
|
26
|
8
|
50
|
|
|
|
20
|
return 1 if $self->is_nameless; |
27
|
|
|
|
|
|
|
|
28
|
8
|
|
|
|
|
73
|
$self->strip_prototype; |
29
|
8
|
|
|
|
|
80
|
$self->_check_parts; |
30
|
|
|
|
|
|
|
|
31
|
7
|
|
66
|
|
|
120
|
my $is_arrow = $self->parts->[1] |
32
|
|
|
|
|
|
|
&& ( $self->parts->[1] eq '=>' || $self->parts->[1] eq ',' ); |
33
|
7
|
100
|
66
|
|
|
102
|
if ( $is_arrow && $self->parts->[2] ) { |
34
|
1
|
|
|
|
|
11
|
my $is_ref = ref( $self->parts->[2] ); |
35
|
1
|
50
|
|
|
|
10
|
my $is_sub = $is_ref ? $self->parts->[2]->[0] eq 'sub' : 0; |
36
|
|
|
|
|
|
|
|
37
|
1
|
50
|
|
|
|
18
|
if ( !$is_ref ) { |
|
|
50
|
|
|
|
|
|
38
|
0
|
|
|
|
|
0
|
$self->new_parts( [$self->parts->[0], $self->parts->[2]] ); |
39
|
0
|
|
|
|
|
0
|
return 1; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
elsif ($is_sub) { |
42
|
1
|
|
|
|
|
4
|
$self->new_parts( [$self->parts->[0]] ); |
43
|
1
|
|
|
|
|
10
|
return 1; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
else { |
46
|
0
|
|
|
|
|
0
|
$self->bail('oops'); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
6
|
|
|
|
|
19
|
my ( $names, $specs ) = $self->sort_parts(); |
51
|
1
|
|
|
|
|
5
|
$self->new_parts( |
52
|
|
|
|
|
|
|
[ |
53
|
|
|
|
|
|
|
@$names, |
54
|
|
|
|
|
|
|
@$specs |
55
|
|
|
|
|
|
|
? ( |
56
|
6
|
100
|
|
|
|
202
|
( map { $_->[0] } @$specs ), |
57
|
|
|
|
|
|
|
['method'] |
58
|
|
|
|
|
|
|
) |
59
|
|
|
|
|
|
|
: () |
60
|
|
|
|
|
|
|
] |
61
|
|
|
|
|
|
|
); |
62
|
|
|
|
|
|
|
|
63
|
6
|
|
|
|
|
36
|
1; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
1; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
__END__ |