[AST] Rename SubscriptDecl::create -> createParsed

And generate the DeclName using the argument labels
on the ParameterList.
This commit is contained in:
Hamish Knight
2023-12-15 19:53:52 +00:00
parent 9710a6575d
commit 8fdb48d910
3 changed files with 18 additions and 23 deletions

View File

@@ -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.