| 1 | package Zuzu::AST::Expr::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 'params' => ( is => 'rw' ); | |
| 10 | 78 | has 'vararg' => ( is => 'rw' ); | |
| 11 | 78 | has 'named_vararg' => ( is => 'rw' ); | |
| 12 | 78 | has 'body' => ( is => 'rw' ); | |
| 13 | 0 | ▶ | has 'param_types' => ( is => 'rw', default => sub { {} } ); |
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||
| 14 | 0 | ▶ | has 'vararg_type' => ( is => 'rw', default => sub { 'Any' } ); |
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||
| 15 | 0 | ▶ | has 'named_vararg_type' => ( is => 'rw', default => sub { 'PairList' } ); |
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||
| 16 | 0 | ▶ | has 'param_optional' => ( is => 'rw', default => sub { {} } ); |
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||
| 17 | 0 | ▶ | has 'param_defaults' => ( is => 'rw', default => sub { {} } ); |
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||
| 18 | 0 | ▶ | has 'return_type' => ( is => 'rw', default => sub { 'Any' } ); |
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||
| 19 | 0 | ▶ | has 'is_async' => ( is => 'rw', default => sub { 0 } ); |
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||
| 20 | |||
| 21 | 78 | with 'Zuzu::AST::Role::Node'; | |
| 22 | |||
| 23 | 4967 | ▶ | sub evaluate { $_[1]->eval_function_expr($_[0]) } |
|
Subroutine
evaluate: called CC=1 SCAR=0.0
Pod
documented
| |||
| 24 | |||
| 25 | =pod | ||
| 26 | |||
| 27 | =head1 NAME | ||
| 28 | |||
| 29 | Zuzu::AST::Expr::Function - AST node for function expression values | ||
| 30 | |||
| 31 | =head1 DESCRIPTION | ||
| 32 | |||
| 33 | Represents an anonymous or lambda-style function expression in the AST | ||
| 34 | and delegates evaluation to C<Zuzu::Runtime>. | ||
| 35 | |||
| 36 | =head1 INHERITANCE | ||
| 37 | |||
| 38 | Inherits from C<Moo::Object>. | ||
| 39 | |||
| 40 | =head1 ROLES | ||
| 41 | |||
| 42 | Consumes C<Zuzu::AST::Role::Node>. | ||
| 43 | |||
| 44 | =head1 ATTRIBUTES | ||
| 45 | |||
| 46 | =head2 params | ||
| 47 | |||
| 48 | Type: B<ArrayRef[Str]>. | ||
| 49 | |||
| 50 | Ordered list of named function parameters. | ||
| 51 | |||
| 52 | =head2 vararg | ||
| 53 | |||
| 54 | Type: B<Maybe[Str]>. | ||
| 55 | |||
| 56 | Optional parameter name that receives trailing arguments. | ||
| 57 | |||
| 58 | =head2 body | ||
| 59 | |||
| 60 | Type: B<InstanceOf["Zuzu::AST::Block"]>. | ||
| 61 | |||
| 62 | Function body block executed by this expression when called. | ||
| 63 | |||
| 64 | =head1 METHODS | ||
| 65 | |||
| 66 | =head2 evaluate | ||
| 67 | |||
| 68 | Dispatches this AST node to the matching runtime evaluator. | ||
| 69 | |||
| 70 | =head1 SEE ALSO | ||
| 71 | |||
| 72 | C<Zuzu::AST::Role::Node>. | ||
| 73 | |||
| 74 | Subclasses: none in this distribution. | ||
| 75 | |||
| 76 | =head1 COPYRIGHT AND LICENCE | ||
| 77 | |||
| 78 | B<< Zuzu::AST::Expr::Function >> is copyright Toby Inkster. | ||
| 79 | |||
| 80 | It is free software; you may redistribute it and/or modify it under | ||
| 81 | the terms of either the Artistic License 1.0 or the GNU General Public | ||
| 82 | License version 2. | ||
| 83 | |||
| 84 | =cut | ||
| 85 | |||
| 86 | 78 | 1; | |