line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Perl6::Gather; |
2
|
1
|
|
|
1
|
|
67334
|
use Perl6::Export; |
|
1
|
|
|
|
|
106633
|
|
|
1
|
|
|
|
|
7
|
|
3
|
1
|
0
|
50
|
1
|
|
15784
|
use Carp; |
|
1
|
50
|
0
|
1
|
|
3
|
|
|
1
|
|
0
|
1
|
|
419
|
|
|
1
|
|
0
|
1
|
|
32
|
|
|
1
|
|
|
1
|
|
12
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
126
|
|
|
1
|
|
|
|
|
13
|
|
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
5
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
184
|
|
|
1
|
|
|
|
|
4
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.42'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
my %gatherers; |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
7
|
sub gather(&) is export(:DEFAULT) { |
|
1
|
|
|
1
|
|
2
|
|
|
1
|
|
|
|
|
81
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
344
|
|
10
|
4
|
50
|
|
4
|
0
|
3122
|
croak "Useless use of 'gather' in void context" unless defined wantarray; |
11
|
4
|
|
|
|
|
8
|
my ($code) = @_; |
12
|
4
|
|
|
|
|
8
|
my $caller = caller; |
13
|
4
|
|
|
|
|
9
|
local @_; |
14
|
4
|
|
|
|
|
5
|
push @{$gatherers{$caller}}, bless \@_, 'Perl6::Gather::MagicArrayRef'; |
|
4
|
|
|
|
|
19
|
|
15
|
|
|
|
|
|
|
die $@ |
16
|
4
|
0
|
33
|
|
|
10
|
if !eval{ &$code } && $@ && !UNIVERSAL::isa($@, Perl6::Gather::Break); |
|
4
|
|
0
|
|
|
10
|
|
17
|
4
|
50
|
|
|
|
12
|
return @{pop @{$gatherers{$caller}}} if wantarray; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
37
|
|
18
|
0
|
0
|
|
|
|
0
|
return pop @{$gatherers{$caller}} if defined wantarray; |
|
0
|
|
|
|
|
0
|
|
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
1
|
|
7
|
sub gathered() is export(:DEFAULT) { |
|
1
|
|
|
1
|
|
1
|
|
|
1
|
|
|
|
|
66
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
90
|
|
22
|
4
|
|
|
4
|
0
|
22
|
my $caller = caller; |
23
|
4
|
100
|
|
|
|
6
|
croak "Call to gathered not inside a gather" unless @{$gatherers{$caller}}; |
|
4
|
|
|
|
|
154
|
|
24
|
3
|
|
|
|
|
13
|
return $gatherers{$caller}[-1]; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
1
|
|
|
1
|
|
6
|
sub take(@) is export(:DEFAULT) { |
|
1
|
|
|
1
|
|
2
|
|
|
1
|
|
|
|
|
70
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
136
|
|
28
|
33
|
50
|
|
33
|
0
|
876
|
@_ = $_ unless @_; |
29
|
33
|
|
|
|
|
127
|
my $caller = caller; |
30
|
33
|
100
|
100
|
|
|
510
|
croak "Call to take not inside a gather block" |
31
|
|
|
|
|
|
|
unless ((caller 3)[3]||"") eq 'Perl6::Gather::gather'; |
32
|
32
|
|
|
|
|
56
|
push @{$gatherers{$caller}[-1]}, @_; |
|
32
|
|
|
|
|
99
|
|
33
|
32
|
|
|
|
|
193
|
return 0+@_; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
my $breaker = bless [], 'Perl6::Gather::Break'; |
37
|
|
|
|
|
|
|
|
38
|
1
|
|
|
1
|
|
6
|
sub break() is export(:DEFAULT) { |
|
1
|
|
|
1
|
|
2
|
|
|
1
|
|
|
|
|
69
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
179
|
|
39
|
0
|
|
|
0
|
0
|
|
die $breaker; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
package Perl6::Gather::MagicArrayRef; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
use overload |
45
|
3
|
|
|
3
|
|
12
|
'bool' => sub { @{$_[0]} > 0 }, |
|
3
|
|
|
|
|
14
|
|
46
|
0
|
|
|
0
|
|
0
|
'0+' => sub { @{$_[0]} + 0 }, |
|
0
|
|
|
|
|
0
|
|
47
|
0
|
|
|
0
|
|
0
|
'""' => sub { join "", @{$_[0]} }, |
|
0
|
|
|
|
|
0
|
|
48
|
0
|
|
|
0
|
|
0
|
'~' => sub { join "", @{$_[0]} }, |
|
0
|
|
|
|
|
0
|
|
49
|
1
|
|
|
1
|
|
7
|
fallback => 1; |
|
1
|
|
|
|
|
14
|
|
|
1
|
|
|
|
|
32
|
|
50
|
|
|
|
|
|
|
; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |
53
|
|
|
|
|
|
|
__END__ |