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

filter: Statementstmt 94.1% 16 / 17 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 3 / 4 Podpod 100% 1 / 1 totaltotal 90.9% 20 / 22 CC 1 SCAR 0.3
CC
1
Cov
94%
__ANON__
1.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« blib/lib/Zuzu/AST/Stmt/PostfixIf.pm ↑ Summary blib/lib/Zuzu/AST/Stmt/Function.pm »
1 package Zuzu::AST::Stmt::For;
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 'var' => ( is => 'rw' );
10 0 ▶has 'declare_loop_var' => ( is => 'rw', default => sub { 1 } );
Subroutine __ANON__: not called CC=1 SCAR=1.2
11 78 has 'loop_var_kind' => ( is => 'rw' );
12 78 has 'collection' => ( is => 'rw' );
13 78 has 'body' => ( is => 'rw' );
14 78 has 'else_block' => ( is => 'rw' );
15  
16 78 with 'Zuzu::AST::Role::Node';
17  
18 2075 ▶sub evaluate { $_[1]->eval_for($_[0]) }
Subroutine evaluate: called CC=1 SCAR=0.0
Pod documented
19  
20 =pod
21  
22 =head1 NAME
23  
24 Zuzu::AST::Stmt::For - AST node for for statements
25  
26 =head1 DESCRIPTION
27  
28 Represents one statement form in the abstract syntax tree and delegates execution to C<Zuzu::Runtime>.
29  
30 =head1 INHERITANCE
31  
32 Inherits from C<Moo::Object>.
33  
34 =head1 ROLES
35  
36 Consumes C<Zuzu::AST::Role::Node>.
37  
38 =head1 ATTRIBUTES
39  
40 =head2 var
41  
42 Type: B<Str>.
43  
44 Loop variable name bound for each iteration.
45  
46 =head2 collection
47  
48 Type: B<ConsumerOf["Zuzu::AST::Role::Node"]>.
49  
50 Expression producing the iterable collection for the loop.
51  
52 =head2 body
53  
54 Type: B<InstanceOf["Zuzu::AST::Block"]>.
55  
56 Function or loop block executed by the node/value.
57  
58 =head2 declare_loop_var
59  
60 Type: B<Bool>.
61  
62 When true, the loop header declared the iteration variable with C<let>
63 or C<const>.
64 When false, the loop reuses an already declared variable.
65  
66 =head2 loop_var_kind
67  
68 Type: B<Maybe[Str]>.
69  
70 Declaration keyword used for the loop variable when
71 C<declare_loop_var> is true. Expected values are C<let> or C<const>.
72  
73 =head2 else_block
74  
75 Type: B<Maybe[InstanceOf["Zuzu::AST::Block"]]>.
76  
77 Optional block executed when a loop has zero iterations.
78  
79 =head1 METHODS
80  
81 =head2 evaluate
82  
83 Dispatches this AST node to the matching runtime evaluator.
84  
85 =head1 SEE ALSO
86  
87 C<Zuzu::AST::Role::Node>.
88  
89 Subclasses: none in this distribution.
90  
91 =head1 COPYRIGHT AND LICENCE
92  
93 B<< Zuzu::AST::Stmt::For >> is copyright Toby Inkster.
94  
95 It is free software; you may redistribute it and/or modify it under
96 the terms of either the Artistic License 1.0 or the GNU General Public
97 License version 2.
98  
99 =cut
100  
101 78 1;
« blib/lib/Zuzu/AST/Stmt/PostfixIf.pm ↑ Summary blib/lib/Zuzu/AST/Stmt/Function.pm »