File tree Expand file tree Collapse file tree 3 files changed +12
-11
lines changed
SwiftCompilerSources/Sources/SIL Expand file tree Collapse file tree 3 files changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -14,8 +14,11 @@ import AST
14
14
import SILBridging
15
15
16
16
extension CanonicalType {
17
- var objectType : Type { BridgedType . createObjectType ( bridged) . type }
18
- var addressType : Type { BridgedType . createAddressType ( bridged) . type }
17
+ // This can yield nil if the AST type is not a lowered type.
18
+ // For example, if the AST type is a `AnyFunctionType` for which the lowered type would be a `SILFunctionType`.
19
+ public var silType : Type ? {
20
+ BridgedType . createSILType ( bridged) . typeOrNil
21
+ }
19
22
}
20
23
21
24
extension Decl {
@@ -30,7 +33,7 @@ extension NominalTypeDecl {
30
33
31
34
extension ClassDecl {
32
35
public var superClassType : Type ? {
33
- self . superClass? . canonical. objectType
36
+ self . superClass? . canonical. silType!
34
37
}
35
38
}
36
39
Original file line number Diff line number Diff line change @@ -245,8 +245,7 @@ struct BridgedType {
245
245
BRIDGED_INLINE swift::SILType unbridged () const ;
246
246
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedCanType getCanType () const ;
247
247
248
- static SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedType createObjectType (BridgedCanType canTy);
249
- static SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedType createAddressType (BridgedCanType canTy);
248
+ static SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedType createSILType (BridgedCanType canTy);
250
249
BRIDGED_INLINE BridgedOwnedString getDebugDescription () const ;
251
250
BRIDGED_INLINE bool isNull () const ;
252
251
BRIDGED_INLINE bool isAddress () const ;
Original file line number Diff line number Diff line change @@ -284,12 +284,11 @@ BridgedType::EnumElementIterator BridgedType::EnumElementIterator::getNext() con
284
284
return bridge (std::next (unbridge (*this )));
285
285
}
286
286
287
- BridgedType BridgedType::createObjectType (BridgedCanType canTy) {
288
- return swift::SILType::getPrimitiveObjectType (canTy.unbridged ());
289
- }
290
-
291
- BridgedType BridgedType::createAddressType (BridgedCanType canTy) {
292
- return swift::SILType::getPrimitiveAddressType (canTy.unbridged ());
287
+ BridgedType BridgedType::createSILType (BridgedCanType canTy) {
288
+ auto ty = canTy.unbridged ();
289
+ if (ty->isLegalSILType ())
290
+ return swift::SILType::getPrimitiveObjectType (ty);
291
+ return swift::SILType ();
293
292
}
294
293
295
294
BridgedOwnedString BridgedType::getDebugDescription () const {
You can’t perform that action at this time.
0 commit comments