| 1 | package Zuzu::AST::Stmt::Class; | ||
| 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 'parent' => ( is => 'rw' ); | |
| 11 | 78 | has 'traits' => ( is => 'rw' ); | |
| 12 | 78 | has 'fields' => ( is => 'rw' ); | |
| 13 | 78 | has 'methods' => ( is => 'rw' ); | |
| 14 | 78 | has 'static_methods' => ( is => 'rw' ); | |
| 15 | 78 | has 'classes' => ( is => 'rw' ); | |
| 16 | |||
| 17 | 78 | with 'Zuzu::AST::Role::Node'; | |
| 18 | |||
| 19 | 2381 | ▶ | sub evaluate { $_[1]->eval_class_def($_[0]) } |
|
Subroutine
evaluate: called CC=1 SCAR=0.0
Pod
documented
| |||
| 20 | |||
| 21 | =pod | ||
| 22 | |||
| 23 | =head1 NAME | ||
| 24 | |||
| 25 | Zuzu::AST::Stmt::Class - AST node for class statements | ||
| 26 | |||
| 27 | =head1 DESCRIPTION | ||
| 28 | |||
| 29 | Represents a class declaration with optional inheritance, fields, | ||
| 30 | methods, and nested classes. | ||
| 31 | |||
| 32 | =head1 INHERITANCE | ||
| 33 | |||
| 34 | Inherits from C<Moo::Object>. | ||
| 35 | |||
| 36 | =head1 ROLES | ||
| 37 | |||
| 38 | Consumes C<Zuzu::AST::Role::Node>. | ||
| 39 | |||
| 40 | =head1 ATTRIBUTES | ||
| 41 | |||
| 42 | =head2 name | ||
| 43 | |||
| 44 | Type: B<Str>. | ||
| 45 | |||
| 46 | Identifier name declared or referenced by the node/value. | ||
| 47 | |||
| 48 | =head2 parent | ||
| 49 | |||
| 50 | Type: B<Maybe[InstanceOf["Zuzu::AST::Expr::TypeRef"]]>. | ||
| 51 | |||
| 52 | Optional parent class name used for inheritance lookup. | ||
| 53 | |||
| 54 | =head2 traits | ||
| 55 | |||
| 56 | Type: B<ArrayRef[InstanceOf["Zuzu::AST::Expr::TypeRef"]]>. | ||
| 57 | |||
| 58 | Trait references mixed into this class via C<with> or C<but>. | ||
| 59 | |||
| 60 | =head2 fields | ||
| 61 | |||
| 62 | Type: B<ArrayRef[HashRef]>. | ||
| 63 | |||
| 64 | Ordered field declarations with C<name>, C<is_const>, and C<init>. | ||
| 65 | |||
| 66 | =head2 methods | ||
| 67 | |||
| 68 | Type: B<ArrayRef[InstanceOf["Zuzu::AST::Stmt::Method"]]>. | ||
| 69 | |||
| 70 | Instance methods declared in this class. | ||
| 71 | |||
| 72 | =head2 static_methods | ||
| 73 | |||
| 74 | Type: B<ArrayRef[InstanceOf["Zuzu::AST::Stmt::Method"]]>. | ||
| 75 | |||
| 76 | Static methods declared in this class. | ||
| 77 | |||
| 78 | =head2 classes | ||
| 79 | |||
| 80 | Type: B<ArrayRef[InstanceOf["Zuzu::AST::Stmt::Class"]]>. | ||
| 81 | |||
| 82 | Nested class declarations scoped within this class. | ||
| 83 | |||
| 84 | =head1 METHODS | ||
| 85 | |||
| 86 | =head2 evaluate | ||
| 87 | |||
| 88 | Dispatches this AST node to the matching runtime evaluator. | ||
| 89 | |||
| 90 | =head1 SEE ALSO | ||
| 91 | |||
| 92 | C<Zuzu::AST::Role::Node>. | ||
| 93 | |||
| 94 | Subclasses: none in this distribution. | ||
| 95 | |||
| 96 | =head1 COPYRIGHT AND LICENCE | ||
| 97 | |||
| 98 | B<< Zuzu::AST::Stmt::Class >> is copyright Toby Inkster. | ||
| 99 | |||
| 100 | It is free software; you may redistribute it and/or modify it under | ||
| 101 | the terms of either the Artistic License 1.0 or the GNU General Public | ||
| 102 | License version 2. | ||
| 103 | |||
| 104 | =cut | ||
| 105 | |||
| 106 | 78 | 1; | |