@@ -2224,24 +2224,29 @@ TypeExpr *TypeExpr::createForMemberDecl(DeclNameLoc ParentNameLoc,
2224
2224
return new (C) TypeExpr (TR);
2225
2225
}
2226
2226
2227
- TypeExpr *TypeExpr::createForMemberDecl (DeclRefTypeRepr *ParentTR,
2228
- DeclNameLoc NameLoc, TypeDecl *Decl) {
2227
+ TypeExpr *TypeExpr::createForMemberDecl (TypeRepr *ParentTR, DeclNameLoc NameLoc ,
2228
+ TypeDecl *Decl) {
2229
2229
ASTContext &C = Decl->getASTContext ();
2230
2230
2231
- // Create a new list of components.
2232
- SmallVector<IdentTypeRepr *, 2 > Components;
2233
- if (auto *MemberTR = dyn_cast<MemberTypeRepr>(ParentTR)) {
2234
- auto MemberComps = MemberTR->getMemberComponents ();
2235
- Components.append (MemberComps.begin (), MemberComps.end ());
2236
- }
2237
-
2238
2231
// Add a new component for the member we just found.
2239
2232
auto *NewComp = new (C) SimpleIdentTypeRepr (NameLoc, Decl->createNameRef ());
2240
2233
NewComp->setValue (Decl, nullptr );
2241
- Components.push_back (NewComp);
2242
2234
2243
- auto *TR =
2244
- MemberTypeRepr::create (C, ParentTR->getBaseComponent (), Components);
2235
+ TypeRepr *TR = nullptr ;
2236
+ if (auto *DeclRefTR = dyn_cast<DeclRefTypeRepr>(ParentTR)) {
2237
+ // Create a new list of components.
2238
+ SmallVector<IdentTypeRepr *, 4 > Components;
2239
+ if (auto *MemberTR = dyn_cast<MemberTypeRepr>(ParentTR)) {
2240
+ auto MemberComps = MemberTR->getMemberComponents ();
2241
+ Components.append (MemberComps.begin (), MemberComps.end ());
2242
+ }
2243
+
2244
+ Components.push_back (NewComp);
2245
+ TR = MemberTypeRepr::create (C, DeclRefTR->getBaseComponent (), Components);
2246
+ } else {
2247
+ TR = MemberTypeRepr::create (C, ParentTR, NewComp);
2248
+ }
2249
+
2245
2250
return new (C) TypeExpr (TR);
2246
2251
}
2247
2252
0 commit comments