Kebab-case Go name for the type a variant case dispatches against in a type-switch.
(variant_name: &str, case: &Case, resolve: &Resolve)
| 43 | /// Kebab-case Go name for the type a variant case dispatches against in a |
| 44 | /// type-switch. |
| 45 | pub fn case_dispatch_name(variant_name: &str, case: &Case, resolve: &Resolve) -> String { |
| 46 | match case_dispatch_kind(case, resolve) { |
| 47 | CaseDispatchKind::DirectRecord => match case.ty { |
| 48 | Some(Type::Id(payload_id)) => qualified_type_name(payload_id, resolve), |
| 49 | _ => unreachable!("DirectRecord requires a Type::Id payload"), |
| 50 | }, |
| 51 | CaseDispatchKind::Wrapped => format!("{variant_name}-{}", case.name), |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | /// Returns a globally-unique kebab-case name suitable for deriving a Go |
| 56 | /// identifier from a WIT type. WIT lets two interfaces declare types of |
no test coverage detected