@@ -3210,7 +3210,11 @@ void ArchetypeType::populateNestedTypes() const {
3210
3210
3211
3211
// Record the nested types.
3212
3212
auto mutableThis = const_cast <ArchetypeType *>(this );
3213
- mutableThis->setNestedTypes (mutableThis->getASTContext (), nestedTypes);
3213
+
3214
+ std::sort (nestedTypes.begin (), nestedTypes.end (), OrderArchetypeByName ());
3215
+ auto &Ctx = mutableThis->getASTContext ();
3216
+ mutableThis->NestedTypes = Ctx.AllocateCopy (nestedTypes);
3217
+ mutableThis->Bits .ArchetypeType .ExpandedNestedTypes = true ;
3214
3218
}
3215
3219
3216
3220
Type ArchetypeType::getNestedType (Identifier Name) const {
@@ -3250,28 +3254,11 @@ bool ArchetypeType::hasNestedType(Identifier Name) const {
3250
3254
}
3251
3255
3252
3256
ArrayRef<std::pair<Identifier, Type>>
3253
- ArchetypeType::getAllNestedTypes ( bool resolveTypes ) const {
3257
+ ArchetypeType::getKnownNestedTypes ( ) const {
3254
3258
populateNestedTypes ();
3255
-
3256
- if (resolveTypes) {
3257
- for (auto &nested : NestedTypes) {
3258
- if (!nested.second )
3259
- resolveNestedType (nested);
3260
- }
3261
- }
3262
-
3263
3259
return NestedTypes;
3264
3260
}
3265
3261
3266
- void ArchetypeType::setNestedTypes (
3267
- ASTContext &Ctx,
3268
- ArrayRef<std::pair<Identifier, Type>> Nested) {
3269
- assert (!Bits.ArchetypeType .ExpandedNestedTypes && " Already expanded" );
3270
- NestedTypes = Ctx.AllocateCopy (Nested);
3271
- std::sort (NestedTypes.begin (), NestedTypes.end (), OrderArchetypeByName ());
3272
- Bits.ArchetypeType .ExpandedNestedTypes = true ;
3273
- }
3274
-
3275
3262
void ArchetypeType::registerNestedType (Identifier name, Type nested) {
3276
3263
populateNestedTypes ();
3277
3264
0 commit comments