Commit Graph

56 Commits

Author SHA1 Message Date
Joe Groff
b2cb75ad30 Runtime: Add a 'swift_becomeNSError' entry point to coerce an ErrorType box to an NSError instance.
If the NSError part of the box hasn't been initialized yet, fill it in with the domain and code of the contained value. This will allow us to efficiently turn ErrorType values into NSErrors, either for bridging or for coercion purposes.

Swift SVN r26958
2015-04-03 22:16:52 +00:00
Joe Groff
72643fd774 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
2015-04-02 00:19:30 +00:00
Joe Groff
5f676656a0 Runtime: Fill in the hooks to be able to use an NSError as an ErrorType.
Swift SVN r26702
2015-03-29 15:44:35 +00:00
Joe Groff
89e0fbf7ff Runtime: Support casting into and out of ErrorType boxes.
Swift SVN r26619
2015-03-27 02:09:49 +00:00
Joe Groff
b7f84a68d7 Runtime: Allocate Swift errors as an NSError subclass.
After some more discussion with John, we decided that subclassing is the only realistic option, at least until we eventually are able to integrate with the OS. Switch things around to allocate Swift error boxes as an ObjC subclass that contains the error value instead of trying to game it as a CFError.

Swift SVN r26562
2015-03-25 23:02:57 +00:00
Joe Groff
668928cc83 Runtime: Handle ErrorType's layout in ExistentialTypeMetadata accessors.
Teach ExistentialTypeMetadata how to project out the value pointer, type metadata, and protocol witness table from ErrorType containers. NFC yet; the dynamic casting and reflection machinery needs further work to correctly handle ErrorType boxes.

Swift SVN r26509
2015-03-25 00:56:16 +00:00