Skip to content

Commit fd17b7e

Browse files
committed
Swift AST: add GenericSignature.mapTypeIntoContext
1 parent 9aa61e1 commit fd17b7e

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

SwiftCompilerSources/Sources/AST/GenericSignature.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,8 @@ public struct GenericSignature: CustomStringConvertible, NoReflectionChildren {
2929
public var genericParameters: TypeArray {
3030
TypeArray(bridged: bridged.getGenericParams())
3131
}
32+
33+
public func mapTypeIntoContext(_ type: Type) -> Type {
34+
Type(bridged: bridged.mapTypeIntoContext(type.bridged))
35+
}
3236
}

include/swift/AST/ASTBridging.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3189,6 +3189,7 @@ struct BridgedGenericSignature {
31893189
BRIDGED_INLINE swift::GenericSignature unbridged() const;
31903190
BridgedOwnedString getDebugDescription() const;
31913191
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedASTTypeArray getGenericParams() const;
3192+
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedASTType mapTypeIntoContext(BridgedASTType type) const;
31923193
};
31933194

31943195
struct BridgedFingerprint {

include/swift/AST/ASTBridgingImpl.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "swift/AST/Decl.h"
2121
#include "swift/AST/Expr.h"
2222
#include "swift/AST/GenericSignature.h"
23+
#include "swift/AST/GenericEnvironment.h"
2324
#include "swift/AST/IfConfigClauseRangeInfo.h"
2425
#include "swift/AST/MacroDeclaration.h"
2526
#include "swift/AST/ProtocolConformance.h"
@@ -823,6 +824,10 @@ BridgedASTTypeArray BridgedGenericSignature::getGenericParams() const {
823824
return {unbridged().getGenericParams()};
824825
}
825826

827+
BridgedASTType BridgedGenericSignature::mapTypeIntoContext(BridgedASTType type) const {
828+
return {unbridged().getGenericEnvironment()->mapTypeIntoContext(type.unbridged()).getPointer()};
829+
}
830+
826831
//===----------------------------------------------------------------------===//
827832
// MARK: BridgedFingerprint
828833
//===----------------------------------------------------------------------===//

0 commit comments

Comments
 (0)