line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package JSON::TypeInference::Type::Union; |
2
|
3
|
|
|
3
|
|
1703
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
80
|
|
3
|
3
|
|
|
3
|
|
14
|
use warnings; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
622
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
sub new { |
6
|
3
|
|
|
3
|
0
|
40
|
my ($class, @types) = @_; |
7
|
3
|
|
|
|
|
22
|
return bless { _types => \@types }, $class; |
8
|
|
|
|
|
|
|
} |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub name { |
11
|
0
|
|
|
0
|
0
|
0
|
my ($class) = @_; |
12
|
0
|
|
|
|
|
0
|
return 'union'; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub types { |
16
|
3
|
|
|
3
|
0
|
894
|
my ($self) = @_; |
17
|
3
|
|
|
|
|
15
|
return $self->{_types}; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub accepts { |
21
|
7
|
|
|
7
|
0
|
1576
|
my ($class, $data) = @_; |
22
|
7
|
|
|
|
|
25
|
return 0; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub signature { |
26
|
1
|
|
|
1
|
0
|
5
|
my ($self) = @_; |
27
|
1
|
|
|
|
|
2
|
my @signatures = map { $_->signature } @{$self->types}; |
|
2
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
3
|
|
28
|
1
|
|
|
|
|
7
|
return join '|', sort @signatures; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
1; |
32
|
|
|
|
|
|
|
__END__ |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=encoding utf-8 |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 NAME |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
JSON::TypeInference::Type::Union - union type |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 DESCRIPTION |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
C< JSON::TypeInference::Type::Union > consists of one or more value types. |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
C< JSON::TypeInference::Type::Union > represents a possibility of actual types from inference. |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
It is a container type, and has some type parameters. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 AUTHOR |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
aereal E<lt>aereal@aereal.orgE<gt> |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=cut |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|