| 1 | 34 | ▶ | use strict; use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 2 | package Lingy::Lang::Namespace; | ||||||||||||||||||||
| 3 | |||||||||||||||||||||
| 4 | 34 | ▶ | use Lingy::Common; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | |||||||||||||||||||||
| 6 | 34 | ▶ | use Sub::Name 'subname'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | |||||||||||||||||||||
| 8 | sub NAME { | ||||||||||||||||||||
| 9 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||
|
Subroutine
NAME: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 10 | 0 | ▶ | $self->{' NAME'} // ''; | ||||||||||||||||||
|
Condition0%0/2
$self->{" NAME"} // ""
MC/DC0%0/1
$self->{" NAME"} // ""
$self->{" NAME"}
Truth table0%0/2
A
A= $self->{" NAME"}
| |||||||||||||||||||||
| 11 | } | ||||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | sub new { | ||||||||||||||||||||
| 14 | 0 | ▶ | my ($class, %args) = @_; | ||||||||||||||||||
|
Subroutine
new: not called CC=6 SCAR=31.8
Pod
undocumented
| |||||||||||||||||||||
| 15 | |||||||||||||||||||||
| 16 | 0 | my $self = bless {}, __PACKAGE__; | |||||||||||||||||||
| 17 | |||||||||||||||||||||
| 18 | 0 | my $name = $self->{' NAME'} = $args{name}; | |||||||||||||||||||
| 19 | |||||||||||||||||||||
| 20 | 0 | ▶ | if (my $refer_list = $args{refer}) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 21 | 0 | ▶ | $refer_list = [$refer_list] | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 22 | unless ref($refer_list) eq 'ARRAY'; | ||||||||||||||||||||
| 23 | 0 | ▶ | my $refer_map = RT->ns_refers->{$name} //= {}; | ||||||||||||||||||
|
Condition0%0/2
"Lingy::Lang::RT"->ns_refers->{$name} //= {}
MC/DC0%0/1
"Lingy::Lang::RT"->ns_refers->{$name} //= {}
"Lingy::Lang::RT"->ns_refers->{$name}
Truth table0%0/2
A
A= "Lingy::Lang::RT"->ns_refers->{$name}
| |||||||||||||||||||||
| 24 | 0 | for my $ns (@$refer_list) { | |||||||||||||||||||
| 25 | 0 | my $ns_name = $ns->NAME; | |||||||||||||||||||
| 26 | 0 | map $refer_map->{$_} = $ns_name, | |||||||||||||||||||
| 27 | grep /^\S/, keys %$ns; | ||||||||||||||||||||
| 28 | } | ||||||||||||||||||||
| 29 | } | ||||||||||||||||||||
| 30 | |||||||||||||||||||||
| 31 | 34 | ▶ | no strict 'refs'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 32 | 34 | ▶ | no warnings 'once'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 33 | 0 | ▶ | if (%{"${class}::ns"}) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 34 | %$self = ( | ||||||||||||||||||||
| 35 | %$self, | ||||||||||||||||||||
| 36 | 0 | %{"${class}::ns"}, | |||||||||||||||||||
| 37 | ); | ||||||||||||||||||||
| 38 | } | ||||||||||||||||||||
| 39 | |||||||||||||||||||||
| 40 | 0 | RT->namespaces->{$name} = $self; | |||||||||||||||||||
| 41 | |||||||||||||||||||||
| 42 | 0 | return $self; | |||||||||||||||||||
| 43 | } | ||||||||||||||||||||
| 44 | |||||||||||||||||||||
| 45 | sub current { | ||||||||||||||||||||
| 46 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||
|
Subroutine
current: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 47 | 0 | ▶ | my $name = $self->NAME or die; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 48 | 0 | RT->current_ns_name($name); | |||||||||||||||||||
| 49 | 0 | RT->namespaces->{$name} = $self; | |||||||||||||||||||
| 50 | 0 | RT->env->{space} = $self; | |||||||||||||||||||
| 51 | 0 | RT->namespaces->{'lingy.core'}{'*ns*'} = $self; | |||||||||||||||||||
| 52 | 0 | return $self; | |||||||||||||||||||
| 53 | } | ||||||||||||||||||||
| 54 | |||||||||||||||||||||
| 55 | sub getName { | ||||||||||||||||||||
| 56 | 0 | ▶ | symbol($_[0]->NAME); | ||||||||||||||||||
|
Subroutine
getName: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 57 | } | ||||||||||||||||||||
| 58 | |||||||||||||||||||||
| 59 | sub getImports { | ||||||||||||||||||||
| 60 | 0 | ▶ | XXX @_, 'TODO - getImports'; | ||||||||||||||||||
|
Subroutine
getImports: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 61 | } | ||||||||||||||||||||
| 62 | |||||||||||||||||||||
| 63 | sub getInterns { | ||||||||||||||||||||
| 64 | my $map = { | ||||||||||||||||||||
| 65 | 0 | ▶ | %{$_[0]}, | ||||||||||||||||||
|
Subroutine
getInterns: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 66 | }; | ||||||||||||||||||||
| 67 | 0 | delete $map->{' NAME'}; | |||||||||||||||||||
| 68 | 0 | HASHMAP->new([ %$map ]); | |||||||||||||||||||
| 69 | } | ||||||||||||||||||||
| 70 | |||||||||||||||||||||
| 71 | sub getMappings { | ||||||||||||||||||||
| 72 | my $map = { | ||||||||||||||||||||
| 73 | 0 | ▶ | %{$_[0]}, | ||||||||||||||||||
|
Subroutine
getMappings: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||
| 74 | }; | ||||||||||||||||||||
| 75 | 0 | my $name = delete $map->{' NAME'}; | |||||||||||||||||||
| 76 | 0 | ▶ | my $refer = RT->ns_refers->{$name} // {}; | ||||||||||||||||||
|
Condition0%0/2
"Lingy::Lang::RT"->ns_refers->{$name} // {}
MC/DC0%0/1
"Lingy::Lang::RT"->ns_refers->{$name} // {}
"Lingy::Lang::RT"->ns_refers->{$name}
Truth table0%0/2
A
A= "Lingy::Lang::RT"->ns_refers->{$name}
| |||||||||||||||||||||
| 77 | 0 | for my $key (keys %$refer) { | |||||||||||||||||||
| 78 | 0 | my $ns = $refer->{$key}; | |||||||||||||||||||
| 79 | $map->{$key} = | ||||||||||||||||||||
| 80 | RT->namespaces->{$ns}->{$key} // | ||||||||||||||||||||
| 81 | 0 | ▶ | RT->namespaces->{$key}; | ||||||||||||||||||
|
Condition0%0/3
"Lingy::Lang::RT"->namespaces->{$ns}{$key} // "Lingy::Lang::RT"->namespaces->{$key}
MC/DC0%0/2
"Lingy::Lang::RT"->namespaces->{$ns}{$key} // "Lingy::Lang::RT"->namespaces->{$key}
"Lingy::Lang::RT"->namespaces->{$ns}{$key}
"Lingy::Lang::RT"->namespaces->{$key}
Truth table0%0/3
A // B
A= "Lingy::Lang::RT"->namespaces->{$ns}{$key}B= "Lingy::Lang::RT"->namespaces->{$key}
| |||||||||||||||||||||
| 82 | } | ||||||||||||||||||||
| 83 | 0 | HASHMAP->new([ %$map ]); | |||||||||||||||||||
| 84 | } | ||||||||||||||||||||
| 85 | |||||||||||||||||||||
| 86 | 34 | 1; | |||||||||||||||||||