Skip to content

Commit f8d30ec

Browse files
committed
[NFC] SubscriptDecl: Strip factory constructors out of TypeLocs
1 parent 492156c commit f8d30ec

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

include/swift/AST/Decl.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5611,15 +5611,15 @@ class SubscriptDecl : public GenericContext, public AbstractStorageDecl {
56115611
SubscriptDecl(DeclName Name,
56125612
SourceLoc StaticLoc, StaticSpellingKind StaticSpelling,
56135613
SourceLoc SubscriptLoc, ParameterList *Indices,
5614-
SourceLoc ArrowLoc, TypeLoc ElementTy, DeclContext *Parent,
5614+
SourceLoc ArrowLoc, TypeRepr *ElementTyR, DeclContext *Parent,
56155615
GenericParamList *GenericParams)
56165616
: GenericContext(DeclContextKind::SubscriptDecl, Parent, GenericParams),
56175617
AbstractStorageDecl(DeclKind::Subscript,
56185618
StaticSpelling != StaticSpellingKind::None,
56195619
Parent, Name, SubscriptLoc,
56205620
/*will be overwritten*/ StorageIsNotMutable),
56215621
StaticLoc(StaticLoc), ArrowLoc(ArrowLoc),
5622-
Indices(nullptr), ElementTy(ElementTy) {
5622+
Indices(nullptr), ElementTy(ElementTyR) {
56235623
Bits.SubscriptDecl.StaticSpelling = static_cast<unsigned>(StaticSpelling);
56245624
setIndices(Indices);
56255625
}
@@ -5635,7 +5635,7 @@ class SubscriptDecl : public GenericContext, public AbstractStorageDecl {
56355635
SourceLoc StaticLoc,
56365636
StaticSpellingKind StaticSpelling,
56375637
SourceLoc SubscriptLoc, ParameterList *Indices,
5638-
SourceLoc ArrowLoc, TypeLoc ElementTy,
5638+
SourceLoc ArrowLoc, TypeRepr *ElementTyR,
56395639
DeclContext *Parent,
56405640
GenericParamList *GenericParams);
56415641

lib/AST/Decl.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6597,7 +6597,7 @@ SubscriptDecl::createDeserialized(ASTContext &Context, DeclName Name,
65976597
assert(ElementTy && "Deserialized element type must not be null");
65986598
auto *const SD = new (Context)
65996599
SubscriptDecl(Name, SourceLoc(), StaticSpelling, SourceLoc(), nullptr,
6600-
SourceLoc(), TypeLoc(), Parent, GenericParams);
6600+
SourceLoc(), /*ElementTyR=*/nullptr, Parent, GenericParams);
66016601
SD->setElementInterfaceType(ElementTy);
66026602
return SD;
66036603
}
@@ -6607,11 +6607,12 @@ SubscriptDecl *SubscriptDecl::create(ASTContext &Context, DeclName Name,
66076607
StaticSpellingKind StaticSpelling,
66086608
SourceLoc SubscriptLoc,
66096609
ParameterList *Indices, SourceLoc ArrowLoc,
6610-
TypeLoc ElementTy, DeclContext *Parent,
6610+
TypeRepr *ElementTyR, DeclContext *Parent,
66116611
GenericParamList *GenericParams) {
6612+
assert(ElementTyR);
66126613
auto *const SD = new (Context)
66136614
SubscriptDecl(Name, StaticLoc, StaticSpelling, SubscriptLoc, Indices,
6614-
ArrowLoc, ElementTy, Parent, GenericParams);
6615+
ArrowLoc, ElementTyR, Parent, GenericParams);
66156616
return SD;
66166617
}
66176618

@@ -6627,7 +6628,7 @@ SubscriptDecl *SubscriptDecl::createImported(ASTContext &Context, DeclName Name,
66276628

66286629
auto *const SD = ::new (DeclPtr)
66296630
SubscriptDecl(Name, SourceLoc(), StaticSpellingKind::None, SubscriptLoc,
6630-
Indices, ArrowLoc, TypeLoc(), Parent,
6631+
Indices, ArrowLoc, /*ElementTyR=*/nullptr, Parent,
66316632
/*GenericParams=*/nullptr);
66326633
SD->setElementInterfaceType(ElementTy);
66336634
SD->setClangNode(ClangN);

0 commit comments

Comments
 (0)