| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Type::Coercion::Union; |
|
2
|
|
|
|
|
|
|
|
|
3
|
22
|
|
|
22
|
|
1351
|
use 5.008001; |
|
|
22
|
|
|
|
|
90
|
|
|
4
|
22
|
|
|
22
|
|
132
|
use strict; |
|
|
22
|
|
|
|
|
60
|
|
|
|
22
|
|
|
|
|
590
|
|
|
5
|
22
|
|
|
22
|
|
122
|
use warnings; |
|
|
22
|
|
|
|
|
41
|
|
|
|
22
|
|
|
|
|
1120
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
BEGIN { |
|
8
|
22
|
|
|
22
|
|
89
|
$Type::Coercion::Union::AUTHORITY = 'cpan:TOBYINK'; |
|
9
|
22
|
|
|
|
|
980
|
$Type::Coercion::Union::VERSION = '2.002001'; |
|
10
|
|
|
|
|
|
|
} |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
$Type::Coercion::Union::VERSION =~ tr/_//d; |
|
13
|
|
|
|
|
|
|
|
|
14
|
22
|
|
|
22
|
|
159
|
use Scalar::Util qw< blessed >; |
|
|
22
|
|
|
|
|
69
|
|
|
|
22
|
|
|
|
|
1178
|
|
|
15
|
22
|
|
|
22
|
|
162
|
use Types::TypeTiny (); |
|
|
22
|
|
|
|
|
56
|
|
|
|
22
|
|
|
|
|
11933
|
|
|
16
|
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
410
|
sub _croak ($;@) { require Error::TypeTiny; goto \&Error::TypeTiny::croak } |
|
|
1
|
|
|
|
|
7
|
|
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
require Type::Coercion; |
|
20
|
|
|
|
|
|
|
our @ISA = 'Type::Coercion'; |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub _preserve_type_constraint { |
|
23
|
65
|
|
|
65
|
|
126
|
my $self = shift; |
|
24
|
|
|
|
|
|
|
$self->{_union_of} = $self->{type_constraint}->type_constraints |
|
25
|
65
|
50
|
|
|
|
1073
|
if $self->{type_constraint}; |
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub _maybe_restore_type_constraint { |
|
29
|
1
|
|
|
1
|
|
2
|
my $self = shift; |
|
30
|
1
|
50
|
|
|
|
3
|
if ( my $union = $self->{_union_of} ) { |
|
31
|
1
|
|
|
|
|
5
|
return Type::Tiny::Union->new( type_constraints => $union ); |
|
32
|
|
|
|
|
|
|
} |
|
33
|
0
|
|
|
|
|
0
|
return; # uncoverable statement |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub type_coercion_map { |
|
37
|
17
|
|
|
17
|
1
|
22
|
my $self = shift; |
|
38
|
|
|
|
|
|
|
|
|
39
|
17
|
|
|
|
|
40
|
Types::TypeTiny::assert_TypeTiny( my $type = $self->type_constraint ); |
|
40
|
17
|
50
|
|
|
|
45
|
$type->isa( 'Type::Tiny::Union' ) |
|
41
|
|
|
|
|
|
|
or _croak |
|
42
|
|
|
|
|
|
|
"Type::Coercion::Union must be used in conjunction with Type::Tiny::Union"; |
|
43
|
|
|
|
|
|
|
|
|
44
|
17
|
|
|
|
|
23
|
my @c; |
|
45
|
17
|
|
|
|
|
43
|
for my $tc ( @$type ) { |
|
46
|
34
|
100
|
|
|
|
65
|
next unless $tc->has_coercion; |
|
47
|
32
|
|
|
|
|
48
|
push @c, @{ $tc->coercion->type_coercion_map }; |
|
|
32
|
|
|
|
|
56
|
|
|
48
|
|
|
|
|
|
|
} |
|
49
|
17
|
|
|
|
|
86
|
return \@c; |
|
50
|
|
|
|
|
|
|
} #/ sub type_coercion_map |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub add_type_coercions { |
|
53
|
1
|
|
|
1
|
1
|
12
|
my $self = shift; |
|
54
|
1
|
50
|
|
|
|
4
|
_croak "Adding coercions to Type::Coercion::Union not currently supported" |
|
55
|
|
|
|
|
|
|
if @_; |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub _build_moose_coercion { |
|
59
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
|
60
|
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
0
|
my %options = (); |
|
62
|
0
|
0
|
|
|
|
0
|
$options{type_constraint} = $self->type_constraint |
|
63
|
|
|
|
|
|
|
if $self->has_type_constraint; |
|
64
|
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
0
|
require Moose::Meta::TypeCoercion::Union; |
|
66
|
0
|
|
|
|
|
0
|
my $r = "Moose::Meta::TypeCoercion::Union"->new( %options ); |
|
67
|
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
0
|
return $r; |
|
69
|
|
|
|
|
|
|
} #/ sub _build_moose_coercion |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub can_be_inlined { |
|
72
|
3
|
|
|
3
|
1
|
4
|
my $self = shift; |
|
73
|
|
|
|
|
|
|
|
|
74
|
3
|
|
|
|
|
6
|
Types::TypeTiny::assert_TypeTiny( my $type = $self->type_constraint ); |
|
75
|
|
|
|
|
|
|
|
|
76
|
3
|
|
|
|
|
8
|
for my $tc ( @$type ) { |
|
77
|
6
|
50
|
|
|
|
12
|
next unless $tc->has_coercion; |
|
78
|
6
|
50
|
|
|
|
14
|
return !!0 unless $tc->coercion->can_be_inlined; |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
|
|
81
|
3
|
|
|
|
|
9
|
!!1; |
|
82
|
|
|
|
|
|
|
} #/ sub can_be_inlined |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
1; |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
__END__ |