VAST/package_declarator.pm untested

filter: Statementstmt 0.0% 0 / 56 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 3 Podpod n/a totaltotal 0.0% 0 / 61 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 use v5.10;
2 use MooseX::Declare;
3 class VAST::package_declarator {
4 use Mildew::AST::Helpers;
5 method emit_m0ld {
6 my $name = $self->{package_def}{longname}[0]{name}{identifier}{TEXT};
7 my $id_type_sub = Mildew::AST::unique_id;
8
9 my %how_type = (
10 knowhow => 'PrototypeHOW',
11 class => 'ClassHOW',
12 role => 'RoleHOW'
13 );
14 XXX unless $how_type{$self->{SYM}};
15  
16
17
18 my $init = $self->{package_def}{blockoid}->emit_m0ld;
19
20 my $mold = Mildew::AST::Block->new(regs => $init->regs,stmts => [
21 let(call(new=>FETCH(lookup("Package"))),sub {
22 my $package = shift;
23 let call("^!CREATE" => FETCH(lookup("p6opaque"))),sub {
24 my $proto = shift;
25 Mildew::AST::Seq->new(stmts => [
26 call(STORE => call(name => $package),[string $name]),
27 call(STORE => call("postcircumfix:{ }" => FETCH(call(outer => reg '$scope')),
28 [string $name]),[$proto]),
29 call(STORE => call("postcircumfix:{ }" => FETCH(call outer => reg '$scope'),
30 [string $name.'::']),[$package]),
31 let(call(new=>FETCH(lookup("Package"))), sub {
32 my $export = shift;
33 Mildew::AST::Seq->new(stmts => [
34 call(STORE => call("postcircumfix:{ }"=>$package,[string 'EXPORT::']),
35 [ $export ]),
36 call(STORE => call("postcircumfix:{ }"=>$export,[string 'ALL::']),
37 [ call(new=>FETCH(lookup('Package'))) ]),
38 call(STORE => call("postcircumfix:{ }"=>$export,[string 'DEFAULT::']),
39 [ call(new=>FETCH(lookup('Package'))) ]),
40 ]);
41 }),
42 call(STORE => call("postcircumfix:{ }" => FETCH(call(outer => reg '$scope')),
43 [string '&'.$name]),[
44 call(new => FETCH(lookup('Code')),[],[string 'outer'=>reg '$scope',,string 'signature'=>empty_sig(),string 'mold' => Mildew::AST::Block->new(regs=>['interpreter','scope'],stmts=>trailing_return([lookup('$?CLASS')]))])
45 ]),
46 call(STORE => call("postcircumfix:{ }" => reg '$scope',[string '$?PACKAGE']),[$package]),
47 call(STORE => call("postcircumfix:{ }" => FETCH(call lookup => FETCH(call outer => reg '$scope'),[string '$?PACKAGE']),[string $name.'::']),[$package]),
48 call(STORE => call("postcircumfix:{ }" => reg '$scope',[string '$?CLASS']),[$proto]),
49 call(STORE => call("^!how" => $proto),[FETCH lookup($how_type{$self->{SYM}})]),
50 call(STORE => call("^!who" => $proto),[$package])
51 ]);
52 };
53 }),
54 @{$init->stmts}
55 ]);
56 call("postcircumfix:( )" =>
57 call(new => FETCH(lookup('Code')),[],[string 'outer'=>reg '$scope',string 'mold' => $mold,string 'signature'=>empty_sig()]),
58 [capturize()]
59 );
60 }
61 }