mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[AST] Rename SubscriptDecl::create -> createParsed
And generate the DeclName using the argument labels on the ParameterList.
This commit is contained in:
@@ -6843,13 +6843,12 @@ public:
|
||||
Type ElementTy, DeclContext *Parent,
|
||||
GenericParamList *GenericParams);
|
||||
|
||||
static SubscriptDecl *create(ASTContext &Context, DeclName Name,
|
||||
SourceLoc StaticLoc,
|
||||
StaticSpellingKind StaticSpelling,
|
||||
SourceLoc SubscriptLoc, ParameterList *Indices,
|
||||
SourceLoc ArrowLoc, TypeRepr *ElementTyR,
|
||||
DeclContext *Parent,
|
||||
GenericParamList *GenericParams);
|
||||
static SubscriptDecl *createParsed(ASTContext &Context, SourceLoc StaticLoc,
|
||||
StaticSpellingKind StaticSpelling,
|
||||
SourceLoc SubscriptLoc,
|
||||
ParameterList *Indices, SourceLoc ArrowLoc,
|
||||
TypeRepr *ElementTyR, DeclContext *Parent,
|
||||
GenericParamList *GenericParams);
|
||||
|
||||
static SubscriptDecl *create(ASTContext &Context, DeclName Name,
|
||||
SourceLoc StaticLoc,
|
||||
|
||||
@@ -8812,14 +8812,13 @@ SubscriptDecl::createDeserialized(ASTContext &Context, DeclName Name,
|
||||
return SD;
|
||||
}
|
||||
|
||||
SubscriptDecl *SubscriptDecl::create(ASTContext &Context, DeclName Name,
|
||||
SourceLoc StaticLoc,
|
||||
StaticSpellingKind StaticSpelling,
|
||||
SourceLoc SubscriptLoc,
|
||||
ParameterList *Indices, SourceLoc ArrowLoc,
|
||||
TypeRepr *ElementTyR, DeclContext *Parent,
|
||||
GenericParamList *GenericParams) {
|
||||
SubscriptDecl *SubscriptDecl::createParsed(
|
||||
ASTContext &Context, SourceLoc StaticLoc, StaticSpellingKind StaticSpelling,
|
||||
SourceLoc SubscriptLoc, ParameterList *Indices, SourceLoc ArrowLoc,
|
||||
TypeRepr *ElementTyR, DeclContext *Parent,
|
||||
GenericParamList *GenericParams) {
|
||||
assert(ElementTyR);
|
||||
auto Name = DeclName(Context, DeclBaseName::createSubscript(), Indices);
|
||||
auto *const SD = new (Context)
|
||||
SubscriptDecl(Name, StaticLoc, StaticSpelling, SubscriptLoc, Indices,
|
||||
ArrowLoc, ElementTyR, Parent, GenericParams);
|
||||
|
||||
@@ -9508,10 +9508,9 @@ Parser::parseDeclSubscript(SourceLoc StaticLoc,
|
||||
|
||||
// Parse the parameter list.
|
||||
DefaultArgumentInfo DefaultArgs;
|
||||
SmallVector<Identifier, 4> argumentNames;
|
||||
ParserResult<ParameterList> Indices
|
||||
= parseSingleParameterClause(ParameterContextKind::Subscript,
|
||||
&argumentNames, &DefaultArgs);
|
||||
ParserResult<ParameterList> Indices =
|
||||
parseSingleParameterClause(ParameterContextKind::Subscript,
|
||||
/*argumentNamesOut*/ nullptr, &DefaultArgs);
|
||||
Status |= Indices;
|
||||
if (Status.hasCodeCompletion() && !CodeCompletionCallbacks)
|
||||
return Status;
|
||||
@@ -9554,11 +9553,9 @@ Parser::parseDeclSubscript(SourceLoc StaticLoc,
|
||||
}
|
||||
|
||||
// Build an AST for the subscript declaration.
|
||||
DeclName name = DeclName(Context, DeclBaseName::createSubscript(),
|
||||
argumentNames);
|
||||
auto *const Subscript = SubscriptDecl::create(
|
||||
Context, name, StaticLoc, StaticSpelling, SubscriptLoc, Indices.get(),
|
||||
ArrowLoc, ElementTy.get(), CurDeclContext, GenericParams);
|
||||
auto *const Subscript = SubscriptDecl::createParsed(
|
||||
Context, StaticLoc, StaticSpelling, SubscriptLoc, Indices.get(), ArrowLoc,
|
||||
ElementTy.get(), CurDeclContext, GenericParams);
|
||||
Subscript->getAttrs() = Attributes;
|
||||
|
||||
// Let the source file track the opaque return type mapping, if any.
|
||||
|
||||
Reference in New Issue
Block a user