mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SILGen: Implement native-to-foreign thunks for async methods.
Bridging an async Swift method back to an ObjC completion-handler-based API requires that the ObjC thunk spawn a task on which to execute the Swift async API and pass its results back on to the completion handler.
This commit is contained in:
@@ -1230,3 +1230,13 @@ bool SILDeclRef::isDynamicallyReplaceable() const {
|
||||
// enabled.
|
||||
return decl->shouldUseNativeMethodReplacement();
|
||||
}
|
||||
|
||||
bool SILDeclRef::hasAsync() const {
|
||||
if (hasDecl()) {
|
||||
if (auto afd = dyn_cast<AbstractFunctionDecl>(getDecl())) {
|
||||
return afd->hasAsync();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return getAbstractClosureExpr()->isBodyAsync();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user