Skip to content

Commit c547fbd

Browse files
committed
[concurrency] Add a new method ActorIsolation::forActorInstanceSelf.
This occurs when working with ActorIsolation in SIL. This lets us avoid needing to depend on the AST for getting ActorIsolation for self parameters. Now, we can just create the actor isolation we need based off of the decl that we have. The code is based off of forActorInstanceSelf(ValueDecl *decl) along the path where it just creates isolation based off of the decl's nominal type decl (which is equivalent to what we are trying to do here). (cherry picked from commit 04e8bad)
1 parent a55392b commit c547fbd

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

include/swift/AST/ActorIsolation.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ class ActorIsolation {
111111

112112
static ActorIsolation forActorInstanceSelf(ValueDecl *decl);
113113

114+
/// Create an ActorIsolation appropriate for a type that is self.
115+
static ActorIsolation forActorInstanceSelf(NominalTypeDecl *decl);
116+
114117
static ActorIsolation forActorInstanceParameter(NominalTypeDecl *actor,
115118
unsigned parameterIndex) {
116119
return ActorIsolation(ActorInstance, actor, parameterIndex + 1);

lib/AST/Decl.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11387,6 +11387,10 @@ ActorIsolation::forActorInstanceSelf(ValueDecl *decl) {
1138711387
return ActorIsolation(ActorInstance, dc->getSelfNominalTypeDecl(), 0);
1138811388
}
1138911389

11390+
ActorIsolation ActorIsolation::forActorInstanceSelf(NominalTypeDecl *selfDecl) {
11391+
return ActorIsolation(ActorInstance, selfDecl, 0);
11392+
}
11393+
1139011394
NominalTypeDecl *ActorIsolation::getActor() const {
1139111395
assert(getKind() == ActorInstance ||
1139211396
getKind() == GlobalActor);

0 commit comments

Comments
 (0)