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
1414import SILBridging
1515
1616extension 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+ }
1922}
2023
2124extension Decl {
@@ -30,7 +33,7 @@ extension NominalTypeDecl {
3033
3134extension ClassDecl {
3235 public var superClassType : Type ? {
33- self . superClass? . canonical. objectType
36+ self . superClass? . canonical. silType!
3437 }
3538}
3639
Original file line number Diff line number Diff line change @@ -245,8 +245,7 @@ struct BridgedType {
245245 BRIDGED_INLINE swift::SILType unbridged () const ;
246246 SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedCanType getCanType () const ;
247247
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);
250249 BRIDGED_INLINE BridgedOwnedString getDebugDescription () const ;
251250 BRIDGED_INLINE bool isNull () const ;
252251 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
284284 return bridge (std::next (unbridge (*this )));
285285}
286286
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 ();
293292}
294293
295294BridgedOwnedString BridgedType::getDebugDescription () const {
You can’t perform that action at this time.
0 commit comments