NAME

Zuzu::AST::Stmt::For - AST node for for statements

DESCRIPTION

Represents one statement form in the abstract syntax tree and delegates execution to Zuzu::Runtime.

INHERITANCE

Inherits from Moo::Object.

ROLES

Consumes Zuzu::AST::Role::Node.

ATTRIBUTES

var

Type: Str.

Loop variable name bound for each iteration.

collection

Type: ConsumerOf["Zuzu::AST::Role::Node"].

Expression producing the iterable collection for the loop.

body

Type: InstanceOf["Zuzu::AST::Block"].

Function or loop block executed by the node/value.

declare_loop_var

Type: Bool.

When true, the loop header declared the iteration variable with let or const. When false, the loop reuses an already declared variable.

loop_var_kind

Type: Maybe[Str].

Declaration keyword used for the loop variable when declare_loop_var is true. Expected values are let or const.

else_block

Type: Maybe[InstanceOf["Zuzu::AST::Block"]].

Optional block executed when a loop has zero iterations.

METHODS

evaluate

Dispatches this AST node to the matching runtime evaluator.

SEE ALSO

Zuzu::AST::Role::Node.

Subclasses: none in this distribution.

COPYRIGHT AND LICENCE

Zuzu::AST::Stmt::For is copyright Toby Inkster.

It is free software; you may redistribute it and/or modify it under the terms of either the Artistic License 1.0 or the GNU General Public License version 2.