@@ -1084,8 +1084,13 @@ class DecodedMetadataBuilder {
1084
1084
genericParamCounts);
1085
1085
bool failed =
1086
1086
_checkGenericRequirements (genericContext->getGenericRequirements (),
1087
- allGenericArgsVec, substitutions,
1088
- substitutions);
1087
+ allGenericArgsVec,
1088
+ [&substitutions](unsigned depth, unsigned index) {
1089
+ return substitutions.getMetadata (depth, index);
1090
+ },
1091
+ [&substitutions](const Metadata *type, unsigned index) {
1092
+ return substitutions.getWitnessTable (type, index);
1093
+ });
1089
1094
if (failed)
1090
1095
return BuiltType ();
1091
1096
@@ -1357,7 +1362,12 @@ swift_getTypeByMangledNameInEnvironment(
1357
1362
llvm::StringRef typeName (typeNameStart, typeNameLength);
1358
1363
SubstGenericParametersFromMetadata substitutions (environment, genericArgs);
1359
1364
return swift_getTypeByMangledName (MetadataState::Complete, typeName,
1360
- substitutions, substitutions).getMetadata ();
1365
+ [&substitutions](unsigned depth, unsigned index) {
1366
+ return substitutions.getMetadata (depth, index);
1367
+ },
1368
+ [&substitutions](const Metadata *type, unsigned index) {
1369
+ return substitutions.getWitnessTable (type, index);
1370
+ }).getMetadata ();
1361
1371
}
1362
1372
1363
1373
SWIFT_CC (swift) SWIFT_RUNTIME_EXPORT
@@ -1370,7 +1380,12 @@ swift_getTypeByMangledNameInContext(
1370
1380
llvm::StringRef typeName (typeNameStart, typeNameLength);
1371
1381
SubstGenericParametersFromMetadata substitutions (context, genericArgs);
1372
1382
return swift_getTypeByMangledName (MetadataState::Complete, typeName,
1373
- substitutions, substitutions).getMetadata ();
1383
+ [&substitutions](unsigned depth, unsigned index) {
1384
+ return substitutions.getMetadata (depth, index);
1385
+ },
1386
+ [&substitutions](const Metadata *type, unsigned index) {
1387
+ return substitutions.getWitnessTable (type, index);
1388
+ }).getMetadata ();
1374
1389
}
1375
1390
1376
1391
// / Demangle a mangled name, but don't allow symbolic references.
@@ -1536,7 +1551,7 @@ void SubstGenericParametersFromMetadata::setup() const {
1536
1551
}
1537
1552
1538
1553
const Metadata *
1539
- SubstGenericParametersFromMetadata::operator () (
1554
+ SubstGenericParametersFromMetadata::getMetadata (
1540
1555
unsigned depth, unsigned index) const {
1541
1556
// On first access, compute the descriptor path.
1542
1557
setup ();
@@ -1577,17 +1592,16 @@ SubstGenericParametersFromMetadata::operator()(
1577
1592
}
1578
1593
1579
1594
const WitnessTable *
1580
- SubstGenericParametersFromMetadata::operator () (const Metadata *type,
1581
- unsigned index) const {
1595
+ SubstGenericParametersFromMetadata::getWitnessTable (const Metadata *type,
1596
+ unsigned index) const {
1582
1597
// On first access, compute the descriptor path.
1583
1598
setup ();
1584
1599
1585
1600
return (const WitnessTable *)genericArgs[index + numKeyGenericParameters];
1586
1601
}
1587
1602
1588
- const Metadata *SubstGenericParametersFromWrittenArgs::operator ()(
1589
- unsigned depth,
1590
- unsigned index) const {
1603
+ const Metadata *SubstGenericParametersFromWrittenArgs::getMetadata (
1604
+ unsigned depth, unsigned index) const {
1591
1605
if (auto flatIndex =
1592
1606
_depthIndexToFlatIndex (depth, index, genericParamCounts)) {
1593
1607
if (*flatIndex < allGenericArgs.size ())
@@ -1598,8 +1612,8 @@ const Metadata *SubstGenericParametersFromWrittenArgs::operator()(
1598
1612
}
1599
1613
1600
1614
const WitnessTable *
1601
- SubstGenericParametersFromWrittenArgs::operator () (const Metadata *type,
1602
- unsigned index) const {
1615
+ SubstGenericParametersFromWrittenArgs::getWitnessTable (const Metadata *type,
1616
+ unsigned index) const {
1603
1617
return nullptr ;
1604
1618
}
1605
1619
@@ -1708,8 +1722,13 @@ void swift::gatherWrittenGenericArgs(
1708
1722
genericParamCounts);
1709
1723
allGenericArgs[*lhsFlatIndex] =
1710
1724
swift_getTypeByMangledName (MetadataState::Abstract,
1711
- req.getMangledTypeName (), substitutions,
1712
- substitutions).getMetadata ();
1725
+ req.getMangledTypeName (),
1726
+ [&substitutions](unsigned depth, unsigned index) {
1727
+ return substitutions.getMetadata (depth, index);
1728
+ },
1729
+ [&substitutions](const Metadata *type, unsigned index) {
1730
+ return substitutions.getWitnessTable (type, index);
1731
+ }).getMetadata ();
1713
1732
continue ;
1714
1733
}
1715
1734
0 commit comments