| 1 | package TPath::TypeCheck; | ||||||||||
| 2 | 2 | $TPath::TypeCheck::VERSION = '1.007'; | |||||||||
| 3 | # ABSTRACT: applies type constraint on nodes | ||||||||||
| 4 | |||||||||||
| 5 | |||||||||||
| 6 | 2 | ▶ | use Moose::Role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | |||||||||||
| 9 | 2 | has node_type => | |||||||||
| 10 | ( isa => 'Maybe[Str]', is => 'ro', writer => '_node_type', default => undef ); | ||||||||||
| 11 | |||||||||||
| 12 | |||||||||||
| 13 | 0 | ▶ | sub _typecheck { | ||||||||
|
Subroutine
_typecheck: not called CC=3 SCAR=24.8
| |||||||||||
| 14 | 0 | my ( $self, $n ) = @_; | |||||||||
| 15 | 0 | ▶ | return unless $self->node_type; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 16 | 0 | ▶ | confess 'can only handle nodes of type ' . $self->node_type | ||||||||
|
Branch: 1 branch
| |||||||||||
| 17 | unless $n->isa( $self->node_type ); | ||||||||||
| 18 | } | ||||||||||
| 19 | |||||||||||
| 20 | 2 | 1; | |||||||||
| 21 | |||||||||||
| 22 | __END__ | ||||||||||