(module: &ModuleDef, out: &mut Indenter, ident: &Identifier, ty: &AlgebraicTypeUse)
| 986 | } |
| 987 | |
| 988 | fn write_enum_variant(module: &ModuleDef, out: &mut Indenter, ident: &Identifier, ty: &AlgebraicTypeUse) { |
| 989 | let name = ident.deref().to_case(Case::Pascal); |
| 990 | write!(out, "{name}"); |
| 991 | |
| 992 | // If the contained type is the unit type, i.e. this variant has no members, |
| 993 | // write it without parens or braces, like |
| 994 | // ``` |
| 995 | // Foo, |
| 996 | // ``` |
| 997 | if !matches!(ty, AlgebraicTypeUse::Unit) { |
| 998 | // If the contained type is not a product, i.e. this variant has a single |
| 999 | // member, write it tuple-style, with parens. |
| 1000 | write!(out, "("); |
| 1001 | write_type(module, out, ty).unwrap(); |
| 1002 | write!(out, ")"); |
| 1003 | } |
| 1004 | writeln!(out, ","); |
| 1005 | } |
| 1006 | |
| 1007 | fn write_struct_type_fields_in_braces( |
| 1008 | module: &ModuleDef, |
no test coverage detected
searching dependent graphs…