@@ -306,23 +306,12 @@ void swift_MagicMirrorData_summary(const Metadata *T, String *result) {
306
306
307
307
static std::tuple<const Metadata *, const OpaqueValue *>
308
308
getReflectableConformance (const Metadata *T, const OpaqueValue *Value) {
309
- recur:
310
309
// If the value is an existential container, look through it to reflect the
311
310
// contained value.
312
- switch (T->getKind ()) {
313
- case MetadataKind::Tuple:
314
- case MetadataKind::Struct:
315
- case MetadataKind::ForeignClass:
316
- case MetadataKind::ObjCClassWrapper:
317
- case MetadataKind::Class :
318
- case MetadataKind::Opaque:
319
- case MetadataKind::Enum:
320
- case MetadataKind::Optional:
321
- case MetadataKind::Function:
322
- case MetadataKind::Metatype:
323
- break ;
324
-
325
- case MetadataKind::Existential: {
311
+ // TODO: Should look through existential metatypes too, but it doesn't
312
+ // really matter yet since we don't have any special mirror behavior for
313
+ // concrete metatypes yet.
314
+ while (T->getKind () == MetadataKind::Existential) {
326
315
auto existential
327
316
= static_cast <const ExistentialTypeMetadata *>(T);
328
317
@@ -331,22 +320,8 @@ void swift_MagicMirrorData_summary(const Metadata *T, String *result) {
331
320
Value = existential->projectValue (Value);
332
321
333
322
// Existential containers can end up nested in some cases due to generic
334
- // abstraction barriers. Recur in case we have a nested existential.
335
- goto recur;
323
+ // abstraction barriers. Repeat in case we have a nested existential.
336
324
}
337
- case MetadataKind::ExistentialMetatype:
338
- // TODO: Should look through existential metatypes too, but it doesn't
339
- // really matter yet since we don't have any special mirror behavior for
340
- // concrete metatypes yet.
341
- break ;
342
-
343
- // Types can't have these kinds.
344
- case MetadataKind::HeapLocalVariable:
345
- case MetadataKind::HeapGenericLocalVariable:
346
- case MetadataKind::ErrorObject:
347
- swift::crash (" Swift mirror lookup failure" );
348
- }
349
-
350
325
return std::make_tuple (T, Value);
351
326
}
352
327
0 commit comments