[NFC] Simplify some code using ValueDecl::getParameterList

This commit is contained in:
Anthony Latsis
2025-03-19 18:55:47 +00:00
parent 182bfc6c79
commit 487d3b4ae7
3 changed files with 10 additions and 11 deletions

View File

@@ -3710,13 +3710,14 @@ createOpaqueParameterGenericParams(GenericContext *genericContext, GenericParamL
return { };
// Functions, initializers, and subscripts can contain opaque parameters.
ParameterList *params = nullptr;
if (auto func = dyn_cast<AbstractFunctionDecl>(value))
params = func->getParameters();
else if (auto subscript = dyn_cast<SubscriptDecl>(value))
params = subscript->getIndices();
else
// FIXME: What's wrong with allowing them in macro decls?
if (isa<MacroDecl>(value)) {
return { };
}
auto *params = value->getParameterList();
if (!params) {
return {};
}
// Look for parameters that have "some" types in them.
unsigned index = parsedGenericParams ? parsedGenericParams->size() : 0;