| 1 | package Zuzu::AST::Stmt::Method; | ||
| 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 'name' => ( is => 'rw' ); | |
| 10 | 78 | has 'params' => ( is => 'rw' ); | |
| 11 | 78 | has 'vararg' => ( is => 'rw' ); | |
| 12 | 78 | has 'named_vararg' => ( is => 'rw' ); | |
| 13 | 78 | has 'body' => ( is => 'rw' ); | |
| 14 | 78 | has 'is_static' => ( is => 'rw' ); | |
| 15 | 9 | ▶ | has 'param_types' => ( is => 'rw', default => sub { {} } ); |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 16 | 9 | ▶ | has 'vararg_type' => ( is => 'rw', default => sub { 'Any' } ); |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 17 | 9 | ▶ | has 'named_vararg_type' => ( is => 'rw', default => sub { 'PairList' } ); |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 18 | 9 | ▶ | has 'param_optional' => ( is => 'rw', default => sub { {} } ); |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 19 | 9 | ▶ | has 'param_defaults' => ( is => 'rw', default => sub { {} } ); |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 20 | 9 | ▶ | has 'return_type' => ( is => 'rw', default => sub { 'Any' } ); |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 21 | 86 | ▶ | has 'is_async' => ( is => 'rw', default => sub { 0 } ); |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 22 | 1603 | ▶ | has 'uses_super' => ( is => 'rw', default => sub { undef } ); |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 23 | 1594 | ▶ | has 'is_predeclared' => ( is => 'rw', default => sub { 0 } ); |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 24 | |||
| 25 | 78 | with 'Zuzu::AST::Role::Node'; | |
| 26 | |||
| 27 | 0 | ▶ | sub evaluate { $_[1]->eval_method_def($_[0]) } |
|
Subroutine
evaluate: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 28 | |||
| 29 | =pod | ||
| 30 | |||
| 31 | =head1 NAME | ||
| 32 | |||
| 33 | Zuzu::AST::Stmt::Method - AST node for method declarations | ||
| 34 | |||
| 35 | =head1 DESCRIPTION | ||
| 36 | |||
| 37 | Represents either an instance method or static method declaration | ||
| 38 | inside a class body. | ||
| 39 | |||
| 40 | =head1 INHERITANCE | ||
| 41 | |||
| 42 | Inherits from C<Moo::Object>. | ||
| 43 | |||
| 44 | =head1 ROLES | ||
| 45 | |||
| 46 | Consumes C<Zuzu::AST::Role::Node>. | ||
| 47 | |||
| 48 | =head1 ATTRIBUTES | ||
| 49 | |||
| 50 | =head2 name | ||
| 51 | |||
| 52 | Type: B<Str>. | ||
| 53 | |||
| 54 | Identifier name declared or referenced by the node/value. | ||
| 55 | |||
| 56 | =head2 params | ||
| 57 | |||
| 58 | Type: B<ArrayRef[Str]>. | ||
| 59 | |||
| 60 | Ordered list of named function parameters. | ||
| 61 | |||
| 62 | =head2 vararg | ||
| 63 | |||
| 64 | Type: B<Maybe[Str]>. | ||
| 65 | |||
| 66 | Optional parameter name that receives trailing arguments. | ||
| 67 | |||
| 68 | =head2 body | ||
| 69 | |||
| 70 | Type: B<InstanceOf["Zuzu::AST::Block"]>. | ||
| 71 | |||
| 72 | Function or loop block executed by the node/value. | ||
| 73 | |||
| 74 | =head2 is_static | ||
| 75 | |||
| 76 | Type: B<Bool>. | ||
| 77 | |||
| 78 | Whether this method is invoked on the class instead of instances. | ||
| 79 | |||
| 80 | =head2 uses_super | ||
| 81 | |||
| 82 | Type: B<Maybe[Bool]>. | ||
| 83 | |||
| 84 | Whether this method uses C<super>. C<undef> means the method has not been | ||
| 85 | analysed yet. | ||
| 86 | |||
| 87 | =head1 METHODS | ||
| 88 | |||
| 89 | =head2 evaluate | ||
| 90 | |||
| 91 | Dispatches this AST node to the matching runtime evaluator. | ||
| 92 | |||
| 93 | =head1 SEE ALSO | ||
| 94 | |||
| 95 | C<Zuzu::AST::Role::Node>. | ||
| 96 | |||
| 97 | Subclasses: none in this distribution. | ||
| 98 | |||
| 99 | =head1 COPYRIGHT AND LICENCE | ||
| 100 | |||
| 101 | B<< Zuzu::AST::Stmt::Method >> is copyright Toby Inkster. | ||
| 102 | |||
| 103 | It is free software; you may redistribute it and/or modify it under | ||
| 104 | the terms of either the Artistic License 1.0 or the GNU General Public | ||
| 105 | License version 2. | ||
| 106 | |||
| 107 | =cut | ||
| 108 | |||
| 109 | 78 | 1; | |