Data/Sah/Compiler/js/TH/obj.pm

filter: Statementstmt 57.5% 19 / 33 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 62.5% 5 / 8 Podpod 0.0% 0 / 3 totaltotal 54.5% 24 / 44 CC 1 SCAR 3.2
CC
1
Cov
58%
handle_type
2.0
clause_can
2.0
clause_isa
2.0
CRAP 1.4
« Data/Sah/Compiler/js/TH/int.pm ↑ Summary Data/Sah/Compiler/js/TH/code.pm »
1 package Data::Sah::Compiler::js::TH::obj;
2  
3 1 our $DATE = '2016-09-14'; # DATE
4 1 our $VERSION = '0.87'; # VERSION
5  
6 1 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 #use Log::Any '$log';
10  
11 1 ▶use Mo qw(build default);
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use Role::Tiny::With;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 1 extends 'Data::Sah::Compiler::js::TH';
15 1 with 'Data::Sah::Type::obj';
16  
17 0 ▶sub handle_type {
Subroutine handle_type: not called CC=1 SCAR=6.9
Pod undocumented
18 0 my ($self, $cd) = @_;
19 0 my $c = $self->compiler;
20 0 my $dt = $cd->{data_term};
21  
22 0 $cd->{_ccl_check_type} = "typeof($dt) == 'object'";
23 }
24  
25 0 ▶sub clause_can {
Subroutine clause_can: not called CC=1 SCAR=6.9
Pod undocumented
26 0 my ($self, $cd) = @_;
27 0 my $c = $self->compiler;
28 0 my $ct = $cd->{cl_term};
29 0 my $dt = $cd->{data_term};
30  
31 0 $c->add_ccl($cd, "typeof($dt\[$ct])=='function'");
32 # for property: ($dt).hasOwnProperty($ct)
33 }
34  
35 0 ▶sub clause_isa {
Subroutine clause_isa: not called CC=1 SCAR=6.9
Pod undocumented
36 0 my ($self, $cd) = @_;
37 0 my $c = $self->compiler;
38 0 my $ct = $cd->{cl_term};
39 0 my $dt = $cd->{data_term};
40  
41 0 $c->_die_unimplemented_clause($cd);
42 # doesn't work? in nodejs?
43 #$c->add_ccl($cd, "$dt instanceOf global($ct)");
44 }
45  
46 1 1;
47 # ABSTRACT: js's type handler for type "obj"
48  
49 __END__
« Data/Sah/Compiler/js/TH/int.pm ↑ Summary Data/Sah/Compiler/js/TH/code.pm »