| 1 | package Zuzu::AST::Expr::Ternary; | ||
| 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 'cond' => ( is => 'rw' ); | |
| 10 | 78 | has 'if_true' => ( is => 'rw' ); | |
| 11 | 78 | has 'if_false' => ( is => 'rw' ); | |
| 12 | |||
| 13 | 78 | with 'Zuzu::AST::Role::Node'; | |
| 14 | |||
| 15 | 850 | ▶ | sub evaluate { $_[1]->eval_ternary($_[0]) } |
|
Subroutine
evaluate: called CC=1 SCAR=0.0
Pod
documented
| |||
| 16 | |||
| 17 | =pod | ||
| 18 | |||
| 19 | =head1 NAME | ||
| 20 | |||
| 21 | Zuzu::AST::Expr::Ternary - AST node for ternary expressions | ||
| 22 | |||
| 23 | =head1 DESCRIPTION | ||
| 24 | |||
| 25 | Represents one expression form in the abstract syntax tree and | ||
| 26 | delegates evaluation to C<Zuzu::Runtime>. | ||
| 27 | |||
| 28 | =head1 INHERITANCE | ||
| 29 | |||
| 30 | Inherits from C<Moo::Object>. | ||
| 31 | |||
| 32 | =head1 ROLES | ||
| 33 | |||
| 34 | Consumes C<Zuzu::AST::Role::Node>. | ||
| 35 | |||
| 36 | =head1 ATTRIBUTES | ||
| 37 | |||
| 38 | =head2 cond | ||
| 39 | |||
| 40 | Type: B<ConsumerOf["Zuzu::AST::Role::Node"]>. | ||
| 41 | |||
| 42 | Condition expression. | ||
| 43 | |||
| 44 | =head2 if_true | ||
| 45 | |||
| 46 | Type: B<Maybe[ConsumerOf["Zuzu::AST::Role::Node"]]>. | ||
| 47 | |||
| 48 | Expression evaluated when C<cond> is truthy. May be absent for the | ||
| 49 | abbreviated ternary form C<?:>. | ||
| 50 | |||
| 51 | =head2 if_false | ||
| 52 | |||
| 53 | Type: B<ConsumerOf["Zuzu::AST::Role::Node"]>. | ||
| 54 | |||
| 55 | Expression evaluated when C<cond> is falsey. | ||
| 56 | |||
| 57 | =head1 METHODS | ||
| 58 | |||
| 59 | =head2 evaluate | ||
| 60 | |||
| 61 | Dispatches this AST node to the matching runtime evaluator. | ||
| 62 | |||
| 63 | =head1 SEE ALSO | ||
| 64 | |||
| 65 | C<Zuzu::AST::Role::Node>. | ||
| 66 | |||
| 67 | Subclasses: none in this distribution. | ||
| 68 | |||
| 69 | =head1 COPYRIGHT AND LICENCE | ||
| 70 | |||
| 71 | B<< Zuzu::AST::Expr::Ternary >> is copyright Toby Inkster. | ||
| 72 | |||
| 73 | It is free software; you may redistribute it and/or modify it under | ||
| 74 | the terms of either the Artistic License 1.0 or the GNU General Public | ||
| 75 | License version 2. | ||
| 76 | |||
| 77 | =cut | ||
| 78 | |||
| 79 | 78 | 1; | |