mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
AST: add Type.interfaceTypeOfArchetype and some related APIs
This commit is contained in:
@@ -50,6 +50,8 @@ public struct Type: TypeProperties, CustomStringConvertible, NoReflectionChildre
|
|||||||
|
|
||||||
public var staticTypeOfDynamicSelf: Type { Type(bridged: bridged.getStaticTypeOfDynamicSelf()) }
|
public var staticTypeOfDynamicSelf: Type { Type(bridged: bridged.getStaticTypeOfDynamicSelf()) }
|
||||||
|
|
||||||
|
public var interfaceTypeOfArchetype: Type { Type(bridged: bridged.getInterfaceTypeOfArchetype()) }
|
||||||
|
|
||||||
public var superClassType: Type? {
|
public var superClassType: Type? {
|
||||||
precondition(isClass)
|
precondition(isClass)
|
||||||
let bridgedSuperClassTy = bridged.getSuperClassType()
|
let bridgedSuperClassTy = bridged.getSuperClassType()
|
||||||
@@ -141,6 +143,8 @@ extension TypeProperties {
|
|||||||
public var isArchetype: Bool { rawType.bridged.isArchetype() }
|
public var isArchetype: Bool { rawType.bridged.isArchetype() }
|
||||||
public var isExistentialArchetype: Bool { rawType.bridged.isExistentialArchetype() }
|
public var isExistentialArchetype: Bool { rawType.bridged.isExistentialArchetype() }
|
||||||
public var isExistentialArchetypeWithError: Bool { rawType.bridged.isExistentialArchetypeWithError() }
|
public var isExistentialArchetypeWithError: Bool { rawType.bridged.isExistentialArchetypeWithError() }
|
||||||
|
public var isRootArchetype: Bool { rawType.interfaceTypeOfArchetype.isGenericTypeParameter }
|
||||||
|
public var isRootExistentialArchetype: Bool { isExistentialArchetype && isRootArchetype }
|
||||||
public var isExistential: Bool { rawType.bridged.isExistential() }
|
public var isExistential: Bool { rawType.bridged.isExistential() }
|
||||||
public var isClassExistential: Bool { rawType.bridged.isClassExistential() }
|
public var isClassExistential: Bool { rawType.bridged.isClassExistential() }
|
||||||
public var isGenericTypeParameter: Bool { rawType.bridged.isGenericTypeParam() }
|
public var isGenericTypeParameter: Bool { rawType.bridged.isGenericTypeParam() }
|
||||||
|
|||||||
@@ -3133,6 +3133,7 @@ struct BridgedASTType {
|
|||||||
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE OptionalBridgedDeclObj getAnyNominal() const;
|
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE OptionalBridgedDeclObj getAnyNominal() const;
|
||||||
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedASTType getInstanceTypeOfMetatype() const;
|
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedASTType getInstanceTypeOfMetatype() const;
|
||||||
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedASTType getStaticTypeOfDynamicSelf() const;
|
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedASTType getStaticTypeOfDynamicSelf() const;
|
||||||
|
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedASTType getInterfaceTypeOfArchetype() const;
|
||||||
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedASTType getSuperClassType() const;
|
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedASTType getSuperClassType() const;
|
||||||
BRIDGED_INLINE MetatypeRepresentation getRepresentationOfMetatype() const;
|
BRIDGED_INLINE MetatypeRepresentation getRepresentationOfMetatype() const;
|
||||||
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedSubstitutionMap getContextSubstitutionMap() const;
|
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedSubstitutionMap getContextSubstitutionMap() const;
|
||||||
|
|||||||
@@ -567,6 +567,10 @@ BridgedASTType BridgedASTType::getStaticTypeOfDynamicSelf() const {
|
|||||||
return {unbridged()->getAs<swift::DynamicSelfType>()->getSelfType().getPointer()};
|
return {unbridged()->getAs<swift::DynamicSelfType>()->getSelfType().getPointer()};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BridgedASTType BridgedASTType::getInterfaceTypeOfArchetype() const {
|
||||||
|
return {unbridged()->getAs<swift::ArchetypeType>()->getInterfaceType().getPointer()};
|
||||||
|
}
|
||||||
|
|
||||||
BridgedASTType BridgedASTType::getSuperClassType() const {
|
BridgedASTType BridgedASTType::getSuperClassType() const {
|
||||||
return {unbridged()->getSuperclass().getPointer()};
|
return {unbridged()->getSuperclass().getPointer()};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user