mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Runtime: Implement dynamic cast bridging from NSError to bridged error enums.
This allows ErrorTypes referencing Cocoa NSErrors to be pattern-matched against our bridged enums, at least dynamically. (The compiler still doesn't understand these bridging conversions yet.) Swift SVN r26839
This commit is contained in:
@@ -131,6 +131,18 @@ extern "C" void swift_getErrorValue(const SwiftError *errorObject,
|
||||
void **scratch,
|
||||
ErrorValueResult *out);
|
||||
|
||||
#if SWIFT_OBJC_INTEROP
|
||||
/// Attempt to dynamically cast an NSError instance to a Swift ErrorType
|
||||
/// implementation using the _ObjectiveCBridgeableErrorType protocol.
|
||||
///
|
||||
/// srcType must be some kind of class metadata.
|
||||
bool tryDynamicCastNSErrorToValue(OpaqueValue *dest,
|
||||
OpaqueValue *src,
|
||||
const Metadata *srcType,
|
||||
const Metadata *destType,
|
||||
DynamicCastFlags flags);
|
||||
#endif
|
||||
|
||||
} // namespace swift
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user