| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
8
|
|
|
8
|
|
174
|
use 5.010001; |
|
|
8
|
|
|
|
|
33
|
|
|
2
|
8
|
|
|
8
|
|
83
|
use strict; |
|
|
8
|
|
|
|
|
18
|
|
|
|
8
|
|
|
|
|
191
|
|
|
3
|
8
|
|
|
8
|
|
62
|
use warnings; |
|
|
8
|
|
|
|
|
27
|
|
|
|
8
|
|
|
|
|
397
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Mite::Signature::Compiler; |
|
6
|
|
|
|
|
|
|
|
|
7
|
8
|
|
|
8
|
|
4505
|
use Type::Params::Signature 1.016008 (); |
|
|
8
|
|
|
|
|
384920
|
|
|
|
8
|
|
|
|
|
298
|
|
|
8
|
8
|
|
|
8
|
|
81
|
use Types::Standard qw( Slurpy ); |
|
|
8
|
|
|
|
|
25
|
|
|
|
8
|
|
|
|
|
45
|
|
|
9
|
8
|
|
|
8
|
|
11971
|
use Scalar::Util (); |
|
|
8
|
|
|
|
|
29
|
|
|
|
8
|
|
|
|
|
3807
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our @ISA = 'Type::Params::Signature'; |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub BUILD { |
|
14
|
10
|
|
|
10
|
0
|
3711
|
my $self = shift; |
|
15
|
|
|
|
|
|
|
|
|
16
|
10
|
|
|
|
|
75
|
Scalar::Util::weaken( $self->{mite_signature} ); |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# This is not a Mite class, so manually call |
|
19
|
|
|
|
|
|
|
# parent BUILD: |
|
20
|
10
|
|
|
|
|
56
|
$self->SUPER::BUILD( @_ ); |
|
21
|
|
|
|
|
|
|
} |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub _make_general_fail { |
|
24
|
19
|
|
|
19
|
|
3316
|
my ( $self, %args ) = @_; |
|
25
|
|
|
|
|
|
|
|
|
26
|
19
|
|
|
|
|
111
|
my $croaker = $self->{mite_signature}->class->_function_for_croak; |
|
27
|
|
|
|
|
|
|
|
|
28
|
19
|
|
|
|
|
96
|
return sprintf '%s( "Failure in signature for %s: " . %s )', $croaker, $self->subname, $args{message}; |
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub _make_constraint_fail { |
|
32
|
28
|
|
|
28
|
|
9442
|
my ( $self, %args ) = @_; |
|
33
|
|
|
|
|
|
|
|
|
34
|
28
|
|
|
|
|
64
|
my $type = $args{constraint}; |
|
35
|
28
|
50
|
33
|
|
|
80
|
if ( $type->parent and $type->parent->{uniq} == Slurpy->{uniq} ) { |
|
36
|
0
|
|
0
|
|
|
0
|
$type = $type->type_parameter || $type; |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
|
|
39
|
28
|
|
|
|
|
765
|
my $croaker = $self->{mite_signature}->class->_function_for_croak; |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
return sprintf '%s( "Type check failed in signature for %s: %%s should be %%s", %s, %s )', |
|
42
|
28
|
|
33
|
|
|
97
|
$croaker, $self->subname, B::perlstring( $args{display_var} || $args{varname} ), B::perlstring( $type->display_name ); |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub _make_count_fail { |
|
46
|
10
|
|
|
10
|
|
5095
|
my ( $self, %args ) = @_; |
|
47
|
|
|
|
|
|
|
|
|
48
|
10
|
|
|
|
|
30
|
my $msg; |
|
49
|
10
|
|
|
|
|
28
|
my $min = $args{minimum}; |
|
50
|
10
|
|
|
|
|
38
|
my $max = $args{minimum}; |
|
51
|
|
|
|
|
|
|
|
|
52
|
10
|
100
|
66
|
|
|
150
|
if ( defined $min and defined $max and $min==$max ) { |
|
|
|
50
|
66
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
53
|
4
|
|
|
|
|
24
|
$msg = sprintf 'expected exactly %d parameters', $min; |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
elsif ( defined $max ) { |
|
56
|
0
|
|
0
|
|
|
0
|
$msg = sprintf 'expected between %d and %d parameters', $min || 0, $max; |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
elsif ( defined $min ) { |
|
59
|
0
|
|
|
|
|
0
|
$msg = sprintf 'expected at least %d parameters', $min; |
|
60
|
|
|
|
|
|
|
} |
|
61
|
|
|
|
|
|
|
else { |
|
62
|
6
|
|
|
|
|
14
|
$msg = 'that does not seem right'; |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
10
|
|
|
|
|
107
|
my $croaker = $self->{mite_signature}->class->_function_for_croak; |
|
66
|
|
|
|
|
|
|
|
|
67
|
10
|
50
|
|
|
|
75
|
if ( $args{got} ) { |
|
68
|
|
|
|
|
|
|
return sprintf '%s( "Wrong number of parameters in signature for %%s: got %%d, %%s", %s, %s, %s )', |
|
69
|
10
|
|
|
|
|
60
|
$croaker, B::perlstring( $self->subname ), $args{got}, B::perlstring( $msg ); |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
else { |
|
72
|
0
|
|
|
|
|
|
return sprintf '%s( "Wrong number of parameters in signature for %%s: got ???, %%s", %s, %s )', |
|
73
|
|
|
|
|
|
|
$croaker, B::perlstring( $self->subname ), B::perlstring( $msg ); |
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
1; |