blib/lib/Zuzu/Value/Function.pm

filter: Statementstmt 96.8% 31 / 32 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 90.9% 10 / 11 Podpod 100% 1 / 1 totaltotal 95.4% 42 / 44 CC 1 SCAR 0.9
CC
1
Cov
97%
is_truthy
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« blib/lib/Zuzu/AST/Expr/Spread.pm ↑ Summary blib/lib/Zuzu/AST/Expr/Function.pm »
1 package Zuzu::Value::Function;
2  
3 69 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 69 our $VERSION = '0.007002';
6  
7 69 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 69 has 'name' => ( is => 'rw' );
10 69 has 'params' => ( is => 'rw' );
11 69 has 'vararg' => ( is => 'rw' );
12 69 has 'named_vararg' => ( is => 'rw' );
13 56319 ▶has 'param_types' => ( is => 'rw', default => sub { {} } );
Subroutine __ANON__: called CC=1 SCAR=0.0
14 56319 ▶has 'vararg_type' => ( is => 'rw', default => sub { 'Any' } );
Subroutine __ANON__: called CC=1 SCAR=0.0
15 56319 ▶has 'named_vararg_type' => ( is => 'rw', default => sub { 'PairList' } );
Subroutine __ANON__: called CC=1 SCAR=0.0
16 56319 ▶has 'param_optional' => ( is => 'rw', default => sub { {} } );
Subroutine __ANON__: called CC=1 SCAR=0.0
17 56319 ▶has 'param_defaults' => ( is => 'rw', default => sub { {} } );
Subroutine __ANON__: called CC=1 SCAR=0.0
18 56208 ▶has 'return_type' => ( is => 'rw', default => sub { 'Any' } );
Subroutine __ANON__: called CC=1 SCAR=0.0
19 69 has 'body' => ( is => 'rw' );
20 69 has 'closure_env' => ( is => 'rw' );
21 56319 ▶has 'is_async' => ( is => 'rw', default => sub { 0 } );
Subroutine __ANON__: called CC=1 SCAR=0.0
22 69 has 'source_node' => ( is => 'rw' );
23 67866 ▶has 'is_bodyless' => ( is => 'rw', default => sub { 0 } );
Subroutine __ANON__: called CC=1 SCAR=0.0
24  
25 0 ▶sub is_truthy { 1 }
Subroutine is_truthy: not called CC=1 SCAR=6.9
Pod documented
26  
27 =pod
28  
29 =head1 NAME
30  
31 Zuzu::Value::Function - runtime value class for function values
32  
33 =head1 DESCRIPTION
34  
35 Represents user-defined or native callable values, including closure state.
36  
37 =head1 INHERITANCE
38  
39 Inherits from C<Moo::Object>.
40  
41 =head1 ROLES
42  
43 None.
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 =head2 closure_env
72  
73 Type: B<Maybe[InstanceOf["Zuzu::Env"]]>.
74  
75 Lexical environment captured when the function is created.
76  
77 =head1 METHODS
78  
79 =head2 is_truthy
80  
81 Returns this runtime value's truthiness in ZuzuScript.
82  
83 =head1 SEE ALSO
84  
85 Subclasses: none in this distribution.
86  
87 =head1 COPYRIGHT AND LICENCE
88  
89 B<< Zuzu::Value::Function >> is copyright Toby Inkster.
90  
91 It is free software; you may redistribute it and/or modify it under
92 the terms of either the Artistic License 1.0 or the GNU General Public
93 License version 2.
94  
95 =cut
96  
97 69 1;
« blib/lib/Zuzu/AST/Expr/Spread.pm ↑ Summary blib/lib/Zuzu/AST/Expr/Function.pm »