@@ -433,21 +433,14 @@ tryCastUnwrappingSwiftValueSource(
433
433
const Metadata *&destFailureType, const Metadata *&srcFailureType,
434
434
bool takeOnSuccess, bool mayDeferChecks)
435
435
{
436
- const Metadata *srcInnerType;
437
- const OpaqueValue *srcInnerValue;
438
- if (swift_unboxFromSwiftValueWithType (srcValue,
439
- reinterpret_cast <OpaqueValue *>(&srcInnerValue), &srcInnerType)) {
440
- return DynamicCastResult::SuccessViaCopy;
441
- }
436
+ assert (srcType->getKind () == MetadataKind::Class);
442
437
443
- // Note: We never `take` the contents from a SwiftValue box as
444
- // it might have other references. Instead, let our caller
445
- // destroy the reference if necessary.
446
- return tryCast (
447
- destLocation, destType,
448
- const_cast <OpaqueValue *>(srcInnerValue), srcInnerType,
449
- destFailureType, srcFailureType,
450
- /* takeOnSuccess=*/ false , mayDeferChecks);
438
+ // unboxFromSwiftValueWithType is really just a recursive casting operation...
439
+ if (swift_unboxFromSwiftValueWithType (srcValue, destLocation, destType)) {
440
+ return DynamicCastResult::SuccessViaCopy;
441
+ } else {
442
+ return DynamicCastResult::Failure;
443
+ }
451
444
}
452
445
#endif
453
446
0 commit comments