Skip to content

Commit 4d45588

Browse files
committed
SIL: Add TypeConverter::getSubstitutionMapWithCapturedEnvironments()
1 parent cf27663 commit 4d45588

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

include/swift/SIL/TypeLowering.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,6 +1073,12 @@ class TypeConverter {
10731073
GenericSignatureWithCapturedEnvironments
10741074
getGenericSignatureWithCapturedEnvironments(SILDeclRef constant);
10751075

1076+
/// Get the substitution map for calling a constant.
1077+
SubstitutionMap
1078+
getSubstitutionMapWithCapturedEnvironments(SILDeclRef constant,
1079+
const CaptureInfo &captureInfo,
1080+
SubstitutionMap subs);
1081+
10761082
/// Get the generic environment for a constant.
10771083
GenericEnvironment *getConstantGenericEnvironment(SILDeclRef constant);
10781084

lib/SIL/IR/TypeLowering.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4110,6 +4110,21 @@ TypeConverter::getGenericSignatureWithCapturedEnvironments(SILDeclRef c) {
41104110
llvm_unreachable("Unhandled SILDeclRefKind in switch.");
41114111
}
41124112

4113+
SubstitutionMap
4114+
TypeConverter::getSubstitutionMapWithCapturedEnvironments(
4115+
SILDeclRef constant, const CaptureInfo &captureInfo,
4116+
SubstitutionMap subs) {
4117+
auto sig = getGenericSignatureWithCapturedEnvironments(constant);
4118+
if (!sig.genericSig) {
4119+
assert(!sig.baseGenericSig);
4120+
assert(sig.capturedEnvs.empty());
4121+
return SubstitutionMap();
4122+
}
4123+
4124+
return buildSubstitutionMapWithCapturedEnvironments(
4125+
subs, sig.genericSig, sig.capturedEnvs);
4126+
}
4127+
41134128
GenericEnvironment *
41144129
TypeConverter::getConstantGenericEnvironment(SILDeclRef c) {
41154130
return getGenericSignatureWithCapturedEnvironments(c)

0 commit comments

Comments
 (0)