File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -1076,6 +1076,13 @@ class TypeConverter {
1076
1076
// / Get the generic environment for a constant.
1077
1077
GenericEnvironment *getConstantGenericEnvironment (SILDeclRef constant);
1078
1078
1079
+ // / Get the generic environment for SILGen to use. The substitution map
1080
+ // / sends the generic parameters of the function's interface type into
1081
+ // / archetypes, which will either be primary archetypes from this
1082
+ // / environment, or local archetypes captured by this function.
1083
+ std::pair<GenericEnvironment *, SubstitutionMap>
1084
+ getForwardingSubstitutionsForLowering (SILDeclRef constant);
1085
+
1079
1086
// / Returns the SIL type of a constant reference.
1080
1087
SILType getConstantType (TypeExpansionContext context, SILDeclRef constant) {
1081
1088
return getConstantInfo (context, constant).getSILType ();
Original file line number Diff line number Diff line change @@ -4086,6 +4086,28 @@ TypeConverter::getConstantGenericEnvironment(SILDeclRef c) {
4086
4086
.genericSig .getGenericEnvironment ();
4087
4087
}
4088
4088
4089
+ std::pair<GenericEnvironment *, SubstitutionMap>
4090
+ TypeConverter::getForwardingSubstitutionsForLowering (SILDeclRef constant) {
4091
+ auto sig = getGenericSignatureWithCapturedEnvironments (constant);
4092
+
4093
+ GenericEnvironment *genericEnv = nullptr ;
4094
+ SubstitutionMap forwardingSubs;
4095
+
4096
+ if (sig.baseGenericSig ) {
4097
+ genericEnv = sig.baseGenericSig .getGenericEnvironment ();
4098
+ forwardingSubs = genericEnv->getForwardingSubstitutionMap ();
4099
+ }
4100
+
4101
+ if (!sig.capturedEnvs .empty ()) {
4102
+ assert (sig.genericSig && !sig.genericSig ->isEqual (sig.baseGenericSig ));
4103
+
4104
+ forwardingSubs = buildSubstitutionMapWithCapturedEnvironments (
4105
+ forwardingSubs, sig.genericSig , sig.capturedEnvs );
4106
+ }
4107
+
4108
+ return std::make_pair (genericEnv, forwardingSubs);
4109
+ }
4110
+
4089
4111
SILType TypeConverter::getSubstitutedStorageType (TypeExpansionContext context,
4090
4112
AbstractStorageDecl *value,
4091
4113
Type lvalueType) {
You can’t perform that action at this time.
0 commit comments