( context: &mut Context<'a, 'b>, generator: &mut G, conversion: &'b StringToFormatString<'a>, debug_location: DebugLocation, )
| 1170 | specialization_index: enum_specialization_index, |
| 1171 | .. |
| 1172 | } = entry.kind |
| 1173 | else { |
| 1174 | unreachable!("{:?}", entry.kind); |
| 1175 | }; |
| 1176 | |
| 1177 | Some(generator.generate_check_is(context, value, enum_shape_index, enum_specialization_index, &check_is, debug_location)) |
| 1178 | } |
| 1179 | |
| 1180 | fn generate_verify_as<'a, 'b, G: Generator>( |
| 1181 | context: &mut Context<'a, 'b>, |
| 1182 | generator: &mut G, |
| 1183 | verify_as: &'b VerifyAs<'a>, |
| 1184 | debug_location: DebugLocation, |
| 1185 | ) -> Option<G::Binding> { |
| 1186 | // Must produce a binding as an enum definitely at least has the tag |
| 1187 | let left = generate_expression(context, generator, &verify_as.left).unwrap(); |
| 1188 | |
| 1189 | let left_type_id = context.specialize_type_id(verify_as.left.type_id); |
| 1190 | let entry = context.type_store.type_entries.get(left_type_id); |
| 1191 | let TypeEntryKind::UserType { |
| 1192 | shape_index: enum_shape_index, |
| 1193 | specialization_index: enum_specialization_index, |
| 1194 | .. |
| 1195 | } = entry.kind |
| 1196 | else { |
| 1197 | unreachable!("{:?}", entry.kind); |
| 1198 | }; |
| 1199 | |
| 1200 | let start_index = context.defer_stack.len(); |
| 1201 | context.yield_target_stack.push(DeferMarker { start_index }); |
| 1202 | |
| 1203 | let result = |
| 1204 | generator.generate_verify_as(context, left, enum_shape_index, enum_specialization_index, &verify_as, debug_location); |
| 1205 | |
| 1206 | context.yield_target_stack.pop(); |
| 1207 | result |
no test coverage detected