File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -88,6 +88,12 @@ enum Priority: int
8888 case High = 3 ;
8989}
9090
91+ enum Mode
92+ {
93+ case Automatic;
94+ case Manual;
95+ }
96+
9197// ─── Base / Parent Class ────────────────────────────────────────────────────
9298
9399/**
Original file line number Diff line number Diff line change 77use std:: collections:: HashMap ;
88
99use bumpalo:: Bump ;
10+ use mago_span:: HasSpan ;
1011use mago_syntax:: ast:: * ;
1112use mago_syntax:: parser:: parse_file_content;
1213
@@ -683,9 +684,28 @@ impl Backend {
683684 Statement :: Enum ( enum_def) => {
684685 let enum_name = enum_def. name . value . to_string ( ) ;
685686
686- let ( mut methods, mut properties, constants, used_traits) =
687+ let ( mut methods, mut properties, constants, mut used_traits) =
687688 Self :: extract_class_like_members ( enum_def. members . iter ( ) , doc_ctx) ;
688689
690+ // Determine if the enum is a BackedEnum or UnitEnum
691+ let implicit_interface = if let Some ( backing) = & enum_def. backing_type_hint {
692+ if let Some ( ctx) = doc_ctx {
693+ let range = backing. hint . span ( ) . to_range_usize ( ) ;
694+ let backing_str = & ctx. content [ range] ;
695+ match backing_str {
696+ "int" | "string" => "BackedEnum" ,
697+ _ => "UnitEnum" ,
698+ }
699+ } else {
700+ "UnitEnum"
701+ }
702+ } else {
703+ "UnitEnum"
704+ } ;
705+
706+ // Add the implicit interface to used_traits
707+ used_traits. push ( implicit_interface. to_string ( ) ) ;
708+
689709 // Extract @property, @method, and @mixin tags from the enum-level docblock.
690710 let mut mixins = Vec :: new ( ) ;
691711 if let Some ( ctx) = doc_ctx
You can’t perform that action at this time.
0 commit comments