@@ -261,28 +261,6 @@ static llvm::Value *bindWitnessTableAtIndex(IRGenFunction &IGF,
261
261
return wtable;
262
262
}
263
263
264
- struct OpenedElementContext {
265
- GenericEnvironment *environment;
266
- CanGenericSignature signature;
267
-
268
- static OpenedElementContext
269
- createForPackExpansion (IRGenFunction &IGF, CanPackExpansionType expansionTy) {
270
- // Get the outer generic signature and environment.
271
- auto *genericEnv = cast<ArchetypeType>(expansionTy.getCountType ())
272
- ->getGenericEnvironment ();
273
- auto subMap = genericEnv->getForwardingSubstitutionMap ();
274
-
275
- auto genericSig = genericEnv->getGenericSignature ().getCanonicalSignature ();
276
- // Create an opened element signature and environment.
277
- auto elementSig = IGF.IGM .Context .getOpenedElementSignature (
278
- genericSig, expansionTy.getCountType ());
279
- auto *elementEnv = GenericEnvironment::forOpenedElement (
280
- elementSig, UUID::fromTime (), expansionTy.getCountType (), subMap);
281
-
282
- return {elementEnv, elementSig};
283
- }
284
- };
285
-
286
264
static void bindElementSignatureRequirementsAtIndex (
287
265
IRGenFunction &IGF, OpenedElementContext const &context, llvm::Value *index,
288
266
DynamicMetadataRequest request) {
@@ -417,7 +395,7 @@ static void emitPackExpansionMetadataPack(IRGenFunction &IGF, Address pack,
417
395
emitPackExpansionPack (
418
396
IGF, pack, expansionTy, dynamicIndex, dynamicLength, [&](auto *index) {
419
397
auto context =
420
- OpenedElementContext::createForPackExpansion (IGF, expansionTy);
398
+ OpenedElementContext::createForContextualExpansion (IGF. IGM . Context , expansionTy);
421
399
auto patternTy = expansionTy.getPatternType ();
422
400
return emitPackExpansionElementMetadata (IGF, context, patternTy, index,
423
401
request);
@@ -544,7 +522,7 @@ static void emitPackExpansionWitnessTablePack(
544
522
IGF, pack, expansionTy, dynamicIndex, dynamicLength, [&](auto *index) {
545
523
llvm::Value *_metadata = nullptr ;
546
524
auto context =
547
- OpenedElementContext::createForPackExpansion (IGF, expansionTy);
525
+ OpenedElementContext::createForContextualExpansion (IGF. IGM . Context , expansionTy);
548
526
auto patternTy = expansionTy.getPatternType ();
549
527
return emitPackExpansionElementWitnessTable (
550
528
IGF, context, patternTy, conformance,
@@ -862,7 +840,7 @@ llvm::Value *irgen::emitTypeMetadataPackElementRef(
862
840
// pack expansion at that index.
863
841
auto *relativeIndex = IGF.Builder .CreateSub (index, lowerBound);
864
842
auto context =
865
- OpenedElementContext::createForPackExpansion (IGF, expansionTy);
843
+ OpenedElementContext::createForContextualExpansion (IGF. IGM . Context , expansionTy);
866
844
auto patternTy = expansionTy.getPatternType ();
867
845
metadata = emitPackExpansionElementMetadata (IGF, context, patternTy,
868
846
relativeIndex, request);
0 commit comments