(self, enum: Enum, indent: int = 0)
| 804 | return f"global::{namespace_name}.{type_name}" |
| 805 | |
| 806 | def generate_enum(self, enum: Enum, indent: int = 0) -> List[str]: |
| 807 | lines: List[str] = [] |
| 808 | ind = self.indent_str * indent |
| 809 | comment = self.format_type_id_comment(enum, f"{ind}//") |
| 810 | if comment: |
| 811 | lines.append(comment) |
| 812 | lines.append(f"{ind}[ForyEnum]") |
| 813 | lines.append(f"{ind}public enum {self.safe_type_identifier(enum.name)}") |
| 814 | lines.append(f"{ind}{{") |
| 815 | |
| 816 | for i, value in enumerate(enum.values): |
| 817 | comma = "," if i < len(enum.values) - 1 else "" |
| 818 | stripped_name = self.strip_enum_prefix(enum.name, value.name) |
| 819 | value_name = self.safe_identifier(self.to_pascal_case(stripped_name)) |
| 820 | lines.append(f"{ind}{self.indent_str}{value_name} = {value.value}{comma}") |
| 821 | |
| 822 | lines.append(f"{ind}}}") |
| 823 | return lines |
| 824 | |
| 825 | def generate_union( |
| 826 | self, |
no test coverage detected