blib/lib/Zuzu/AST/Stmt/Function.pm

filter: Statementstmt 96.7% 30 / 31 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 90.9% 10 / 11 Podpod 100% 1 / 1 totaltotal 95.3% 41 / 43 CC 1 SCAR 0.1
CC
1
Cov
97%
__ANON__
1.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« blib/lib/Zuzu/AST/Stmt/For.pm ↑ Summary blib/lib/Zuzu/AST/Expr/Await.pm »
1 package Zuzu::AST::Stmt::Function;
2  
3 78 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 78 our $VERSION = '0.007002';
6  
7 78 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 78 has 'name' => ( is => 'rw' );
10 78 has 'params' => ( is => 'rw' );
11 78 has 'vararg' => ( is => 'rw' );
12 78 has 'named_vararg' => ( is => 'rw' );
13 78 has 'body' => ( is => 'rw' );
14 32 ▶has 'param_types' => ( is => 'rw', default => sub { {} } );
Subroutine __ANON__: called CC=1 SCAR=0.0
15 32 ▶has 'vararg_type' => ( is => 'rw', default => sub { 'Any' } );
Subroutine __ANON__: called CC=1 SCAR=0.0
16 32 ▶has 'named_vararg_type' => ( is => 'rw', default => sub { 'PairList' } );
Subroutine __ANON__: called CC=1 SCAR=0.0
17 32 ▶has 'param_optional' => ( is => 'rw', default => sub { {} } );
Subroutine __ANON__: called CC=1 SCAR=0.0
18 32 ▶has 'param_defaults' => ( is => 'rw', default => sub { {} } );
Subroutine __ANON__: called CC=1 SCAR=0.0
19 32 ▶has 'return_type' => ( is => 'rw', default => sub { 'Any' } );
Subroutine __ANON__: called CC=1 SCAR=0.0
20 0 ▶has 'is_async' => ( is => 'rw', default => sub { 0 } );
Subroutine __ANON__: not called CC=1 SCAR=1.2
21 1485 ▶has 'is_predeclared' => ( is => 'rw', default => sub { 0 } );
Subroutine __ANON__: called CC=1 SCAR=0.0
22  
23 78 with 'Zuzu::AST::Role::Node';
24  
25 6394 ▶sub evaluate { $_[1]->eval_function_def($_[0]) }
Subroutine evaluate: called CC=1 SCAR=0.0
Pod documented
26  
27 =pod
28  
29 =head1 NAME
30  
31 Zuzu::AST::Stmt::Function - AST node for function statements
32  
33 =head1 DESCRIPTION
34  
35 Represents one statement form in the abstract syntax tree and delegates execution to C<Zuzu::Runtime>.
36  
37 =head1 INHERITANCE
38  
39 Inherits from C<Moo::Object>.
40  
41 =head1 ROLES
42  
43 Consumes C<Zuzu::AST::Role::Node>.
44  
45 =head1 ATTRIBUTES
46  
47 =head2 name
48  
49 Type: B<Str>.
50  
51 Identifier name declared or referenced by the node/value.
52  
53 =head2 params
54  
55 Type: B<ArrayRef[Str]>.
56  
57 Ordered list of named function parameters.
58  
59 =head2 vararg
60  
61 Type: B<Maybe[Str]>.
62  
63 Optional parameter name that receives trailing arguments.
64  
65 =head2 body
66  
67 Type: B<InstanceOf["Zuzu::AST::Block"]>.
68  
69 Function or loop block executed by the node/value.
70  
71 =head1 METHODS
72  
73 =head2 evaluate
74  
75 Dispatches this AST node to the matching runtime evaluator.
76  
77 =head1 SEE ALSO
78  
79 C<Zuzu::AST::Role::Node>.
80  
81 Subclasses: none in this distribution.
82  
83 =head1 COPYRIGHT AND LICENCE
84  
85 B<< Zuzu::AST::Stmt::Function >> is copyright Toby Inkster.
86  
87 It is free software; you may redistribute it and/or modify it under
88 the terms of either the Artistic License 1.0 or the GNU General Public
89 License version 2.
90  
91 =cut
92  
93 78 1;
« blib/lib/Zuzu/AST/Stmt/For.pm ↑ Summary blib/lib/Zuzu/AST/Expr/Await.pm »