mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Refactor and generalize distributed actor transport SIL generation.
Refactor the code that generates SIL to call into the distributed actor transport to eliminate duplication and better cope with concrete actor transports. Centralize the knowledge of which actor transport is used with a given distributed actor type.
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
#include "DerivedConformances.h"
|
||||
#include "TypeChecker.h"
|
||||
#include "TypeCheckConcurrency.h"
|
||||
#include "TypeCheckDistributed.h"
|
||||
#include "swift/AST/NameLookupRequests.h"
|
||||
#include "swift/AST/ParameterList.h"
|
||||
|
||||
@@ -29,8 +30,6 @@ bool DerivedConformance::canDeriveDistributedActor(
|
||||
return classDecl && classDecl->isDistributedActor() && dc == nominal;
|
||||
}
|
||||
|
||||
// ==== ------------------------------------------------------------------------
|
||||
|
||||
/******************************************************************************/
|
||||
/******************************* RESOLVE FUNCTION *****************************/
|
||||
/******************************************************************************/
|
||||
@@ -62,8 +61,8 @@ static FuncDecl *deriveDistributedActor_resolve(DerivedConformance &derived) {
|
||||
return param;
|
||||
};
|
||||
|
||||
auto addressType = C.getAnyActorIdentityDecl()->getDeclaredInterfaceType();
|
||||
auto transportType = C.getActorTransportDecl()->getDeclaredInterfaceType();
|
||||
Type addressType = C.getAnyActorIdentityDecl()->getDeclaredInterfaceType();
|
||||
Type transportType = getDistributedActorTransportType(decl);
|
||||
|
||||
// (_ identity: AnyActorIdentity, using transport: ActorTransport)
|
||||
auto *params = ParameterList::create(
|
||||
@@ -137,8 +136,7 @@ static ValueDecl *deriveDistributedActor_actorTransport(
|
||||
// let actorTransport: ActorTransport
|
||||
// ```
|
||||
// (no need for @actorIndependent because it is an immutable let)
|
||||
auto propertyType = C.getActorTransportDecl()->getDeclaredInterfaceType();
|
||||
|
||||
Type propertyType = getDistributedActorTransportType(derived.Nominal);
|
||||
VarDecl *propDecl;
|
||||
PatternBindingDecl *pbDecl;
|
||||
std::tie(propDecl, pbDecl) = derived.declareDerivedProperty(
|
||||
|
||||
Reference in New Issue
Block a user