@@ -37,6 +37,9 @@ class Conversion {
37
37
// / implicit force cast.
38
38
ForceAndBridgeToObjC,
39
39
40
+ // / Force an optional value.
41
+ ForceOptional,
42
+
40
43
// / A bridging conversion from a foreign type.
41
44
BridgeFromObjC,
42
45
@@ -61,6 +64,7 @@ class Conversion {
61
64
switch (kind) {
62
65
case BridgeToObjC:
63
66
case ForceAndBridgeToObjC:
67
+ case ForceOptional:
64
68
case BridgeFromObjC:
65
69
case BridgeResultFromObjC:
66
70
case AnyErasure:
@@ -80,6 +84,7 @@ class Conversion {
80
84
81
85
case BridgeToObjC:
82
86
case ForceAndBridgeToObjC:
87
+ case ForceOptional:
83
88
case BridgeFromObjC:
84
89
case BridgeResultFromObjC:
85
90
case AnyErasure:
@@ -114,6 +119,7 @@ class Conversion {
114
119
switch (kind) {
115
120
case BridgeToObjC:
116
121
case ForceAndBridgeToObjC:
122
+ case ForceOptional:
117
123
case BridgeFromObjC:
118
124
case BridgeResultFromObjC:
119
125
case AnyErasure:
@@ -238,6 +244,24 @@ class Conversion {
238
244
return Types.get <BridgingTypes>(Kind).LoweredResultType ;
239
245
}
240
246
247
+ CanType getSourceType () const {
248
+ if (isBridging ())
249
+ return getBridgingSourceType ();
250
+ return getReabstractionInputSubstType ();
251
+ }
252
+
253
+ CanType getResultType () const {
254
+ if (isBridging ())
255
+ return getBridgingResultType ();
256
+ return getReabstractionOutputSubstType ();
257
+ }
258
+
259
+ SILType getLoweredResultType () const {
260
+ if (isBridging ())
261
+ return getBridgingLoweredResultType ();
262
+ return getReabstractionOutputLoweredType ();
263
+ }
264
+
241
265
ManagedValue emit (SILGenFunction &SGF, SILLocation loc,
242
266
ManagedValue source, SGFContext ctxt) const ;
243
267
0 commit comments