| 1 | 8 | ▶ | use 5.010001; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 8 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 8 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | package Mite::Signature::Compiler; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 8 | ▶ | use Type::Params::Signature 1.016008 (); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 8 | ▶ | use Types::Standard qw( Slurpy ); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 8 | ▶ | use Scalar::Util (); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 8 | our @ISA = 'Type::Params::Signature'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 10 | ▶ | sub BUILD { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BUILD: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 10 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 10 | Scalar::Util::weaken( $self->{mite_signature} ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | # This is not a Mite class, so manually call | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | # parent BUILD: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 10 | $self->SUPER::BUILD( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 19 | ▶ | sub _make_general_fail { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_make_general_fail: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 19 | my ( $self, %args ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 19 | my $croaker = $self->{mite_signature}->class->_function_for_croak; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 19 | return sprintf '%s( "Failure in signature for %s: " . %s )', $croaker, $self->subname, $args{message}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 28 | ▶ | sub _make_constraint_fail { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_make_constraint_fail: called CC=5 SCAR=21.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 28 | my ( $self, %args ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 28 | my $type = $args{constraint}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 28 | ▶ | if ( $type->parent and $type->parent->{uniq} == Slurpy->{uniq} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$type->parent and $type->parent->{"uniq"} == &Slurpy()->{"uniq"}
MC/DC0%0/2
$type->parent and $type->parent->{"uniq"} == &Slurpy()->{"uniq"}
$type->parent
$type->parent->{"uniq"} == &Slurpy()->{"uniq"}
Truth table33%1/3
A and B
A= $type->parentB= $type->parent->{"uniq"} == &Slurpy()->{"uniq"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | ▶ | $type = $type->type_parameter || $type; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$type->type_parameter || $type
MC/DC0%0/2
$type->type_parameter || $type
$type->type_parameter
$type
Truth table0%0/3
A || B
A= $type->type_parameterB= $type
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 28 | 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 | ▶ | $croaker, $self->subname, B::perlstring( $args{display_var} || $args{varname} ), B::perlstring( $type->display_name ); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$args{'display_var'} || $args{'varname'}
MC/DC0%0/2
$args{'display_var'} || $args{'varname'}
$args{'display_var'}
$args{'varname'}
Truth table33%1/3
A || B
A= $args{'display_var'}B= $args{'varname'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 10 | ▶ | sub _make_count_fail { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_make_count_fail: called CC=8 SCAR=23.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 10 | my ( $self, %args ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 10 | my $msg; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 10 | my $min = $args{minimum}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 10 | my $max = $args{minimum}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 10 | ▶ | if ( defined $min and defined $max and $min==$max ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition66%4/6
defined $min and defined $max and $min == $max
defined $min and defined $max
MC/DC33%1/3
defined $min and defined $max and $min == $max
defined $min
defined $max
$min == $max
Truth table50%2/4
A and B and C
A= defined $minB= defined $maxC= $min == $max
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 4 | $msg = sprintf 'expected exactly %d parameters', $min; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | elsif ( defined $max ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | ▶ | $msg = sprintf 'expected between %d and %d parameters', $min || 0, $max; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$min || 0
MC/DC0%0/1
$min || 0
$min
Truth table0%0/2
A
A= $min
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | elsif ( defined $min ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | $msg = sprintf 'expected at least %d parameters', $min; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 6 | $msg = 'that does not seem right'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 10 | my $croaker = $self->{mite_signature}->class->_function_for_croak; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 10 | ▶ | if ( $args{got} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | return sprintf '%s( "Wrong number of parameters in signature for %%s: got %%d, %%s", %s, %s, %s )', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 10 | $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 | 8 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||