mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[NFC] CSApply: Introduce a generalized routine for building single curry thunk bodies
This commit is contained in:
@@ -7533,6 +7533,18 @@ ParameterList *swift::getParameterList(ValueDecl *source) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ParameterList *swift::getParameterList(DeclContext *source) {
|
||||
if (auto *D = source->getAsDecl()) {
|
||||
if (auto *VD = dyn_cast<ValueDecl>(D)) {
|
||||
return getParameterList(VD);
|
||||
}
|
||||
} else if (auto *CE = dyn_cast<AbstractClosureExpr>(source)) {
|
||||
return CE->getParameters();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const ParamDecl *swift::getParameterAt(const ValueDecl *source,
|
||||
unsigned index) {
|
||||
if (auto *params = getParameterList(const_cast<ValueDecl *>(source))) {
|
||||
|
||||
Reference in New Issue
Block a user